StorageEfficientMatrixOperations RΒΆ

matstor.spad line 1 [edit on github]

This package provides standard arithmetic operations on matrices. The functions in this package store the results of computations in existing matrices, rather than creating new matrices. This package works only for matrices of type Matrix and uses the internal representation of this type.

^: (Matrix R, NonNegativeInteger) -> Matrix R

x ^ n computes the n-th power of a square matrix. The power n is assumed greater than 1.

copy!: (Matrix R, Matrix R) -> Matrix R

copy!(c, a) copies the matrix a into the matrix c. Error: if a and c do not have the same dimensions.

leftScalarTimes!: (Matrix R, R, Matrix R) -> Matrix R

leftScalarTimes!(c, r, a) computes the scalar product r * a and stores the result in the matrix c. Error: if a and c do not have the same dimensions.

minus!: (Matrix R, Matrix R) -> Matrix R

minus!(c, a) computes -a and stores the result in the matrix c. Error: if a and c do not have the same dimensions.

minus!: (Matrix R, Matrix R, Matrix R) -> Matrix R

!minus!(c, a, b) computes the matrix difference a - b and stores the result in the matrix c. Error: if a, b, and c do not have the same dimensions.

plus!: (Matrix R, Matrix R, Matrix R) -> Matrix R

plus!(c, a, b) computes the matrix sum a + b and stores the result in the matrix c. Error: if a, b, and c do not have the same dimensions.

power!: (Matrix R, Matrix R, Matrix R, Matrix R, NonNegativeInteger) -> Matrix R

power!(a, b, c, m, n) computes m ^ n and stores the result in a. The matrices b and c are used to store intermediate results. Error: if a, b, c, and m are not square and of the same dimensions.

rightScalarTimes!: (Matrix R, Matrix R, R) -> Matrix R

rightScalarTimes!(c, a, r) computes the scalar product a * r and stores the result in the matrix c. Error: if a and c do not have the same dimensions.

times!: (Matrix R, Matrix R, Matrix R) -> Matrix R

times!(c, a, b) computes the matrix product a * b and stores the result in the matrix c. Error: if a, b, and c do not have compatible dimensions.