linalg::col -- extract columns of a
matrix
Introductionlinalg::col(A, c) extracts the
c-th column vector of the matrix A.
Call(s)linalg::col(A, c)
linalg::col(A, c1..c2)
linalg::col(A, list)
ParametersA |
- | an m x n matrix of a domain of category
Cat::Matrix |
c |
- | the column index: a positive integer <= n |
c1..c2 |
- | a range of column indices (positive integers <= n) |
list |
- | a list of column indices (positive integers <= n) |
Returnsa single column vector or a list of column vectors; a column vector
is an m x 1 matrix of category Cat::Matrix(R), where R is
the component ring of A.
Related
Functionslinalg::row, linalg::delCol, linalg::delRow, linalg::setCol, linalg::setRow
Detailslinalg::col(A, c1..c2) returns a list of
column vectors whose indices are in the range c1..c2. If
c2 < c1 then the empty list [] is
returned.linalg::col(A, list) returns a list of
column 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, 2], [-3/2, 0, 5]]
)
+- -+
| 1, 1/5, 2 |
| |
| -3/2, 0, 5 |
+- -+
and illustrate the three different input formats for
linalg::col:
>> linalg::col(A, 2)
+- -+
| 1/5 |
| |
| 0 |
+- -+
>> linalg::col(A, [2, 1, 3])
-- +- -+ +- -+ +- -+ --
| | 1/5 | | 1 | | 2 | |
| | |, | |, | | |
| | 0 | | -3/2 | | 5 | |
-- +- -+ +- -+ +- -+ --
>> linalg::col(A, 2..3)
-- +- -+ +- -+ --
| | 1/5 | | 2 | |
| | |, | | |
| | 0 | | 5 | |
-- +- -+ +- -+ --