up previous next
submat

submatrix

Syntax
submat(M: 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);
matrix(QQ,
 [[3, 4, 5],
  [13, 14, 15]])

/**/  M := mat([[1,2,3],[4,5,6]]);
/**/  submat(M,[2],[1,3]);
matrix(QQ,
 [[4, 6]])

See Also