Octave Programming Tutorial/Linear algebra
Tools
General
Sister projects
In other projects
d = det(A) computes thedeterminant of the matrixA.lambda = eig(A) returns theeigenvalues ofA in the vectorlambda, and[V, lambda] = eig(A) also returns theeigenvectors inV butlambda is now a matrix whose diagonals contain the eigenvalues. This relationship holds true (within round off errors)A = V*lambda*inv(V).inv(A) computes the inverse of non-singular matrixA. Note that calculating the inverse is often 'not' necessary. See the next two operators as examples. Note that in theoryA*inv(A) should return the identity matrix, but in practice, there may be some round off errors so the result may not be exact.A / B computesX such that. This is called right division and is done without forming the inverse ofB.A \ B computesX such that. This is called left division and is done without forming the inverse ofA.norm(A, p) computes thep-norm of the matrix (or vector)A. The second argument is optional with default value.rank(A) computes the (numerical)rank of a matrix.trace(A) computes thetrace (sum of the diagonal elements) ofA.expm(A) computes the matrix exponential of a square matrix. This is defined aslogm(A) computes thematrix logarithm of a square matrix.sqrtm(A) computes thematrix square root of a square matrix.Below are some more linear algebra functions. Usehelp to find out more about them.
balance (eigenvalue balancing),cond (condition number),dmult (computes diag(x) * A efficiently),dot (dot product),givens (Givens rotation),kron (Kronecker product),null (orthonormal basis of the null space),orth (orthonormal basis of the range space),pinv (pseudoinverse),syl (solves the Sylvester equation).R = chol(A) computes the Cholesky factorization of the symmetric positive definite matrixA, i.e. the upper triangular matrixR such that.[L, U] = lu(A) computes the LU decomposition ofA, i.e.L is lower triangular,U upper triangular and.[Q, R] = qr(A) computes the QR decomposition ofA, i.e.Q is orthogonal,R is upper triangular and.Below are some more available factorizations. Usehelp to find out more about them.
qz (generalized eigenvalue problem: QZ decomposition),qzhess (Hessenberg-triangular decomposition),schur (Schur decomposition),svd (singular value decomposition),housh (Householder reflections),krylov (Orthogonal basis of block Krylov subspace).Return to theOctave Programming Tutorial index