Class ComplexSuperLU
- All Implemented Interfaces:
Serializable
ComplexSparseMatrix by a column method and solves a sparse
linear system of equations \(Ax=b\).
Consider the sparse linear system of equations
$$ Ax=b.$$
Here, A is a general square, nonsingular, n by n sparse
matrix, and x and b are vectors of length n. All
entries in A, x and b are of type Complex.
Gaussian elimination, applied to the system above, can be shortly described as follows:
- Compute a triangular factorization \(P_rD_rAD_cP_c=LU\). Here, \(D_r\) and \(D_c\) are positive definite diagonal matrices to equilibrate the system and \(P_r\) and \(P_c\) are permutation matrices to ensure numerical stability and preserve sparsity. L is a unit lower triangular matrix and U is an upper triangular matrix.
- Solve \(Ax=b\) by evaluating $$x=A^{-1}b=D_c(P_c(U^{-1}(L^{-1}(P_r(D_rb))))).$$ This is done efficiently by multiplying from right to left in the last expression: Scale the rows of b by \(D_r\). Multiplying \(P_r(D_rb)\) means permuting the rows of \(D_rb\). Multiplying \(L^{-1}(P_rD_rb)\) means solving the triangular system of equations with matrix L by substitution. Similarly, multiplying \(U^{-1}(L^{-1}(P_rD_rb))\) means solving the triangular system with U.
Class ComplexSuperLU handles step 1 above in the
solve method if it is has not been computed prior to step 2.
More precisely, before \(Ax=b\) is solved
the following steps are performed:
- Equilibrate matrix A, i.e. compute diagonal matrices \(D_r\) and \(D_c\) so that \(\hat{A}=D_rAD_c\) is "better conditioned" than A, i.e. \(\hat{A}^{-1}\) is less sensitive to perturbations in \(\hat{A}\) than \(A^{-1}\) is to perturbations in A.
- Order the columns of \(\hat{A}\) to increase the sparsity of the computed L and U factors, i.e. replace \(\hat{A}\) by \(\hat{A}P_c\) where \(P_c\) is a column permutation matrix.
- Compute the LU factorization of \(\hat{A}P_c\). For numerical stability, the rows of \(\hat{A}P_c\) are eventually permuted through the factorization process by scaled partial pivoting, leading to the decomposition \(\tilde{A}:=P_r\hat{A}P_c=LU\). The LU factorization is done by a left looking supernode-panel algorithm with 2-D blocking. See Demmel, Eisenstat, Gilbert et al. (1999) for further information on this technique.
- Compute the reciprocal pivot growth factor $$\max_{1 \le j \le n} \frac{\|\tilde{A}_j\|_\infty}{\|U_j\|_\infty},$$ where \(\tilde{A}_j\) and \(U_j\) denote the j-th column of matrices \(\tilde{A}\) and U, respectively.
- Estimate the reciprocal of the condition number of matrix \(\tilde{A}\).
Method solve uses this information to perform the following
steps:
- Solve the system \(Ax=b\) using the computed triangular factors.
- Iteratively refine the solution, again using the computed triangular factors. This is equivalent to Newton's method.
- Compute forward and backward error bounds for the solution vector x.
Some of the steps mentioned above are optional. Their settings can be
controlled by the set methods of class ComplexSuperLU.
Class ComplexSuperLU is based on the SuperLU code written
by Demmel, Gilbert, Li et al. For more detailed explanations of the
factorization and solve steps, see the SuperLU Users' Guide (1999).
Copyright (c) 2003, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from U.S. Dept. of Energy)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
(1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
(2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
(3) Neither the name of Lawrence Berkeley National Laboratory, U.S. Dept. of Energy nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intFor column ordering, use column approximate minimum degree ordering.static final intIndicates that input matrix A was column scaled before factorization.static final intA performance tuning parameter which can be adjusted via methodsetPerformanceTuningParameters.static final intA performance tuning parameter which can be adjusted via methodsetPerformanceTuningParameters.static final intA performance tuning parameter which can be adjusted via methodsetPerformanceTuningParameters.static final intFor column ordering, use minimum degree ordering on the structure of \(A^TA\).static final intFor column ordering, use minimum degree ordering on the structure of \(A^T+A\).static final intA performance tuning parameter which can be adjusted via methodsetPerformanceTuningParameters.static final intFor column ordering, use the natural ordering.static final intIndicates that input matrix A was not equilibrated before factorization.static final intA performance tuning parameter which can be adjusted via methodsetPerformanceTuningParameters.static final intA performance tuning parameter which can be adjusted via methodsetPerformanceTuningParameters.static final intIndicates that input matrix A was row and column scaled before factorization.static final intIndicates that input matrix A was row scaled before factorization. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the method that will be used to permute the columns of the input matrix.doubleReturns the estimate of the reciprocal condition number of the matrix A.doubleReturns the threshold used for a diagonal entry to be an acceptable pivot.booleanReturns the equilibration flag.intReturns information on the type of equilibration used before matrix factorization.doubleReturns the estimated forward error bound for each solution vector.booleanReturns a value specifying whether iterative refinement is to be performed or not.intgetPerformanceTuningParameters(int parameter) Returns a performance tuning parameter value.booleanReturns the reciprocal pivot growth factor flag.doubleReturns the reciprocal pivot growth factor.doubleReturns the componentwise relative backward error of the solution vector.booleanReturns the symmetric mode flag.voidsetColumnPermutationMethod(int colpermute) Specifies how to permute the columns of the input matrix.voidsetDiagonalPivotThreshold(double thresh) Specifies the threshold used for a diagonal entry to be an acceptable pivot.voidsetEquilibrate(boolean equilibrate) Specifies if input matrix A should be equilibrated before factorization.voidsetIterativeRefinement(boolean refine) Specifies whether to perform iterative refinement.voidsetPerformanceTuningParameters(int parameter, int tunedValue) Sets performance tuning parameters.voidsetPivotGrowth(boolean growth) Specifies whether to compute the reciprocal pivot growth factor.voidsetSymmetricMode(boolean symmetric) Specifies whether to use the symmetric mode.Complex[]Computation of the solution vector for the system \( Ax = b\).Complex[]Computation of the solution vector for the system \( A^Hx = b\).Complex[]solveTranspose(Complex[] b) Computation of the solution vector for the system \( A^Tx = b\).
-
Field Details
-
NATURAL_ORDERING
public static final int NATURAL_ORDERINGFor column ordering, use the natural ordering.- See Also:
-
MINIMUM_DEGREE_AT_A
public static final int MINIMUM_DEGREE_AT_AFor column ordering, use minimum degree ordering on the structure of \(A^TA\).- See Also:
-
MINIMUM_DEGREE_AT_PLUS_A
public static final int MINIMUM_DEGREE_AT_PLUS_AFor column ordering, use minimum degree ordering on the structure of \(A^T+A\).- See Also:
-
COLUMN_APPROXIMATE_MINIMUM_DEGREE
public static final int COLUMN_APPROXIMATE_MINIMUM_DEGREEFor column ordering, use column approximate minimum degree ordering.- See Also:
-
PANEL_SIZE
public static final int PANEL_SIZEA performance tuning parameter which can be adjusted via methodsetPerformanceTuningParameters.- See Also:
-
RELAXATION_PARAMETER
public static final int RELAXATION_PARAMETERA performance tuning parameter which can be adjusted via methodsetPerformanceTuningParameters.- See Also:
-
MAXIMUM_SUPERNODE_SIZE
public static final int MAXIMUM_SUPERNODE_SIZEA performance tuning parameter which can be adjusted via methodsetPerformanceTuningParameters.- See Also:
-
MINIMUM_ROW_DIMENSION
public static final int MINIMUM_ROW_DIMENSIONA performance tuning parameter which can be adjusted via methodsetPerformanceTuningParameters.- See Also:
-
MINIMUM_COLUMN_DIMENSION
public static final int MINIMUM_COLUMN_DIMENSIONA performance tuning parameter which can be adjusted via methodsetPerformanceTuningParameters.- See Also:
-
FILL_FACTOR
public static final int FILL_FACTORA performance tuning parameter which can be adjusted via methodsetPerformanceTuningParameters.- See Also:
-
NO_SCALING
public static final int NO_SCALINGIndicates that input matrix A was not equilibrated before factorization. This is a return value forgetEquilibrationMethod.- See Also:
-
ROW_SCALING
public static final int ROW_SCALINGIndicates that input matrix A was row scaled before factorization. This is a return value forgetEquilibrationMethod.- See Also:
-
COLUMN_SCALING
public static final int COLUMN_SCALINGIndicates that input matrix A was column scaled before factorization. This is a return value forgetEquilibrationMethod.- See Also:
-
ROW_AND_COLUMN_SCALING
public static final int ROW_AND_COLUMN_SCALINGIndicates that input matrix A was row and column scaled before factorization. This is a return value forgetEquilibrationMethod.- See Also:
-
-
Constructor Details
-
ComplexSuperLU
Constructor forComplexSuperLU.- Parameters:
A- aComplexSparseMatrixcontaining the sparse quadratic input matrix.
-
-
Method Details
-
solve
Computation of the solution vector for the system \( Ax = b\).- Parameters:
b- aComplexvector of lengthn,nthe order of input matrixA, containing the right hand side.- Returns:
- a
Complexvector containing the solution to the system \( Ax = b\). Optionally, the solution is improved by iterative refinement, ifsetIterativeRefinementis set totrue. Methodsolveinternally first factorizes matrix A (step 1 of the introduction) if the factorization has not been done before. - Throws:
SingularMatrixException
-
solveTranspose
Computation of the solution vector for the system \( A^Tx = b\).- Parameters:
b- aComplexvector of lengthn,nthe order of input matrixA, containing the right hand side.- Returns:
- a
Complexvector containing the solution to the system \( A^Tx = b\). Optionally, the solution is improved by iterative refinement, ifsetIterativeRefinementis set totrue. MethodsolveTransposeinternally first factorizes matrix A (step 1 of the introduction) if the factorization has not been done before. - Throws:
SingularMatrixException
-
solveConjugateTranspose
Computation of the solution vector for the system \( A^Hx = b\).- Parameters:
b- aComplexvector of lengthn,nthe order of input matrixA, containing the right hand side.- Returns:
- a
Complexvector containing the solution to the system \( A^Hx = b\). Optionally, the solution is improved by iterative refinement, ifsetIterativeRefinementis set totrue. MethodsolveConjugateTransposeinternally first factorizes matrix A (step 1 of the introduction) if the factorization has not been done before. - Throws:
SingularMatrixException
-
getEquilibrationMethod
public int getEquilibrationMethod()Returns information on the type of equilibration used before matrix factorization.- Returns:
- an
intvalue specifying the equilibration option used.return value option description 1 = NO_SCALINGNo equilibration is performed. 2 = ROW_SCALINGEquilibration is performed with row scaling. 3 = COLUMN_SCALINGEquilibration is performed with column scaling. 4 = ROW_AND_COLUMN_SCALINGEquilibration is performed with row and column scaling.
-
setEquilibrate
public void setEquilibrate(boolean equilibrate) Specifies if input matrix A should be equilibrated before factorization.- Parameters:
equilibrate- abooleandetermining if matrix A should be equilibrated before the factorization.
Default:equilibrateaction falsedo not equilibrate trueequilibrate equilibrate=true.
-
setColumnPermutationMethod
public void setColumnPermutationMethod(int colpermute) Specifies how to permute the columns of the input matrix.- Parameters:
colpermute- anintscalar specifying how to permute the columns of the input matrix for sparsity preservation.
Default:colpermutemethod NATURAL_ORDERINGnatural ordering, that is \(P_c=I\), I the identity matrix MINIMUM_DEGREE_AT_PLUS_Aminimum degree ordering on the structure of \(A^T+A\) MINIMUM_DEGREE_AT_Aminimum degree ordering on the structure of \(A^TA\) COLUMN_APPROXIMATE_MINIMUM_DEGREEcolumn approximate minimum degree ordering colpermute=SuperLU.COLUMN_APPROXIMATE_MINIMUM_DEGREE.
-
getColumnPermutationMethod
public int getColumnPermutationMethod()Returns the method that will be used to permute the columns of the input matrix.- Returns:
- an
intscalar specifying how the columns of the input matrix are to be permuted for sparsity preservation.return value <th center" width="45%">method0 = NATURAL_ORDERINGnatural ordering, that is \(P_c=I\), I the identity matrix 1 = MINIMUM_DEGREE_AT_PLUS_Aminimum degree ordering on the structure of \(A^T+A\) 2 = MINIMUM_DEGREE_AT_Aminimum degree ordering on the structure of \(A^TA\) 3 = COLUMN_APPROXIMATE_MINIMUM_DEGREEcolumn approximate minimum degree ordering
-
setSymmetricMode
public void setSymmetricMode(boolean symmetric) Specifies whether to use the symmetric mode.- Parameters:
symmetric- abooleanindicating if symmetric mode is to be used. This mode should be applied if the input matrix A is diagonally dominant or nearly so. The user should then define a small diagonal pivot threshold (e.g. 0.0 or 0.01) by methodsetDiagonalPivotThresholdand choose an (\(A^T+A\))-based column permutation algorithm (e.g. column permutation methodComplexSuperLU.MINIMUM_DEGREE_AT_PLUS_A).
Default:symmetricaction falsesymmetric mode is not used truesymmetric mode is used symmetric=false.
-
getSymmetricMode
public boolean getSymmetricMode()Returns the symmetric mode flag.- Returns:
- a
booleanscalar indicating if symmetric mode is to be used. Returns true if symmetric mode is to be used.
-
setIterativeRefinement
public void setIterativeRefinement(boolean refine) Specifies whether to perform iterative refinement.- Parameters:
refine- abooleanscalar specifying whether to use iterative refinement,refine = trueor no iterative refinement,refine = false.
Default:refine = false.
-
getIterativeRefinement
public boolean getIterativeRefinement()Returns a value specifying whether iterative refinement is to be performed or not.- Returns:
- a
booleanscalar specifying whether iterative refinement is to be performed,true, or no iterative refinement is to be performed,false.
-
setDiagonalPivotThreshold
public void setDiagonalPivotThreshold(double thresh) Specifies the threshold used for a diagonal entry to be an acceptable pivot.- Parameters:
thresh- adoublescalar specifying the threshold used for a diagonal entry to be an acceptable pivot.
Default:thresh=1.0, i.e. classical partial pivoting.- Throws:
IllegalArgumentException- is thrown ifthreshis not in the interval \([0.0,1.0]\).
-
getDiagonalPivotThreshold
public double getDiagonalPivotThreshold()Returns the threshold used for a diagonal entry to be an acceptable pivot.- Returns:
- a
doublescalar specifying the threshold used for a diagonal entry to be an acceptable pivot.
-
setPivotGrowth
public void setPivotGrowth(boolean growth) Specifies whether to compute the reciprocal pivot growth factor.- Parameters:
growth- abooleanspecifying whether to compute the reciprocal pivot growth factor.
Default:growthaction falsedon't compute growth factor truecompute growth factor growth = false.
-
getPivotGrowth
public boolean getPivotGrowth()Returns the reciprocal pivot growth factor flag.- Returns:
- a
booleanspecifying whether to compute the reciprocal pivot growth factor. Returns true if the reciprocal pivot growth factor is to be computed.
-
getReciprocalPivotGrowthFactor
Returns the reciprocal pivot growth factor.- Returns:
- a
doublescalar representing the reciprocal growth factor $$\max_{1 \le j \le n} \frac{\|\tilde{A}_j\|_\infty}{\|U_j\|_\infty}.$$ If the returned value is much less than 1, the stability of the \(LU\) factorization could be poor. - Throws:
SingularMatrixException
-
getConditionNumber
Returns the estimate of the reciprocal condition number of the matrix A.- Returns:
- a
doublescalar containing the reciprocal condition number of the matrix A after equilibration and permutation of rows/columns (if done). If the reciprocal condition number is less than machine precision, in particular if it is equal to 0, the matrix is singular to working precision. - Throws:
SingularMatrixException
-
getForwardErrorBound
public double getForwardErrorBound()Returns the estimated forward error bound for each solution vector.- Returns:
- a
doublecontaining the estimated forward error bound for the solution vector. The estimate is as reliable as the estimate for the reciprocal condition number, and is almost always a slight overestimate of the true error. If iterative refinement is not used, the return value = 1.0.
-
getRelativeBackwardError
public double getRelativeBackwardError()Returns the componentwise relative backward error of the solution vector.- Returns:
- a
doublecontaining the componentwise relative backward error of the solution vectorx. IfsetIterativeRefinementis not set totrue, thengetRelativeBackwardErrorreturns 1.0.
-
getEquilibrate
public boolean getEquilibrate()Returns the equilibration flag.- Returns:
- a
booleanspecifying whether or not matrixAis equilibrated before factorization. IfgetEquilibratereturnstruethe system is equilibrated, ifgetEquilibratereturnsfalse, no equilibration is performed.
-
setPerformanceTuningParameters
public void setPerformanceTuningParameters(int parameter, int tunedValue) Sets performance tuning parameters.- Parameters:
parameter- anintscalar that specifies the parameter to be tuned.tunedValue- anintscalar that specifies the value to be used for the specified tuning parameter.parameterDescription Default PANEL_SIZEThe panel size. 10 RELAXATION_PARAMETERThe relaxation parameter to control supernode amalgamation. 5 MAXIMUM_SUPERNODE_SIZEThe maximum allowable size for a supernode. 100 MINIMUM_ROW_DIMENSIONThe minimum row dimension to be used for 2D blocking. 200 MINIMUM_COLUMN_DIMENSIONThe minimum column dimension to be used for 2D blocking. 40 FILL_FACTORThe estimated fill factor for L and U, compared with A. 20 - Throws:
IllegalArgumentException- is thrown when a)parameteris not in the interval \([1,\ldots,6]\) or b)tunedValueis not greater than zero.
-
getPerformanceTuningParameters
public int getPerformanceTuningParameters(int parameter) Returns a performance tuning parameter value.- Parameters:
parameter- anintscalar that specifies the parameter for which the value is to be returned.parameterreturn value description PANEL_SIZEThe panel size. RELAXATION_PARAMETERThe relaxation parameter to control supernode amalgamation. MAXIMUM_SUPERNODE_SIZEThe maximum allowable size for a supernode. MINIMUM_ROW_DIMENSIONThe minimum row dimension to be used for 2D blocking. MINIMUM_COLUMN_DIMENSIONThe minimum column dimension to be used for 2D blocking. FILL_FACTORThe estimated fill factor for L and U, compared with A. - Returns:
- an
intspecifying the current value used for the specified tuning parameter.
-