brainunit.linalg module#

Functions that Changing Unit#

dot

Compute the dot product of two arrays or quantities.

multi_dot

Efficiently compute matrix products between a sequence of arrays.

vdot

Perform a conjugate multiplication of two 1D vectors.

vecdot

Perform a conjugate multiplication of two batched vectors.

inner

Compute the inner product of two arrays or quantities.

kron

Compute the Kronecker product of two arrays or quantities.

matmul

Compute the matrix product of two arrays or quantities.

tensordot

Compute tensor dot product along specified axes.

matrix_power

Raise a square matrix to the (integer) power n.

cross

Return the cross product of two (arrays of) vectors.

cholesky

Compute the Cholesky decomposition of a matrix.

outer

Compute the outer product of two vectors or quantities.

det

Compute the determinant of a matrix.

solve

Solve a linear system of equations.

tensorsolve

Solve the tensor equation a x = b for x.

lstsq

Return the least-squares solution to a linear equation.

inv

Return the inverse of a square matrix.

pinv

Compute the Moore-Penrose pseudo-inverse of a matrix.

tensorinv

Compute the tensor inverse of an array.

Functions that Keeping Unit#

qr

Compute the QR decomposition of a matrix.

svd

Singular value decomposition.

svdvals

Compute the singular values of a matrix.

eig

Compute the eigenvalues and eigenvectors of a square matrix.

eigh

Compute eigenvalues and eigenvectors of a Hermitian matrix.

eigvals

Compute the eigenvalues of a general matrix.

eigvalsh

Compute the eigenvalues of a Hermitian matrix.

norm

Compute the norm of a matrix or vector.

matrix_norm

Compute the norm of a matrix or stack of matrices.

vector_norm

Compute the vector norm of a vector or batch of vectors.

trace

Return the sum along diagonals of the array.

diagonal

Return specified diagonals.

matrix_transpose

Transpose a matrix or stack of matrices.

Functions that Removing Unit#