StorageEfficientMatrixOperations RΒΆ
matstor.spad line 1 [edit on github]
R: Ring
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 then
-th power of a square matrix. The powern
is assumed greater than 1.
- copy!: (Matrix R, Matrix R) -> Matrix R
copy!(c, a)
copies the matrixa
into the matrixc
. Error: ifa
andc
do not have the same dimensions.
- leftScalarTimes!: (Matrix R, R, Matrix R) -> Matrix R
leftScalarTimes!(c, r, a)
computes the scalar productr * a
and stores the result in the matrixc
. Error: ifa
andc
do not have the same dimensions.
- minus!: (Matrix R, Matrix R) -> Matrix R
minus!(c, a)
computes-a
and stores the result in the matrixc
. Error: if a andc
do not have the same dimensions.
- minus!: (Matrix R, Matrix R, Matrix R) -> Matrix R
!minus!(c, a, b)
computes the matrix differencea - b
and stores the result in the matrixc
. Error: ifa
,b
, andc
do not have the same dimensions.
- plus!: (Matrix R, Matrix R, Matrix R) -> Matrix R
plus!(c, a, b)
computes the matrix suma + b
and stores the result in the matrixc
. Error: ifa
,b
, andc
do not have the same dimensions.
- power!: (Matrix R, Matrix R, Matrix R, Matrix R, NonNegativeInteger) -> Matrix R
power!(a, b, c, m, n)
computesm
^n
and stores the result ina
. The matricesb
andc
are used to store intermediate results. Error: ifa
,b
,c
, andm
are not square and of the same dimensions.