MatrixManipulation(R, Row, Col, M)ΒΆ

mama.spad line 1

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
bandMatrix returns 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
bandMatrix returns 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
blockSplit splits a matrix into multiple submatrices row and column wise, dividing a matrix into blocks.
blockSplit: (M, PositiveInteger, List NonNegativeInteger) -> List List M
blockSplit splits a matrix into multiple submatrices row and column wise, dividing a matrix into blocks.
columnMatrix: (M, Integer) -> M
columnMatrix returns a single column out of a matrix. The column is put into a one by N matrix.
columns: (M, List Integer) -> M
columns returns several columns out of a matrix. The columns are stacked into a matrix.
columns: (M, Segment Integer) -> M
columns returns several columns out of a matrix. The columns are stacked into a matrix.
diagonalMatrix: (M, Integer) -> M if R has AbelianMonoid
diagonalMatrix returns 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
diagonalMatrix returns 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
element returns a single element out of a matrix. The element is put into a one by one matrix.
rowMatrix: (M, Integer) -> M
rowMatrix returns a single row out of a matrix. The row is put into a one by N matrix.
rows: (M, List Integer) -> M
rows returns several rows out of a matrix. The rows are stacked into a matrix.
rows: (M, Segment Integer) -> M
rows returns several rows out of a matrix. The rows are stacked into a matrix.
subMatrix: (M, List Integer, List Integer) -> M
subMatrix returns several elements out of a matrix. The elements are stacked into a submatrix.
subMatrix: (M, Segment Integer, Segment Integer) -> M
subMatrix returns several elements out of a matrix. The elements are stacked into a submatrix.