matcat.spad line 63 [edit on github]
MatrixCategory is a general matrix category which allows different representations and indexing schemes. Rows and columns may be extracted with rows returned as objects of type Row and columns returned as objects of type Col. A domain belonging to this category will be shallowly mutable. The index of the 'first' row may be obtained by calling the function minRowIndex. The index of the 'first' column may be obtained by calling the function minColIndex. The index of the first element of a Row is the same as the index of the first column in a matrix and vice versa.
x * y
is the product of the matrices x
and y
. Error: if the dimensions are incompatible.
x * r
is the right scalar multiple of the scalar r
and the matrix x
.
r*x
is the left scalar multiple of the scalar r
and the matrix x
.
n * x
is an integer multiple.
x * c
is the product of the matrix x
and the column vector c
. Error: if the dimensions are incompatible.
r * x
is the product of the row vector r
and the matrix x
. Error: if the dimensions are incompatible.
x + y
is the sum of the matrices x
and y
. Error: if the dimensions are incompatible.
-x
returns the negative of the matrix x
.
x - y
is the difference of the matrices x
and y
. Error: if the dimensions are incompatible.
m/r
divides the elements of m
by r
. Error: if r = 0
.
Pfaffian(m)
returns the Pfaffian of the matrix m
. Error: if the matrix is not antisymmetric.
m^n
computes an integral power of the matrix m
. Error: if matrix is not square or if the matrix is square but not invertible.
x ^ n
computes a non-negative integral power of the matrix x
. Error: if the matrix is not square.
antisymmetric?(m)
returns true
if the matrix m
is square and antisymmetric (i.e. m[i, j] = -m[j, i]
for all i
and j
) and false
otherwise.
coerce(col)
converts the column col
to a column matrix.
columnSpace(m)
returns a sublist of columns of the matrix m
forming a basis of its column space
determinant(m)
returns the determinant of the matrix m
. Error: if the matrix is not square.
diagonal?(m)
returns true
if the matrix m
is square and diagonal (i.e. all entries of m
not on the diagonal are zero) and false
otherwise.
diagonalMatrix([m1, ..., mk])
creates a block diagonal matrix M
with block matrices m1, ..., mk down the diagonal, with 0 block matrices elsewhere. More precisely: if
, ri
:= nrows mi
, then ci
:= ncols mi
m
is an (r1+
..+rk
) by (c1+
..+ck
) - matrix with entries m.i.j = ml.(i-r1-..-r(l-1)).(j-n1-..-n(l-1))
, if (r1+..+r(l-1)) < i <= r1+..+rl
and (c1+..+c(l-1)) < i <= c1+..+cl
, m.i.j
= 0 otherwise.
diagonalMatrix(l)
returns a diagonal matrix with the elements of l
on the diagonal.
exquo(m, r)
computes the exact quotient of the elements of m
by r
, returning "failed"
if this is not possible.
inverse(m)
returns the inverse of the matrix m
. If the matrix is not invertible, "failed" is returned. Error: if the matrix is not square.
kroneckerProduct(a, b)
calculates the Kronecker product of the matrices a and b
. This corresponds to tensor product of corresponding operators.
kroneckerProduct([a1, a2, ..., an])
calculates the Kronecker product of the matrices a1
, a2
, ..., an. This corresponds to tensor product of corresponding operators.
kroneckerSum(a, b)
calculates the Kronecker sum of the matrices a and b
.
kroneckerSum([a1, a2, ..., an])
calculates the Kronecker sum of the matrices a1
, a2
, ..., an.
Should be local but conditional.
matrix(l)
converts the list of lists l
to a matrix, where the list of lists is viewed as a list of the rows of the matrix.
matrix(n,m,f)
constructs an n * m
matrix with the (i,j)
entry equal to f(i,j)
.
minordet(m)
computes the determinant of the matrix m
using minors. Error: if the matrix is not square.
nullSpace(m)
returns a basis for the null space of the matrix m
.
nullity(m)
returns the nullity of the matrix m
. This is the dimension of the null space of the matrix m
.
positivePower(x, n)
computes a positive integral power of the matrix x
. Error: if the matrix is not square.
rank(m)
returns the rank of the matrix m
.
rowEchelon(m)
returns the row echelon form of the matrix m
.
scalarMatrix(n, r)
returns an n
-by-n
matrix with r
's
on the diagonal and zeroes elsewhere.
square?(m)
returns true
if m
is a square matrix (i.e. if m
has the same number of rows as columns) and false
otherwise.
symmetric?(m)
returns true
if the matrix m
is square and symmetric (i.e. m[i, j] = m[j, i]
for all i
and j
) and false
otherwise.
transpose(r)
converts the row r
to a row matrix.
zero(m, n)
returns an m
-by-n
zero matrix.
zero?(m)
returns true
if m
is a zero matrix and false
otherwise.
InnerEvalable(R, R)
TwoDimensionalArrayCategory(R, Row, Col)
Evalable(R)