Linear Algebra

AuxiliaryUnitMatrix
AuxiliaryUnitMatrix (n)

Get the auxiliary unit matrix of size n. This is a square matrix with that is all zero except the superdiagonal being all ones. It is the Jordan block matrix of one zero eigenvalue.

See Planetmath or Mathworld for more information on Jordan Canonical Form.

BilinearForm
BilinearForm (v,A,w)

Evaluate (v,w) with respect to the bilinear form given by the matrix A.

BilinearFormFunction
BilinearFormFunction (A)

Return a function that evaluates two vectors with respect to the bilinear form given by A.

CharacteristicPolynomial
CharacteristicPolynomial (M)

Aliases: CharPoly

Get the characteristic polynomial as a vector. That is, return the coefficients of the polynomial starting with the constant term. This is the polynomial defined by det(M-xI). The roots of this polynomial are the eigenvalues of M. See also CharacteristicPolynomialFunction.

See Wikipedia or Planetmath for more information.

CharacteristicPolynomialFunction
CharacteristicPolynomialFunction (M)

Get the characteristic polynomial as a function. This is the polynomial defined by det(M-xI). The roots of this polynomial are the eigenvalues of M. See also CharacteristicPolynomial.

See Wikipedia or Planetmath for more information.

ColumnSpace
ColumnSpace (M)

Get a basis matrix for the columnspace of a matrix. That is, return a matrix whose columns are the basis for the column space of M. That is the space spanned by the columns of M.

See Wikipedia for more information.

CommutationMatrix
CommutationMatrix (m, n)

