MatrixManipulation(R, Row, Col, M)ΒΆ
mama.spad line 1 [edit on github]
R: Type
Row: FiniteLinearAggregate R
Col: FiniteLinearAggregate R
M: TwoDimensionalArrayCategory(R, Row, Col)
Some functions for manipulating (dense) matrices. Supported are various kinds of slicing, splitting and stacking of matrices. The functions resemble operations often used in numerical linear algebra algorithms.
- bandMatrix: (M, List Integer) -> M if R has AbelianMonoid
bandMatrixreturns multiple diagonals out of a matrix. The diagonals are put into a matrix of same shape as the original one. Positive integer arguments select upper off-diagonals, negative ones lower off-diagonals.
- bandMatrix: (M, Segment Integer) -> M if R has AbelianMonoid
bandMatrixreturns multiple diagonals out of a matrix. The diagonals are put into a matrix of same shape as the original one. Positive integer arguments select upper off-diagonals, negative ones lower off-diagonals.
- blockSplit: (M, List NonNegativeInteger, PositiveInteger) -> List List M
blockSplitsplits a matrix into multiple submatrices row and column wise, dividing a matrix into blocks.
- blockSplit: (M, PositiveInteger, List NonNegativeInteger) -> List List M
blockSplitsplits a matrix into multiple submatrices row and column wise, dividing a matrix into blocks.
- columnMatrix: (M, Integer) -> M
columnMatrixreturns a single column out of a matrix. The column is put into a one byNmatrix.
- columns: (M, List Integer) -> M
columnsreturns several columns out of a matrix. The columns are stacked into a matrix.
- columns: (M, Segment Integer) -> M
columnsreturns several columns out of a matrix. The columns are stacked into a matrix.
- diagonalMatrix: (M, Integer) -> M if R has AbelianMonoid
diagonalMatrixreturns a diagonal out of a matrix. The diagonal is put into a matrix of same shape as the original one. Positive integer arguments select upper off-diagonals, negative ones lower off-diagonals.
- diagonalMatrix: M -> M if R has AbelianMonoid
diagonalMatrixreturns the main diagonal out of a matrix. The diagonal is put into a matrix of same shape as the original one.
- element: (M, Integer, Integer) -> M
elementreturns a single element out of a matrix. The element is put into a one by one matrix.
- rowMatrix: (M, Integer) -> M
rowMatrixreturns a single row out of a matrix. The row is put into a one byNmatrix.
- rows: (M, List Integer) -> M
rowsreturns several rows out of a matrix. The rows are stacked into a matrix.
- rows: (M, Segment Integer) -> M
rowsreturns several rows out of a matrix. The rows are stacked into a matrix.