ulab.linalg – Linear algebra functions

ulab.linalg.cholesky(A: ulab.array) → ulab.array
Parameters:A (array) – a positive definite, symmetric square matrix
Return ~ulab.array L:
 a square root matrix in the lower triangular form
Raises:ValueError – If the input does not fulfill the necessary conditions

The returned matrix satisfies the equation m=LL*

ulab.linalg.det(m: ulab.array) → float
Param:m, a square matrix
Return float:The determinant of the matrix

Computes the eigenvalues and eigenvectors of a square matrix

ulab.linalg.dot(m1: ulab.array, m2: ulab.array) → Union[ulab.array, float]
  • m1 (array) – a matrix, or a vector
  • m2 (array) – a matrix, or a vector

Computes the product of two matrices, or two vectors. In the letter case, the inner product is returned.

ulab.linalg.eig(m: ulab.array) → Tuple[ulab.array, ulab.array]
Parameters:m – a square matrix
Return tuple (eigenvectors, eigenvalues):

Computes the eigenvalues and eigenvectors of a square matrix

ulab.linalg.inv(m: ulab.array) → ulab.array
Parameters:m (array) – a square matrix
Returns:The inverse of the matrix, if it exists
Raises:ValueError – if the matrix is not invertible

Computes the inverse of a square matrix

ulab.linalg.norm(x: ulab.array) → float
Parameters:x (array) – a vector or a matrix

Computes the 2-norm of a vector or a matrix, i.e., sqrt(sum(x*x)), however, without the RAM overhead.

ulab.linalg.size(array: ulab.array) → int

Return the total number of elements in the array, as an integer.

ulab.linalg.trace(m: ulab.array) → float
Parameters:m – a square matrix

Compute the trace of the matrix, the sum of its diagonal elements.