up previous next
Submat

submatrix
Syntax

Submat(M:LIST or MAT, R:LIST of INT, C:LIST of INT):MAT


Description
This function returns the submatrix of M formed by the rows listed in R and the columns listed in C. If M is a list, it is interpreted as a matrix in the natural way.

Example
  M := Mat([[1,2,3,4,5],[6,7,8,9,10],[11,12,13,14,15]]);
  Submat(M,[1,3],3..5);
Mat([
  [3, 4, 5],
  [13, 14, 15]
])
-------------------------------
  L := [[1,2,3],[4,5,6]];
  Submat(L,[2],[1,3]);
Mat([
  [4, 6]
])
-------------------------------


See Also