Skip to main content

Linear Algebra

The Linear Algebra module provides a high-level interface for linear algebra and numerical mathematics.

Factories

NameDescription
arrayConverts a container to an array.
choleskyComputes the Cholesky decomposition of a RealMatrix A.. By default, the standard algorithm is used; to use the robust algorithm instead, provide the option 'algorithm' with value 'robust'.
eigensolverComputes the eigenvalues and eigenvectors of a matrix.
filledCreates a container with the specified shape and type, filled with the specified value.
filled_likeReturn a container with the same shape and type as a given container, filled with a prescribed value.
identityCreates an identity matrix (or array; possibly rectangular) with the specified shape and type.
identity_likeReturn the identity with the same shape and type as a given container.
luComputes the LU decomposition of a ComplexMatrix A.. By default, partial pivoting is used and the resulting factorization is PA = LU, where P is a permutation matrix, L is lower triangular with unit diagonal elements, and U is upper triangular. To use full pivoting instead, provide the option 'pivoting' with value 'full'. The resulting factorization is PAQ = LU, where P and Q are permutation matrices.
matrixConverts a container to a matrix with the same elements.
onesCreates a container with the specified shape and type, filled with ones.
ones_likeReturn a container of ones with the same shape and type as a given container.
qrComputes the QR decomposition of a RealMatrix A.. By default, no pivoting is used and the resulting factorization is A = QR, where Q is a unitary matrix and R is upper triangular. To use partial (column) pivoting, provide the option 'pivoting' with value 'partial'. The resulting factorization is AP = QR, where P is a permutation matrix. To use full pivoting, provide the option 'pivoting' with value 'full'.
randomCreates a container with the specified shape and type, filled with random values.
svdComputes the singular value decomposition (SVD) of an n-by-p RealMatrix A as a product A=USV^T where U is a n-by-m unitary, V is a p-by-m unitary, m=min(n,p)m = min(n,p), and S is an m-by-m real positive diagonal matrix; the diagonal entries of S are known as the singular values of A and the columns of U and V are known as the left and right singular vectors of A respectively. Singular values are always sorted in decreasing order.. By default, the Jacobi algorithm is used; to use the block divide and conquer (BDC) algorithm instead, provide the option 'algorithm' with value 'bdc'.
uninitializedCreates a container with the specified shape and type.
uninitialized_likeReturn a container of uninitialized values with the same shape and type as a given container.
vectorConverts a list to a column-vector.
zerosCreates a container with the specified shape and type, filled with zeros.
zeros_likeReturn a container of zeros with the same shape and type as a given container.

Types

NameDescription
BoolArrayA BoolArray.
ComplexArrayA ComplexArray.
ComplexMatrixA ComplexMatrix.
ComplexSparseMatrixA ComplexSparseMatrix.
IntegerArrayA IntegerArray.
RealArrayA RealArray.
RealMatrixA RealMatrix.
RealSparseMatrixA RealSparseMatrix.

Module Functions

