Utils
Utility functions for the linear algebra module.
PSDAnnotation
psd
Mark a linear operator as positive semi-definite.
This function acts as a marker/wrapper for positive semi-definite matrices.
Parameters:
-
A(LinearOperator) βA LinearOperator that is assumed to be positive semi-definite.
Returns:
-
LinearOperatorβThe same LinearOperator, marked as PSD.
add_jitter
Add jitter to the diagonal of a matrix for numerical stability.
This function adds a small positive value (jitter) to the diagonal elements of a square matrix to improve numerical stability, particularly for Cholesky decompositions and matrix inversions.
Parameters:
-
matrix(Array) βA square matrix to which jitter will be added.
-
jitter(float | Array, default:1e-06) βThe jitter value to add to the diagonal. Defaults to 1e-6.
Returns:
-
ArrayβThe matrix with jitter added to its diagonal.
Examples: