next | previous | forward | backward | up | top | index | toc | Macaulay2 website
Macaulay2Doc :: submatrix(Matrix,VisibleList)

submatrix(Matrix,VisibleList) -- select columns

Synopsis

Description

Yields an r by c matrix, where r is the number of rows of f, and c is the length of the list of integers cols. The (i,j)-th entry of the result is f_(i, cols_j).

The list of integers, cols, may contain ranges and repetitions, as in {3, 5..7, 3:0}

If the list of column indices is a permutation of 0 .. n-1, where n is the number of columns, then the result is the corresponding permutation of the columns of f.

i1 : R = ZZ/101[a .. o];
i2 : f = genericMatrix(R, a, 3, 5)

o2 = | a d g j m |
     | b e h k n |
     | c f i l o |

             3       5
o2 : Matrix R  <--- R
i3 : submatrix(f, {1..3,0})

o3 = | d g j a |
     | e h k b |
     | f i l c |

             3       4
o3 : Matrix R  <--- R

See also