CholeskyFactor¶
- class sksparse.cholmod.CholeskyFactor[source]¶
The main object used for creating and manipulating a Cholesky factor.
The constructor computes the symbolic analysis of the matrix and determines a fill-reducing ordering (if
orderis notNoneor"natural") such that:\[L L^{\top} = P A P^{\top}.\]The numeric factorization is not computed until
factorize()is called.- Parameters:
A ((N, N) array_like or sparse array) – An array convertible to a sparse matrix in Compressed Sparse Column (CSC) format.
sym_kind (str in {“sym”, “row”, “col”}, optional) – The type of factorization for which to analyze the matrix:
sym: Symmetric factorization. Only the upper or lower triangular part of the matrix is used (depending onlower), and no check is made for symmetry.row: Unsymmetric factorization of \(A A^{\top}\).col: Unsymmetric factorization of \(A^{\top} A\).
The resulting matrix must be square and symmetric positive definite.
supernodal_mode (str in {“auto”, “simplicial”, “supernodal”}, optional) – The type of factorization to use:
auto: Automatically select the factorization type.simplicial: Use a simplicial factorization.supernodal: Use a supernodal factorization.
Default is
auto. This mode also applies to any subsequent calls tofactorize(). Note that thesimplicialmode may be slow for large matrices.lower (bool, optional) – If True, use the lower triangular part of
A.order (str in {“default”, “best”, “natural”, “metis”, “nesdis”, “amd”, “colamd”, “postordered”}, optional) – The permutation algorithm to use for the factorization. Options are:
default: Use the default method, which first tries AMD, then METIS.best: Automatically select the best ordering based on the input.metis: Use the METIS library for graph partitioning.nesdis: Use the NESDIS library for nested dissection.amd: Use the Approximate Minimum Degree (AMD) algorithm.colamd: Use the Approximate Minimum Degree (AMD) algorithm for the symmetric case, or the COLAMD algorithm for the unsymmetric case (\(A A^{{\top}}\) or \(A^{{\top}} A\)).postordered: Use natural ordering followed by postordering.naturalorNone: No permutation is applied (identity permutation).
By default, methods other than
naturalwill also be postordered.Warning
The ordering method
bestmay be quite slow for large matrices, but if the factorization is reused many times, it can be worth it.
- rcond[source]¶
A rough estimate of the reciprocal of the condition number of the matrix, defined as
(L.diagonal().min() / L.diagonal().max())**2for anLL.Tfactorization. Estimated during the numeric factorization. Iffactorize()has not yet been called, this value is-1.0.- Type:
- colcount[source]¶
The number of nonzeros in each column of the factor.
- Type:
(N,)
numpy.ndarrayof int
- order[source]¶
The ordering method used for the factorization. If an unknown ordering was used, returns the integer value.
- perm[source]¶
A read-only view of the permutation vector used for the factorization.
- Type:
(N,)
numpy.ndarrayof int
- factor[source]¶
A view of the the Cholesky factor in Compressed Sparse Column (CSC) format. If
self.is_ll, the returned matrix is lower triangular. Otherwise, the matrix view contains the lower triangular and the diagonal factors combined.Note
The view is always in lower triangular form, even if the factor was created using
lower=False. To get the upper triangular factor, useget_factorwithlower=False. To get the split L and D factors, useget_factorwithkind="LDL".Warning
The returned matrix is a view on the internal data of the CHOLMOD factor. It will be modified if the factor is modified (e.g., by calling
factorize()). To get a copy, useget_factor().- Type:
- D[source]¶
A view of the diagonal factor in DIAgonal format. If
self.is_ll, this is the identity matrix.- Type:
- Raises:
CholmodNotPositiveDefiniteError – If the input matrix is structurally singular (e.g., if it is the zero matrix). The input may be numerically indefinite, but this property is not checked until
factorize()is called.
See also
Notes
The symbolic analysis follows that of the SuiteSparse CHOLMOD
analyzeMATLAB function [1].Warning
Calling
CholeskyFactor.__new__(CholeskyFactor)will leave the object in an “unsafe” state, since the internal CHOLMOD structures will not be initialized. Always use the constructorCholeskyFactor(...)to create a new object.Added in version 0.1.0.
Changed in version 0.5.0: Refactored to
CholeskyFactorfrom justFactor. Now incorporatesCommonfactor into the object. Major API changes.References
Methods
Change the type of factorization used by the object. |
|
Return a copy of the CholeskyFactor object. |
|
Compute the determinant of the matrix from its Cholesky factorization. |
|
Multiple-rank downdate of a sparse LDL factorization. |
|
Compute the numerical Cholesky factorization of a sparse matrix. |
|
Return a copy of the Cholesky factor in the specified format. |
|
Return a copy of the permutation vector used in the factorization. |
|
Compute the inverse of the matrix from its Cholesky factorization. |
|
Compute the (natural) log-determinant of the matrix from its Cholesky factorization. |
|
Recompute the symbolic Cholesky factorization of a sparse matrix. |
|
Add a row to a sparse LDL factorization. |
|
Delete a row from a sparse LDL factorization. |
|
Compute the sign and (natural) log-determinant of the matrix from its Cholesky factorization. |
|
Solve the linear system \(A x = b\) for x, using the factorization. |
|
Multiple-rank update of a sparse LDL factorization. |