Linear Algebra

Suppose that A is a matrix.
lu(A): LU factorization of matrix . Find matrices P, L, U such that P A = L U, where L and U are lower and upper triangular matrices and P is row permulation of identity matrix. A has to be square. Does not return L, U, or P. Instead, stores factorization result internally so that subsequent computations involving A will take its advantage. This procedure is usually unnecessary as using the backslash operator to solve lineary systems will automatically invoke LU factorization and memorize the result.
LU(A): LU factorization of matrix . Returns the list of matrices (L, U, P), such that P A = L U.
qr(A): QR factorization of matrix . Find matrices Q, R such that A = QR, where Q is orthogonal matrix and R is upper triangular matrix. A doesn't need to be square. qr(A) doesn't return Q or R. It just stores the factorization results internally and use them in subsequent least square computations involving A.
QR(A): QR factorization of matrix . Returns the list of two matrices (Q, R).
svd(A): singular value decomposition of matrix . Find matrices U, S, V such that A = U'SV, where U and V are orthogonal matrices and S is diagonal matrix. Doesn't return U, S, or V, just store them internally for late use.

SVD(A): singular value decomposition of matrix . Returns the list of two matrices (U, S, V).
eig(A) eigenvalues and eigenvectors of square matrix . Returns a list (d, v), where d is a column vector of eigenvalues of A, and the columns of v are the corresponding eigenvectors.

norm(A, p): returns the p norm of vector or matrix A. p can be 1, 2, inf, or "fro".

norm(A) returns the 2 norm of A.

cond(A, p): returns the condition number of matrix A using matrix p norm.

cond(A): returns the condition number of matrix A using matrix 2 norm.

rank(A, t): returns the rank of matrix A using threshold t.

rank(A): returns the rank of matrix A using threshold eps.

det(A): returns the determinant of square matrix A.

inverse(A): returns the inverse of square matrix A.

cholesky(A): returns the Cholesky decomposition of positive definite matrix A.

identity(n): returns identity matrix.

sign(A): returns the sign of A if A is a vector; or the matrix of the signs of the elements of matrix A.

arg(A): returns the angles on the complex plane corresponding to each element of matrix A.

dot(u, v): dot product of vectors u and v
cross(u, v): cross product of two 3D vectors u and v

trace(A): the trace of square matrix A.

trans(A): the transpose of matrix A.

sparsity(A): returns the ratio between memory savings and logical size for matrix A. For normal dense matrix, always returns zero. No zero value is returned only for sparse matrix, banded matrix, and range (those created by zeros, ones, and linspace).

isnan(x): returns 1 if x is NaN, and 0 otherwise.

hasnan(x): returns 1 if at least one entry of x is NaN, and 0 otherwise.

isfinite(x): returns 1 if each element of x is finite, 0 otherwise.

oz 2009-12-22