linalg::row -- extract rows of a
matrix
Introductionlinalg::row(A, r) extracts the
r-th row vector of the matrix A.
Call(s)linalg::row(A, r)
linalg::row(A, r1..r2)
linalg::row(A, list)
ParametersA |
- | an m x n matrix of a domain of category
Cat::Matrix |
r |
- | the row index: a positive integer <= m |
r1..r2 |
- | a range of row indices (positive integers <= m) |
list |
- | a list of row indices (positive integers <= m) |
Returnsa single row vector or a list of row vectors; a row vector is a
1 x n matrix of category Cat::Matrix(R), where R is
the component ring of A.
Related
Functionslinalg::col, linalg::delCol, linalg::delRow, linalg::setCol, linalg::setRow
Detailslinalg::row(A, r1..r2) returns a list of
row vectors whose indices are in the range r1..r2. If
r2 < r1 then the empty list [] is
returned.linalg::row(A, list) returns a list of
row vectors whose indices are contained in list (in the
same order).
Example
1We define a matrix over Q:
>> A := Dom::Matrix(Dom::Rational)(
[[1, 1/5], [-3/2, 5], [2, -3]]
)
+- -+
| 1, 1/5 |
| |
| -3/2, 5 |
| |
| 2, -3 |
+- -+
and illustrate the three different input formats for the
function linalg::row:
>> linalg::row(A, 2)
+- -+
| -3/2, 5 |
+- -+
>> linalg::row(A, [2, 1, 3])
-- +- -+ +- -+ +- -+ --
| | -3/2, 5 |, | 1, 1/5 |, | 2, -3 | |
-- +- -+ +- -+ +- -+ --
>> linalg::row(A, 2..3)
-- +- -+ +- -+ --
| | -3/2, 5 |, | 2, -3 | |
-- +- -+ +- -+ --