Linear algebra functions in Julia are largely implemented by calling functions from LAPACK. Sparse factorizations call functions from SuiteSparse.
Matrix multiplication
Matrix division using a polyalgorithm. For input matrices A and B, the result X is such that A*X == B when A is square. The solver that is used depends upon the structure of A. A direct solver is used for upper- or lower triangular A. For Hermitian A (equivalent to symmetric A for non-complex A) the BunchKaufman factorization is used. Otherwise an LU factorization is used. For rectangular A the result is the minimum-norm least squares solution computed by reducing A to bidiagonal form and solving the bidiagonal least squares problem. For sparse, square A the LU factorization (from UMFPACK) is used.
Compute the dot product
Compute the cross product of two 3-vectors
Compute the norm of a Vector or a Matrix
Compute the LU factorization of A, such that P*A = L*U.
Compute the LU factorization of A, returning an LUDense object for dense A or an UmfpackLU object for sparse A. The individual components of the factorization F can be accesed by indexing: F[:L], F[:U], and F[:P] (permutation matrix) or F[:p] (permutation vector). An UmfpackLU object has additional components F[:q] (the left permutation vector) and Rs the vector of scaling factors. The following functions are available for both LUDense and UmfpackLU objects: size, \ and det. For LUDense there is also an inv method. The sparse LU factorization is such that L*U is equal to``diagmm(Rs,A)[p,q]``.
lufact! is the same as lufact but saves space by overwriting the input A, instead of creating a copy. For sparse A the nzval field is not overwritten but the index fields, colptr and rowval are decremented in place, converting from 1-based indices to 0-based indices.
Compute Cholesky factorization of a symmetric positive-definite matrix A and return the matrix F. If LU is L (Lower), A = L*L'. If LU is U (Upper), A = R'*R.
Compute the Cholesky factorization of a dense symmetric positive-definite matrix A and return a CholeskyDense object. LU may be ‘L’ for using the lower part or ‘U’ for the upper part. The default is to use ‘U’. The triangular matrix can be obtained from the factorization F with: F[:L] and F[:U]. The following functions are available for CholeskyDense objects: size, \, inv, det. A LAPACK.PosDefException error is thrown in case the matrix is not positive definite.
Compute the sparse Cholesky factorization of a sparse matrix A. If A is Hermitian its Cholesky factor is determined. If A is not Hermitian the Cholesky factor of A*A' is determined. A fill-reducing permutation is used. Methods for size, solve, \, findn_nzs, diag, det and logdet. One of the solve methods includes an integer argument that can be used to solve systems involving parts of the factorization only. The optional boolean argument, ll determines whether the factorization returned is of the A[p,p] = L*L' form, where L is lower triangular or A[p,p] = diagmm(L,D)*L' form where L is unit lower triangular and D is a non-negative vector. The default is LDL.
Compute the pivoted Cholesky factorization of a symmetric positive semi-definite matrix A and return a CholeskyDensePivoted object. LU may be ‘L’ for using the lower part or ‘U’ for the upper part. The default is to use ‘U’. The triangular factors containted in the factorization F can be obtained with F[:L] and F[:U], whereas the permutation can be obtained with F[:P] or F[:p]. The following functions are available for CholeskyDensePivoted objects: size, \, inv, det. A LAPACK.RankDeficientException error is thrown in case the matrix is rank deficient.
cholpfact! is the same as cholpfact but saves space by overwriting the input A, instead of creating a copy.
Compute the QR factorization of A such that A = Q*R. Also see qrfact. The default is to compute a thin factorization.
Compute the QR factorization of A and return a QRDense object. The coomponents of the factorization F can be accessed as follows: the orthogonal matrix Q can be extracted with F[:Q] and the triangular matrix R with F[:R]. The following functions are available for QRDense objects: size, \. When Q is extracted, the resulting type is the QRDenseQ object, and has the * operator overloaded to support efficient multiplication by Q and Q'.
qrfact! is the same as qrfact but saves space by overwriting the input A, instead of creating a copy.
Compute the QR factorization of A with pivoting, such that A*P = Q*R, Also see qrpfact. The default is to compute a thin factorization.
Compute the QR factorization of A with pivoting and return a QRDensePivoted object. The components of the factorization F can be accessed as follows: the orthogonal matrix Q can be extracted with F[:Q], the triangular matrix R with F[:R], and the permutation with F[:P] or F[:p]. The following functions are available for QRDensePivoted objects: size, \. When Q is extracted, the resulting type is the QRDenseQ object, and has the * operator overloaded to support efficient multiplication by Q and Q'. A QRDenseQ matrix can be converted into a regular matrix with full.
qrpfact! is the same as qrpfact but saves space by overwriting the input A, instead of creating a copy.
Compute the matrix square root of A. If B = sqrtm(A), then B*B == A within roundoff error.
Compute eigenvalues and eigenvectors of A
Returns the eigenvalues of A.
Returns the eigenvectors of A.
If the optional vector of eigenvalues eigvals is specified, returns the specific corresponding eigenvectors. (Currently this optional syntax only works for SymTridiagonal matrices.)
Compute the eigenvalue decomposition of A and return an EigenDense object. If F is the factorization object, the eigenvalues can be accessed with F[:values] and the eigenvectors with F[:vectors]. The following functions are available for EigenDense objects: inv, det.
eigfact! is the same as eigfact but saves space by overwriting the input A, instead of creating a copy.
Compute the Hessenberg decomposition of A and return a HessenbergDense object. If F is the factorization object, the unitary matrix can be accessed with F[:Q] and the Hessenberg matrix with F[:H]. When Q is extracted, the resulting type is the HessenbergDenseQ object, and may be converted to a regular matrix with full.
hessfact! is the same as hessfact but saves space by overwriting the input A, instead of creating a copy.
Compute the Singular Value Decomposition (SVD) of A and return an SVDDense object. U, S, V and Vt can be obtained from the factorization F with F[:U], F[:S], F[:V] and F[:Vt], such that A = U*diagm(S)*Vt. If thin is true, an economy mode decomposition is returned. The algorithm produces Vt and hence Vt is more efficient to extract than V. The default is to produce a thin decomposition.
svdfact! is the same as svdfact but saves space by overwriting the input A, instead of creating a copy. If thin is true, an economy mode decomposition is returned. The default is to produce a thin decomposition.
Compute the SVD of A, returning U, vector S, and V such that A == U*diagm(S)*V'. If thin is true, an economy mode decomposition is returned.
Returns the singular values of A.
Returns the singular values of A, while saving space by overwriting the input.
Compute the generalized SVD of A and B, returning a GSVDDense Factorization object, such that A = U*D1*R0*Q' and B = V*D2*R0*Q'.
Compute the generalized SVD of A and B, returning U, V, Q, D1, D2, and R0 such that A = U*D1*R0*Q' and B = V*D2*R0*Q'.
Return only the singular values from the generalized singular value decomposition of A and B.
Upper triangle of a matrix
Lower triangle of a matrix
The k-th diagonal of a matrix, as a vector
Construct a diagonal matrix and place v on the k-th diagonal
Multiply matrices, interpreting the vector argument as a diagonal matrix. The arguments may occur in the other order to multiply with the diagonal matrix on the left.
Construct a tridiagonal matrix from the lower diagonal, diagonal, and upper diagonal
Construct a matrix in a form suitable for applying the Woodbury matrix identity
Compute the rank of a matrix
Compute the p-norm of a vector or a matrix. p is 2 by default, if not provided. If A is a vector, norm(A, p) computes the p-norm. norm(A, Inf) returns the largest value in abs(A), whereas norm(A, -Inf) returns the smallest. If A is a matrix, valid values for p are 1, 2, or Inf. In order to compute the Frobenius norm, use normfro.
Compute the Frobenius norm of a matrix A.
Matrix condition number, computed using the p-norm. p is 2 by default, if not provided. Valid values for p are 1, 2, or Inf.
Matrix trace
Matrix determinant
Matrix inverse
Moore-Penrose inverse
Basis for null space of M.
Construct a matrix by repeating the given matrix n times in dimension 1 and m times in dimension 2.
Kronecker tensor product of two vectors or two matrices.
Determine parameters [a, b] that minimize the squared error between y and a+b*x.
Weighted least-squares linear regression.
Matrix exponential.
Test whether a matrix is symmetric.
Test whether a matrix is positive-definite.
Test whether a matrix is lower-triangular.
Test whether a matrix is upper-triangular.
Test whether a matrix is hermitian.
The transpose operator (.’).
The conjugate transpose operator (‘).
This module provides wrappers for some of the BLAS functions for linear algebra. Those BLAS functions that overwrite one of the input arrays have names ending in '!'.
Usually a function has 4 methods defined, one each for Float64, Float32, Complex128 and Complex64 arrays.
Copy n elements of array X with stride incx to array Y with stride incy. Returns Y.
Dot product of two vectors consisting of n elements of array X with stride incx and n elements of array Y with stride incy. There are no dot methods for Complex arrays.
2-norm of a vector consisting of n elements of array X with stride incx.
Overwrite Y with a*X + Y. Returns Y.
Rank-k update of the symmetric matrix C as alpha*A*A.' + beta*C or alpha*A.'*A + beta*C according to whether trans is ‘N’ or ‘T’. When uplo is ‘U’ the upper triangle of C is updated (‘L’ for lower triangle). Returns C.
Returns either the upper triangle or the lower triangle, according to uplo (‘U’ or ‘L’), of alpha*A*A.' or alpha*A.'*A, according to trans (‘N’ or ‘T’).
Methods for complex arrays only. Rank-k update of the Hermitian matrix C as alpha*A*A' + beta*C or alpha*A'*A + beta*C according to whether trans is ‘N’ or ‘T’. When uplo is ‘U’ the upper triangle of C is updated (‘L’ for lower triangle). Returns C.
Methods for complex arrays only. Returns either the upper triangle or the lower triangle, according to uplo (‘U’ or ‘L’), of alpha*A*A' or alpha*A'*A, according to trans (‘N’ or ‘T’).
Update vector y as alpha*A*x + beta*y or alpha*A'*x + beta*y according to trans (‘N’ or ‘T’). The matrix A is a general band matrix of dimension m by size(A,2) with kl sub-diagonals and ku super-diagonals. Returns the updated y.
Returns alpha*A*x or alpha*A'*x according to trans (‘N’ or ‘T’). The matrix A is a general band matrix of dimension m by size(A,2) with kl sub-diagonals and ku super-diagonals.
Update vector y as alpha*A*x + beta*y where A is a a symmetric band matrix of order size(A,2) with k super-diagonals stored in the argument A. The storage layout for A is described the reference BLAS module, level-2 BLAS at <http://www.netlib.org/lapack/explore-html/>.
Returns the updated y.
Returns alpha*A*x where A is a symmetric band matrix of order size(A,2) with k super-diagonals stored in the argument A.
Update C as alpha*A*B + beta*C or the other three variants according to tA (transpose A) and tB. Returns the updated C.
Returns alpha*A*B or the other three variants according to tA (transpose A) and tB.