up previous next
FirstCols, FirstRows    --    submatrix of the first N cols or rows


Syntax
FirstCols(M: MAT, N: INT): MAT
FirstRows(M: MAT, N: INT): MAT

Description
This function returns the submatrix of M formed by the first N colums (or rows).

Example
/**/ M := mat([[1,2,3,4,5],[6,7,8,9,10],[11,12,13,14,15]]);

/**/ FirstCols(M, 3); -- same as submat(M, 1..3, 1..3);
matrix(QQ,
 [[1, 2, 3],
  [6, 7, 8],
  [11, 12, 13]])

/**/ FirstRows(M, 2); -- same as submat(M, 1..2, 1..5);
matrix(QQ,
 [[1, 2, 3, 4, 5],
  [6, 7, 8, 9, 10]])

See Also