Module compute::linalg[][src]

Expand description

Provides general linear algebra methods and matrix decompositions with a focus on low-dimensional data.

Modules

Implements LU decomposition and system solving with the decomposition.

Forward and backward substitution.

Structs

Matrix struct.

A row-major ordering vector struct with various useful methods.

Enums

Traits

A trait for performing matrix products. Follows the behaviour of numpy’s matmul.

Functions

Generates evenly spaced values within a given interval. Values generated in the half-open interval [start, stop). That is, the stop point is not included.

Solve a matrix equation of the form Ux=b, where U is an upper triangular matrix. See the Wikipedia page.

Computes the Cholesky decomposition of the matrix a using the Cholesky-Banachiewicz algorithm.

Solves the system Lx=b, where L is a lower triangular matrix (e.g., a Cholesky decomposed matrix), and b is a one dimensional vector.

Convert a 1D matrix from column-major ordering into row-major ordering.

Create a design matrix from a given matrix.

Create a diagonal matrix with the given elements along the elements.

Calculates the dot product of two equal-length vectors. When the feature “blas” is enabled, uses ddot from BLAS. Otherwise, uses a length-8 unrolled loop.

Solve a matrix equation of the form Lx=b, where L is a lower triangular matrix. See the Wikipedia page.

Calculates the infinity norm of a matrix. That is, it sums the absolute values along each row, and then returns the largest of these values.

Given an n by n matrix, invert it. The resulting matrix is returned as a flattened array.

Calculates the parity of a swap permutation array ipiv (e.g. that you get as an output from Lapack).

Checks whether a 1D array is a valid design matrix, given its number of rows.

Checks whether a 1D array is a valid matrix representation given the number of rows.

Checks whether a 1d array is a valid positive definite matrix.

Checks whether a 1D array is a valid square matrix.

Checks whether a 1D array is a valid symmetric matrix.

Generates evenly spaced values within a given interval, with a set number of points. Both the start and stop points are included.

Calculates the logarithm of the mean of the exponentials in a stable manner. Applies the LogMeanExp operator (like the LogSumExp, but mean instead of sum) to the array.

Calculates the logarithm of the sum of the exponentials in a stable manner. Applies the LogSumExp operator to the array.

Computes the pivoted LU decomposition of a square matrix. For some matrix A, this decomposition is A = PLU. The resulting matrix has U in its upper triangle and L in its lower triangle. The unit diagonal elements of L are not stored. The pivot indices representing the permutation matrix P is also returned.

Solve the linear system Ax = b given a LU decomposed matrix A. The first argument should be a tuple, where the first element is the LU decomposed matrix and the second element is the pivots P.

Multiply two matrices together, optionally transposing one or both of them.

Performs blocked matrix multiplication with block size bsize. See the API for the matmul.

Calculates the norm of a vector.

Calculates the product of a vector.

Returns a 3D counter-clockwise rotation matrix along the axis axis (either X, Y, or Z) with a given angle in radians.

Returns a 3D clockwise rotation matrix along the axis axis (either X, Y, or Z) with a given angle in radians.

Convert a 1D matrix from row-major ordering into column-major ordering.

Solve the linear system Ax = b.

Solves a system of linear scalar equations. a must represent a square matrix.

Calculates the sum of a vector.

Given a vector of length n, creates n stacked duplicates, resulting in a square Toeplitz matrix. This function also assumes evenness. That is, x_i = x_{-i}.

Transpose a matrix.

Given some length m data x, create an nth order Vandermonde matrix.

Given a matrix X with k rows, return X transpose times X, which is a symmetric matrix.