NameDescription
ComplexBDCSVDConstructs an SVD decomposition from a matrix.
ComplexColPivHouseholderQRConstructs a ComplexColPivHouseholderQR from a matrix.
ComplexEigenSolverConstructs a ComplexEigenSolver from a ComplexMatrix.
ComplexFullPivHouseholderQRConstructs a ComplexFullPivHouseholderQR from a matrix.
ComplexFullPivLUConstructs a LU decomposition from a matrix.
ComplexGeneralizedEigenSolverConstructs a ComplexGeneralizedEigenSolver from a ComplexMatrix.
ComplexGeneralizedSelfAdjointEigenSolverConstructs a ComplexGeneralizedSelfAdjointEigenSolver from a pair of ComplexMatrix.
ComplexHouseholderQRConstructs a ComplexHouseholderQR from a matrix.
ComplexJacobiSVDConstructs an SVD decomposition from a matrix.
ComplexLDLTConstructs a ComplexLDLT from a matrix.
ComplexLLTConstructs a ComplexLLT from a matrix.
ComplexPartialPivLUConstructs a LU decomposition from a matrix.
ComplexSelfAdjointEigenSolverConstructs a ComplexSelfAdjointEigenSolver from a self-adjoint ComplexMatrix.
RealBDCSVDConstructs an SVD decomposition from a matrix.
RealColPivHouseholderQRConstructs a RealColPivHouseholderQR from a matrix.
RealEigenSolverConstructs a RealEigenSolver from a RealMatrix.
RealFullPivHouseholderQRConstructs a RealFullPivHouseholderQR from a matrix.
RealFullPivLUConstructs a LU decomposition from a matrix.
RealGeneralizedEigenSolverConstructs a RealGeneralizedEigenSolver from a RealMatrix.
RealGeneralizedSelfAdjointEigenSolverConstructs a RealGeneralizedSelfAdjointEigenSolver from a pair of RealMatrix.
RealHouseholderQRConstructs a RealHouseholderQR from a matrix.
RealJacobiSVDConstructs an SVD decomposition from a matrix.
RealLDLTConstructs a RealLDLT from a matrix.
RealLLTConstructs a RealLLT from a matrix.
RealPartialPivLUConstructs a LU decomposition from a matrix.
RealSelfAdjointEigenSolverConstructs a RealSelfAdjointEigenSolver from a self-adjoint RealMatrix.
absCalculates the absolute values of the ComplexArray arr element-wise.
abs2Calculates the absolute values squared of the IntegerArray arr element-wise.
acosComputes the inverse cosine (arccosine) of the ComplexArray arr element-wise.
acoshComputes the inverse hyperbolic cosine of the RealArray arr element-wise.
asinComputes the inverse sine (arcsine) of the ComplexArray arr element-wise.
asinhComputes the inverse hyperbolic sine of the ComplexArray arr element-wise.
atanComputes the inverse tangent (arctangent) of the RealArray arr element-wise.
atanhComputes the inverse hyperbolic tangent of the ComplexArray arr element-wise.
betaincComputes the regularized incomplete beta function of the RealArray arr element-wise.
ceilComputes the smallest integer greater than or equal to each element of the RealArray arr element-wise.
concatenateCreates a IntegerArray by concatenating several IntegerArray. The number of rows and columns must be consistent across all inputs IntegerArray.
concatenate_columnsCreates a ComplexArray by concatenating several ComplexArray along the column dimension (i.e. horizontally). The number of rows must be the same for all inputs ComplexArray.
concatenate_rowsCreates a BoolArray by concatenating several BoolArray along the row dimension (i.e. vertically). The number of columns must be the same for all inputs BoolArray.
conjugateConjugates the input RealMatrix in-place.
conjugatedReturns the complex conjugate of the ComplexArray.
cosComputes the cosine of the ComplexArray arr element-wise.
coshComputes the hyperbolic cosine of the RealArray arr element-wise.
cubeComputes the cube (third power) of the RealArray arr element-wise.
cumprodReturns the cumulative product of the elements in the RealMatrix.
cumsumReturns the cumulative sum of the elements in the RealArray.
digammaComputes the digamma function (derivative of the logarithm of the gamma function) of the RealArray arr element-wise.
eigenvaluesReturns the eigenvalues of the matrix.
eigenvectorsReturns the eigenvectors of the matrix.
erfComputes the Gauss error function of the RealArray arr element-wise.
erfcComputes the complementary error function of the RealArray arr element-wise.
expComputes the exponential function of the RealArray arr element-wise.
expm1Computes exp(x) - 1 of the RealArray arr element-wise.
fixRounds the RealArray arr towards zero element-wise.
floorComputes the largest integer less than or equal to each element of the RealArray arr element-wise.
igammaCalculates the igamma of the RealArray arr0 and arr1 element-wise.
igammacCalculates the igammac of the RealArray arr0 and arr1 element-wise.
imagReturns the imaginary component of a RealMatrix.
index_maxReturns the maximum value of the elements in the RealArray.
index_minReturns the minimum value of the elements in the RealArray.
inverseComputes the multiplicative inverse (reciprocal) of the ComplexArray arr element-wise.
inverse_normal_cdfComputes the inverse of the cumulative distribution function of the standard normal distribution (probit function) of the RealArray arr element-wise.
inverse_sqrtComputes the reciprocal square root of the ComplexArray arr element-wise.
isfiniteChecks if each element of the RealArray arr is a finite number.
isinfChecks if each element of the RealArray arr is infinite.
isnanChecks if each element of the RealArray arr is NaN (not a number).
kronComputes the Kronecker product between two arrays or matrices. It is defined as...
lgammaComputes the natural logarithm of the absolute value of the gamma function of the RealArray arr element-wise.
linspacedSets all elements of the RealMatrix lhs to linearly spaced values.
logComputes the natural logarithm (base e) of the RealArray arr element-wise.
log10Computes the base-10 logarithm of the RealArray arr element-wise.
log1pComputes the natural logarithm of (1 + x) of the ComplexArray arr element-wise.
log2Computes the base-2 logarithm of the RealArray arr element-wise.
logical_andReturns the logical AND of the BoolArray lhs and rhs.
logical_notReturns the logical NOT of the BoolArray lhs.
logical_orReturns the logical OR of the BoolArray lhs and rhs.
logical_xorReturns the logical XOR of the BoolArray lhs and rhs.
logisticComputes the logistic sigmoid function of the ComplexArray arr element-wise.
mapApplies a function to each element of the array.
matrix_dReturns the factor D of the LDL^T decomposition.
matrix_lReturns the factor L of the Cholesky decomposition of the matrix.
matrix_pReturns the factor P of the LDL^T decomposition.
matrix_qReturns the permutation matrix corresponding to the column interchanges in the LU factorization of the matrix.
matrix_rReturns the upper triangular matrix R in the QR decomposition.
matrix_uReturns the upper triangular matrix U in the LU decomposition.
matrix_vReturns the unitary matrix V (right singular vectors) in the SVD decomposition.
maxReturns the maximum value of the elements in the RealMatrix along the given dimensions.
meanReturns the mean value of the elements in the ComplexArray.
minReturns the minimum value of the elements in the RealArray along the given dimensions.
modulusComputes the remainder after division of a by m, where a is the dividend and m is the divisor. Note that nonzero results have the same sign as the divisor. This function is equivalent to a - m * floor(a / m).
nearest_integerComputes the nearest integer to each element of the RealArray arr element-wise, rounding halfway cases to even.
phaseComputes the phase angle (argument) of the ComplexArray arr element-wise.
polygammaComputes the polygamma function (the n-th derivative of the digamma function) of the RealArray arr element-wise.
powThe **= operator exponentiates a ComplexArray by another one element-wise.
productReturns the product of the elements in the ComplexMatrix.
rankReturns the rank of the matrix leveraging the SVD decomposition.
reduceReduces the elements of the ComplexMatrix to a single value using a custom function fun along the given dimensions.
remainderComputes the remainder after division of a by m, where a is the dividend and m is the divisor. Note that nonzero results have the same sign as the dividend. This function is equivalent to a - m * fix(a / m).
roundComputes the nearest integer to each element of the RealArray arr element-wise, rounding away from zero in halfway cases.
signComputes the sign (-1, 0, or 1) of the ComplexArray arr element-wise.
sinComputes the sine of the RealArray arr element-wise.
singular_valuesReturns the singular values of the matrix.
sinhComputes the hyperbolic sine of the RealArray arr element-wise.
sqrtComputes the square root of the RealArray arr element-wise.
squareComputes the square of the ComplexArray arr element-wise.
stringConverts a ComplexMatrix to its string representation.
sumReturns the sum value of the elements in the IntegerArray along the given dimensions.
tanComputes the tangent of the RealArray arr element-wise.
tanhComputes the hyperbolic tangent of the RealArray arr element-wise.
zetaComputes the Hurwitz zeta function of the RealArray arr0 and arr1 element-wise.

Module Symbols

NameDescription
!Returns the logical NOT of the BoolArray lhs.
!=Checks if two BoolArray lhs and rhs are element-wise not-equal.
%Computes the remainder after division of a by m, where a is the dividend and m is the divisor. Note that nonzero results have the same sign as the divisor. This function is equivalent to a - m * floor(a / m).
*Scalar-matrix multiplication operator.
**The **= operator exponentiates a IntegerArray by another one element-wise.
*=The * operator multiplies in-place two IntegerArray element-wise.
+The + operator adds two IntegerArray element-wise.
++Increments each element of the IntegerArray lhs.
+=The += operator adds in-place two IntegerArray element-wise.
-Negates each element of the RealMatrix lhs.
--Decrements each element of the IntegerArray lhs.
-=The -= operator subtracts in-place two RealArray element-wise.
/The / operator divides two IntegerArray element-wise.
/=The / operator divides in-place two ComplexArray element-wise.
<Less than operator comparing two RealArray.
<=Less or equal operator comparing two RealArray.
=Sets the BoolArray lhs to the values in the BoolArray rhs.
==Checks if two BoolArray lhs and rhs are element-wise equal.
>Greater than operator comparing two RealArray.
>=Greater or equal operator comparing two RealArray.
^Returns the logical XOR of the BoolArray lhs and rhs.