Class ComplexSparseCholesky
- All Implemented Interfaces:
Serializable
ComplexSparseMatrix.
Class ComplexSparseCholesky computes the Cholesky factorization
of a sparse Hermitian positive definite matrix A. This factorization can
then be used to compute the solution of the linear system
\(Ax = b\).
Typically, the solution of a large sparse positive definite system \(Ax = b\) is done in four steps.
- In the first step, an ordering algorithm is used to preserve sparsity in the Cholesky factor L of matrix A during the numerical factorization process. The new order can be described by a permutation matrix P.
- Step two consists of setting up the data structure for the Cholesky factor L, where \(PAP^T=LL^T\). This step is called the symbolic factorization phase of the computation. During symbolic factorization, only the sparsity pattern of sparse matrix A, i.e., the locations of the nonzero entries of matrix A are needed but not any of the elements themselves.
- In step 3, the numerical factorization phase, the Cholesky factorization is done numerically.
- Step 4 is the solution phase. Here, the numerical solution, x, to the original system is obtained by solving the two triangular systems \(Ly_1=Pb\), \(L^Ty_2=y_1\) and the permutation \(x=P^Ty_2\).
Class ComplexSparseCholesky realizes all four steps by algorithms
described in George and Liu (1981). Especially, step one, is a realization of a minimum
degree ordering algorithm. The numerical factorization in its standard form is based on
a sparse compressed storage scheme. Alternatively, a multifrontal method can be used.
The multifrontal method requires more storage but will be faster than the standard
method in certain cases. The multifrontal method is based on the routines in Liu
(1987). For a detailed description of this method, see Liu (1990), also Duff and
Reid(1983, 1984), Ashcraft (1987) et al. (1987), and Liu (1986, 1989, 1992). The
numerical factorization method can be specified by using the
setNumericFactorizationMethod
The solvefactorSymbolically
factorNumericallysetNumericFactorsetSymbolicFactorsolve method when different right-hand sides are to be solved.
There is a special situation where computations can be simplified.
If an application generates different sparse Hermitian positive definite
coefficient matrices that all have the same sparsity pattern, then by using
methods
getSymbolicFactorsetSymbolicFactor
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe matrix is not Hermitian, positive definite.static classData structures and functions for the numeric Cholesky factor.static classData structures and functions for the symbolic Cholesky factor. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intIndicates the multifrontal method will be used for numeric factorization.static final intIndicates that the method of George/Liu (1981) is used for numeric factorization. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs the matrix structure for the Cholesky factorization of a sparse Hermitian positive definite matrix of typeComplexSparseMatrix. -
Method Summary
Modifier and TypeMethodDescriptionvoidComputes the numeric factorization of a sparse Hermitian positive definite matrix.voidComputes the symbolic factorization of a sparse Hermitian positive definite matrix.doubleReturns the largest diagonal element of the Cholesky factor.longReturns the number of nonzeros in the Cholesky factor.Returns the numeric Cholesky factor.intReturns the method used in the numerical factorization of the permuted input matrix.doubleReturns the smallest diagonal element of the Cholesky factor.Returns the symbolic Cholesky factor.voidsetNumericFactor(ComplexSparseCholesky.NumericFactor numericFactor) Sets the numeric Cholesky factor to use in solving a sparse complex Hermitian positive definite system of linear equations \(Ax=b\).voidsetNumericFactorizationMethod(int method) Defines the method used in the numerical factorization of the permuted input matrix.voidsetSymbolicFactor(ComplexSparseCholesky.SymbolicFactor symbolicFactor) Sets the symbolic Cholesky factor to use in solving a sparse complex Hermitian positive definite system of linear equations \(Ax=b\).Complex[]Computes the solution of a sparse Hermitian positive definite system of linear equations \(Ax=b\).
-
Field Details
-
STANDARD_METHOD
public static final int STANDARD_METHODIndicates that the method of George/Liu (1981) is used for numeric factorization.- See Also:
-
MULTIFRONTAL_METHOD
public static final int MULTIFRONTAL_METHODIndicates the multifrontal method will be used for numeric factorization.- See Also:
-
-
Constructor Details
-
ComplexSparseCholesky
Constructs the matrix structure for the Cholesky factorization of a sparse Hermitian positive definite matrix of typeComplexSparseMatrix.- Parameters:
A- TheComplexSparseMatrixHermitian positive definite matrix to be factored. Only the lower triangular part of the input matrix is used.
-
-
Method Details
-
solve
Computes the solution of a sparse Hermitian positive definite system of linear equations \(Ax=b\).This method solves the linear system \(Ax=b\), where A is Hermitian positive definite. The solution is obtained in several steps:
- First, matrix A is permuted to reduce fill-in, leading to a sparse Hermitian positive definite system \(PAP^T=Pb\).
- Then, matrix \(PAP^T\) is symbolically and numerically factored.
- The final solution is obtained by solving the systems \(Ly_1=Pb, L^Ty_2=y_1\) and \(x=P^Ty_2\).
By default this method implements all of the above steps. The factorizations are retained for later use by subsequent solves. By choosing appropriate methods within this class, the computation can be reduced to the solution of the system \(Ax=b\) for a given or precomputed symbolic or numeric factor.
- Parameters:
b- AComplexvector of length equal to the order of A containing the right-hand side.- Returns:
- a
Complexvector of length equal to the order of matrix A containing the solution of the system \(Ax=b\). - Throws:
ComplexSparseCholesky.NotSPDException- is thrown if the input matrix is not Hermitian, positive definite.
-
factorSymbolically
Computes the symbolic factorization of a sparse Hermitian positive definite matrix.This method symbolically factors the instance of the constructed matrix A, where A is of type
ComplexSparseMatrixand is Hermitian positive definite. The factorization is obtained in several steps:- First, matrix A is permuted to reduce fill-in, leading to a sparse Hermitian positive definite matrix \(PAP^T\).
- Then, matrix \(PAP^T\) is symbolically factored.
- Throws:
ComplexSparseCholesky.NotSPDException- is thrown if the input matrix is not Hermitian, positive definite.
-
factorNumerically
Computes the numeric factorization of a sparse Hermitian positive definite matrix.This method numerically factors the instance of the constructed matrix A, where A is of type
ComplexSparseMatrixand is Hermitian positive definite. The factorization is obtained in several steps:- First, matrix A is permuted to reduce fill-in, leading to a sparse Hermitian positive definite matrix \(PAP^T\).
- Then, matrix \(PAP^T\) is symbolically and numerically factored.
Note that the symbolic factorization is not done if the symbolic factor has been supplied by the user through the
setSymbolicFactormethod.- Throws:
ComplexSparseCholesky.NotSPDException- is thrown if the input matrix is not Hermitian, positive definite.
-
setSymbolicFactor
Sets the symbolic Cholesky factor to use in solving a sparse complex Hermitian positive definite system of linear equations \(Ax=b\).- Parameters:
symbolicFactor- aSymbolicFactorcontaining the symbolic Cholesky factor. By default the symbolic factorization is computed.
-
getSymbolicFactor
Returns the symbolic Cholesky factor.- Returns:
- a
SymbolicFactorcontaining the symbolic Cholesky factor.
-
setNumericFactor
Sets the numeric Cholesky factor to use in solving a sparse complex Hermitian positive definite system of linear equations \(Ax=b\).- Parameters:
numericFactor- aNumericFactorobject containing the numeric Cholesky factor. By default the numeric factorization is computed.
-
getNumericFactor
Returns the numeric Cholesky factor.- Returns:
- a
NumericFactorcontaining the numeric Cholesky factor.
-
setNumericFactorizationMethod
public void setNumericFactorizationMethod(int method) Defines the method used in the numerical factorization of the permuted input matrix.- Parameters:
method- anintvalue specifying the method to choose:Method NameDescription STANDARD_METHODstandard method as described by George/Liu (1981). This is the default. MULTIFRONTAL_METHODmultifrontal method - Throws:
IllegalArgumentException- This exception is thrown when the value for method is notSTANDARD_METHODorMULTIFRONTAL_METHOD.
-
getNumericFactorizationMethod
public int getNumericFactorizationMethod()Returns the method used in the numerical factorization of the permuted input matrix.- Returns:
- an
intvalue equal toSTANDARD_METHOD= 0 orMULTIFRONTAL_METHOD= 1 representing the method used in the numeric factorization of the permuted input matrix. SeesetNumericFactorizationMethodfor more details.
-
getSmallestDiagonalElement
public double getSmallestDiagonalElement()Returns the smallest diagonal element of the Cholesky factor.- Returns:
- a
doublevalue specifying the smallest diagonal element of the Cholesky factor. Use of this method is only sensible if a numeric factorization of the input matrix was done beforehand.
-
getLargestDiagonalElement
public double getLargestDiagonalElement()Returns the largest diagonal element of the Cholesky factor.- Returns:
- a
doublevalue specifying the largest diagonal element of the Cholesky factor. Use of this method is only sensible if a numeric factorization of the input matrix was done beforehand.
-
getNumberOfNonzeros
public long getNumberOfNonzeros()Returns the number of nonzeros in the Cholesky factor.- Returns:
- a
longvalue specifying the number of nonzeros (including the diagonal) of the Cholesky factor.
-