covmats.SparseCholeskyFactor#
- class covmats.SparseCholeskyFactor(*args, **kwargs)[source]#
Sparse Cholesky factor of a matrix \(\mathbf{A}\).
Factorization
It relies on the \(\mathbf{LDL}^{\mathrm{T}} =\) \(\mathbf{PAP}^{\mathrm{T}}\) factorization where
\(\mathbf{L}\) is the sparse lower triangle with unit diagonal.
\(\mathbf{D}\) is the sparse diagonal matrix with diagonal entries.
\(\mathbf{P}\) is the rows permutation vector.
Note
Since this code is released under BSD 3-Clause License, it is not possible to include sparse factors provided by scikit-sparse, as it depends on external libraries with GPL licenses, such as SuiteSparse. The main goal of this implementation is therefore to mimic useful features while preserving the BSD 3-Clause License compatibility.
Examples
>>> from your_module import SparseCholeskyFactor >>> L, D, P = ... # sparse matrices >>> factor = SparseCholeskyFactor(L, D, P) >>> factor.matvec(x) array([...])
- __init__(L: sparray, D: sparray, P: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]) None[source]#
Initialize the instance.
- Parameters:
L (sp.sparse.sparray) – Sparse lower triangle \(\mathbf{L}\) of the factorization.
D (sp.sparse.sparray) – Sparse diagonal matrix \(\mathbf{{D}}\) of the factorization.
P (ArrayLike) – 1D vector \(\mathbf{{P}}\) storing rows permutations of the factorization.
- Raises:
ValueError – If the dimensions of L, D and P do not match.
Properties
Sparse diagonal matrix \(\mathbf{D}\) of the factorization.
Hermitian adjoint.
Sparse lower triangle \(\mathbf{L}\) with unit diagonal of the factorization.
1D vector \(\mathbf{P}\) storing rows permutations of the factorization.
1D vector \(\mathbf{P}\) storing rows back-permutations of the factorization.
Transpose this linear operator.
Inverse of \(\mathbf{D}\) in the factorization.
Log of the pseudo-determinant of the covariance matrix.
Return \(\mathbf{A}\) as a dense array.
Number of points in the domain (n).
Shape of the square matrix (n, n).
Squared root of \(\mathbf{D}\) in the factorization.
Squared root inverse of \(\mathbf{D}\) in the factorization.
Methods
Hermitian adjoint.
Apply the permutation of rows.
Apply the reverse permutation of rows.
Perform a colorizing transformation on data.
Perform a colorizing transformation on data as in
SparseCholeskyFactor:colorize()but for the inverse \(\mathbf{A}^{-1}\).Matrix-matrix or matrix-vector multiplication.
Return the diagonal entries of the matrix \(\mathbf{A}\).
Return the diagonal entries of the inverse matrix \(\mathbf{A}^{-1}\).
Return the inverse \(\mathbf{A}^{-1}\) as a dense array.
Matrix-matrix multiplication.
Matrix-vector multiplication.
Adjoint matrix-matrix multiplication.
Adjoint matrix-vector multiplication.
Return \(\mathbf{x} = \mathbf{A}^{-1} \mathbf{b}.\)
Return \(\mathbf{A}\) as a dense array.
Transpose this linear operator.
Perform a whitening transformation on data.
Perform a whitening transformation on data as in
SparseCholeskyFactor:whiten()but for the inverse \(\mathbf{A}^{-1}\).