Return the commutation matrix K(m,n), which is the unique m*n by m*n matrix such that K(m,n) * MakeVector(A) = MakeVector(A.') for all m by n matrices A.

CompanionMatrix
CompanionMatrix (p)

Companion matrix of a polynomial (as vector).

ConjugateTranspose
ConjugateTranspose (M)

Conjugate transpose of a matrix (adjoint). This is the same as the ' operator.

See Wikipedia or Planetmath for more information.

Convolution
Convolution (a,b)

Aliases: convol

Calculate convolution of two horizontal vectors.

ConvolutionVector
ConvolutionVector (a,b)

Calculate convolution of two horizontal vectors. Return result as a vector and not added together.

CrossProduct
CrossProduct (v,w)

CrossProduct of two vectors in R3 as a column vector.

See Wikipedia for more information.

DeterminantalDivisorsInteger
DeterminantalDivisorsInteger (M)

Get the determinantal divisors of an integer matrix.

DirectSum
DirectSum (M,N...)

Direct sum of matrices.

See Wikipedia for more information.

DirectSumMatrixVector
DirectSumMatrixVector (v)

Direct sum of a vector of matrices.

See Wikipedia for more information.

Eigenvalues
Eigenvalues (M)

Aliases: eig

Get the eigenvalues of a square matrix. Currently only works for matrices of size up to 4 by 4, or for triangular matrices (for which the eigenvalues are on the diagonal).

See Wikipedia, Planetmath, or Mathworld for more information.

Eigenvectors
Eigenvectors (M)
Eigenvectors (M, &eigenvalues)
Eigenvectors (M, &eigenvalues, &multiplicities)

Get the eigenvectors of a square matrix. Optionally get also the eigenvalues and their algebraic multiplicities. Currently only works for matrices of size up to 2 by 2.

See Wikipedia, Planetmath, or Mathworld for more information.

GramSchmidt
GramSchmidt (v,B...)

Apply the Gram-Schmidt process (to the columns) with respect to inner product given by B. If B is not given then the standard Hermitian product is used. B can either be a sesquilinear function of two arguments or it can be a matrix giving a sesquilinear form. The vectors will be made orthonormal with respect to B.

See Wikipedia or Planetmath for more information.

HankelMatrix
HankelMatrix (c,r)

Hankel matrix, a matrix whose skew-diagonals are constant. c is the first row and r is the last column. It is assumed that both arguments are vectors and the last element of c is the same as the first element of r.

See Wikipedia for more information.

HilbertMatrix
HilbertMatrix (n)

Hilbert matrix of order n.

See Wikipedia or Planetmath for more information.

Image
Image (T)

Get the image (columnspace) of a linear transform.

See Wikipedia for more information.

InfNorm
InfNorm (v)

Get the Inf Norm of a vector, sometimes called the sup norm or the max norm.

InvariantFactorsInteger
InvariantFactorsInteger (M)

Get the invariant factors of a square integer matrix.

InverseHilbertMatrix
InverseHilbertMatrix (n)

Inverse Hilbert matrix of order n.

See Wikipedia or Planetmath for more information.

IsHermitian
IsHermitian (M)

Is a matrix Hermitian. That is, is it equal to its conjugate transpose.

See Wikipedia or Planetmath for more information.

IsInSubspace
IsInSubspace (v,W)

Test if a vector is in a subspace.

IsInvertible
IsInvertible (n)

Is a matrix (or number) invertible (Integer matrix is invertible if and only if it is invertible over the integers).

IsInvertibleField
IsInvertibleField (n)

Is a matrix (or number) invertible over a field.

IsNormal
IsNormal (M)

Is M a normal matrix. That is, does M*M' == M'*M.

See Planetmath or Mathworld for more information.

IsPositiveDefinite
IsPositiveDefinite (M)

Is M a Hermitian positive definite matrix. That is if HermitianProduct(M*v,v) is always strictly positive for any vector v. M must be square and Hermitian to be positive definite. The check that is performed is that every principal submatrix has a non-negative determinant. (See HermitianProduct)

Note that some authors (for example Mathworld) do not require that M be Hermitian, and then the condition is on the real part of the inner product, but we do not take this view. If you wish to perform this check, just check the Hermitian part of the matrix M as follows: IsPositiveDefinite(M+M').

See Wikipedia, Planetmath, or Mathworld for more information.

IsPositiveSemidefinite
IsPositiveSemidefinite (M)

Is M a Hermitian positive semidefinite matrix. That is if HermitianProduct(M*v,v) is always non-negative for any vector v. M must be square and Hermitian to be positive semidefinite. The check that is performed is that every principal submatrix has a non-negative determinant. (See HermitianProduct)

Note that some authors do not require that M be Hermitian, and then the condition is on the real part of the inner product, but we do not take this view. If you wish to perform this check, just check the Hermitian part of the matrix M as follows: IsPositiveSemidefinite(M+M').

See Planetmath or Mathworld for more information.

IsSkewHermitian
IsSkewHermitian (M)

Is a matrix skew-Hermitian. That is, is the conjugate transpose equal to negative of the matrix.

See Planetmath for more information.

IsUnitary
IsUnitary (M)

Is a matrix unitary? That is, does M'*M and M*M' equal the identity.

See Planetmath or Mathworld for more information.

JordanBlock
JordanBlock (n,lambda)

Aliases: J

Get the Jordan block corresponding to the eigenvalue lambda with multiplicity n.

See Planetmath or Mathworld for more information.

Kernel
Kernel (T)

Get the kernel (nullspace) of a linear transform.

(See NullSpace)

KroneckerProduct
KroneckerProduct (M, N)

Aliases: TensorProduct

Compute the Kronecker product (tensor product in standard basis) of two matrices.

See Wikipedia, Planetmath or Mathworld for more information.

Version 1.0.18 onwards.

LUDecomposition
LUDecomposition (A, L, U)

Get the LU decomposition of A, that is find a lower triangular matrix and upper triangular matrix whose product is A. Store the result in the L and U, which should be references. It returns true if successful. For example suppose that A is a square matrix, then after running:

genius> LUDecomposition(A,&L,&U)

You will have the lower matrix stored in a variable called L and the upper matrix in a variable called U.

This is the LU decomposition of a matrix aka Crout and/or Cholesky reduction. (ISBN 0-201-11577-8 pp.99-103) The upper triangular matrix features a diagonal of values 1 (one). This is not Doolittle's Method, which features the 1's diagonal on the lower matrix.

Not all matrices have LU decompositions, for example [0,1;1,0] does not and this function returns false in this case and sets L and U to null.

See Wikipedia, Planetmath or Mathworld for more information.

Minor
Minor (M,i,j)

Get the i-j minor of a matrix.

See Planetmath for more information.

NonPivotColumns
NonPivotColumns (M)

Return the columns that are not the pivot columns of a matrix.

Norm
Norm (v,p...)

Aliases: norm

Get the p Norm (or 2 Norm if no p is supplied) of a vector.

NullSpace
NullSpace (T)

Get the nullspace of a matrix. That is the kernel of the linear mapping that the matrix represents. This is returned as a matrix whose column space is the nullspace of T.

See Planetmath for more information.

Nullity
Nullity (M)

Aliases: nullity

Get the nullity of a matrix. That is, return the dimension of the nullspace; the dimension of the kernel of M.

See Planetmath for more information.

OrthogonalComplement
OrthogonalComplement (M)

Get the orthogonal complement of the columnspace.

PivotColumns
PivotColumns (M)

Return pivot columns of a matrix, that is columns that have a leading 1 in row reduced form. Also returns the row where they occur.

Projection
Projection (v,W,B...)

Projection of vector v onto subspace W with respect to inner product given by B. If B is not given then the standard Hermitian product is used. B can either be a sesquilinear function of two arguments or it can be a matrix giving a sesquilinear form.

QRDecomposition
QRDecomposition (A, Q)

Get the QR decomposition of a square matrix A, returns the upper triangular matrix R and sets Q to the orthogonal (unitary) matrix. Q should be a reference or null if you don't want any return. For example:

genius> R = QRDecomposition(A,&Q)

You will have the upper triangular matrix stored in a variable called R and the orthogonal (unitary) matrix stored in Q.

See Wikipedia or Planetmath or Mathworld for more information.

RayleighQuotient
RayleighQuotient (A,x)

Return the Rayleigh quotient (also called the Rayleigh-Ritz quotient or ratio) of a matrix and a vector.

See Planetmath for more information.

RayleighQuotientIteration
RayleighQuotientIteration (A,x,epsilon,maxiter,vecref)

Find eigenvalues of A using the Rayleigh quotient iteration method. x is a guess at a eigenvector and could be random. It should have nonzero imaginary part if it will have any chance at finding complex eigenvalues. The code will run at most maxiter iterations and return null if we cannot get within an error of epsilon. vecref should either be null or a reference to a variable where the eigenvector should be stored.

See Planetmath for more information on Rayleigh quotient.

Rank
Rank (M)

Aliases: rank

Get the rank of a matrix.

See Planetmath for more information.

RosserMatrix
RosserMatrix ()

Returns the Rosser matrix, which is a classic symmetric eigenvalue test problem.

Rotation2D
Rotation2D (angle)

Aliases: RotationMatrix

Return the matrix corresponding to rotation around origin in R2.

Rotation3DX
Rotation3DX (angle)

Return the matrix corresponding to rotation around origin in R3 about the x-axis.

Rotation3DY
Rotation3DY (angle)

Return the matrix corresponding to rotation around origin in R3 about the y-axis.

Rotation3DZ
Rotation3DZ (angle)

Return the matrix corresponding to rotation around origin in R3 about the z-axis.

RowSpace
RowSpace (M)

Get a basis matrix for the rowspace of a matrix.

SesquilinearForm
SesquilinearForm (v,A,w)

Evaluate (v,w) with respect to the sesquilinear form given by the matrix A.

SesquilinearFormFunction
SesquilinearFormFunction (A)

Return a function that evaluates two vectors with respect to the sesquilinear form given by A.

SmithNormalFormField
SmithNormalFormField (A)

Returns the Smith normal form of a matrix over fields (will end up with 1's on the diagonal).

See Wikipedia for more information.

SmithNormalFormInteger
SmithNormalFormInteger (M)

Return the Smith normal form for square integer matrices over integers.

See Wikipedia for more information.

SolveLinearSystem
SolveLinearSystem (M,V,args...)

Solve linear system Mx=V, return solution V if there is a unique solution, null otherwise. Extra two reference parameters can optionally be used to get the reduced M and V.

ToeplitzMatrix
ToeplitzMatrix (c, r...)

Return the Toeplitz matrix constructed given the first column c and (optionally) the first row r. If only the column c is given then it is conjugated and the nonconjugated version is used for the first row to give a Hermitian matrix (if the first element is real of course).

See Wikipedia or Planetmath for more information.

Trace
Trace (M)

Aliases: trace

Calculate the trace of a matrix. That is the sum of the diagonal elements.

See Wikipedia or Planetmath for more information.

Transpose
Transpose (M)

Transpose of a matrix. This is the same as the .' operator.

See Wikipedia or Planetmath for more information.

VandermondeMatrix
VandermondeMatrix (v)

Aliases: vander

Return the Vandermonde matrix.

See Wikipedia for more information.

VectorAngle
VectorAngle (v,w,B...)

The angle of two vectors with respect to inner product given by B. If B is not given then the standard Hermitian product is used. B can either be a sesquilinear function of two arguments or it can be a matrix giving a sesquilinear form.

VectorSpaceDirectSum
VectorSpaceDirectSum (M,N)

The direct sum of the vector spaces M and N.

VectorSubspaceIntersection
VectorSubspaceIntersection (M,N)

Intersection of the subspaces given by M and N.

VectorSubspaceSum
VectorSubspaceSum (M,N)

The sum of the vector spaces M and N, that is {w | w=m+n, m in M, n in N}.

adj
adj (m)

Aliases: Adjugate

Get the classical adjoint (adjugate) of a matrix.

cref
cref (M)

Aliases: CREF ColumnReducedEchelonForm

Compute the Column Reduced Echelon Form.

det
det (M)

Aliases: Determinant

Get the determinant of a matrix.

See Wikipedia or Planetmath for more information.

ref
ref (M)

Aliases: REF RowEchelonForm

Get the row echelon form of a matrix. That is, apply gaussian elimination but not backaddition to M. The pivot rows are divided to make all pivots 1.

See Wikipedia or Planetmath for more information.

rref
rref (M)

Aliases: RREF ReducedRowEchelonForm

Get the reduced row echelon form of a matrix. That is, apply gaussian elimination together with backaddition to M.

See Wikipedia or Planetmath for more information.