ParGeMSLR
|
The local ilu preconditioner, only work for sequential CSR matrix. More...
#include <ilu.hpp>
Public Member Functions | |
IluClass () | |
The constructor of precondioner class. More... | |
IluClass (const IluClass< MatrixType, VectorType, DataType > &precond) | |
The copy constructor of precondioner class. More... | |
IluClass (IluClass< MatrixType, VectorType, DataType > &&precond) | |
The move constructor of precondioner class. More... | |
IluClass< MatrixType, VectorType, DataType > & | operator= (const IluClass< MatrixType, VectorType, DataType > &precond) |
The operator = of precondioner class. More... | |
IluClass< MatrixType, VectorType, DataType > & | operator= (IluClass< MatrixType, VectorType, DataType > &&precond) |
The operator = of precondioner class. More... | |
virtual int | Clear () |
Free the current precondioner. More... | |
virtual | ~IluClass () |
The destructor of precondioner class. More... | |
virtual int | Setup (VectorType &x, VectorType &rhs) |
Setup the precondioner phase. Will be called by the solver if not called directly. More... | |
int | Setup (MatrixType &L_mat, VectorType &D_vec, MatrixType &U_mat, int *pperm, int *qperm) |
Setup ILU with exist factorization L, D, and U. The lower triangular part of L, inverse of diagonal of U, and the upper triangular part of U. More... | |
int | SetupPermutation (VectorType &x, VectorType &rhs) |
Build the permutation vector. More... | |
int | SetupILUT (VectorType &x, VectorType &rhs) |
Setup ILUT, ingore the ilu option. More... | |
int | SetupILUK (VectorType &x, VectorType &rhs) |
Setup ILU(K). More... | |
int | SetupPartialILUT (VectorType &x, VectorType &rhs) |
Setup Partial ILUT, form approximate Schur Complement. More... | |
virtual int | Solve (VectorType &x, VectorType &rhs) |
Solve phase. Call this function after Setup. Solve with cusparse if unified memory/device memory is used. More... | |
int | SolveL (VectorType &x, VectorType &rhs) |
Solve with L only. Call this function after Setup. Solve with cusparse if unified memory/device memory is used. More... | |
int | SolveU (VectorType &x, VectorType &rhs) |
Solve with U only. Call this function after Setup. Solve with cusparse if unified memory/device memory is used. More... | |
virtual int | SetSolveLocation (const int &location) |
Set the data location that the preconditioner apply to. More... | |
virtual int | MoveData (const int &location) |
Move the preconditioner to another location. Only can be called after Setup. More... | |
virtual int | SetWithParameterArray (double *params) |
Setup with parameter array. More... | |
int | SetLevelOfFill (int lfil) |
Set the level of fill for ILU(K). More... | |
int | SetIluComplexShift (bool complex_shift) |
Set if we turn on the complex shift or not (complex version only). More... | |
template<typename T > | |
int | SetDropTolerance (T droptol) |
Set the drop tols for ILUT. More... | |
template<typename T > | |
int | SetDropToleranceEF (T droptol_ef) |
Set the drop tols in E, F part for Partial ILUT. More... | |
template<typename T > | |
int | SetDropToleranceS (T droptol_s) |
Set the drop tols in S part for Partial ILUT. More... | |
int | SetMaxNnzPerRow (int max_row_nnz) |
Set the max fill allowed for each row/col of L and U. More... | |
int | SetMaxNnzPerRowSPart (int max_row_nnz_s) |
Set the max fill allowed for each row/col of S in partial ILU. More... | |
int | SetNB (int nB) |
Set the size of the B block. More... | |
int | SetOption (int option) |
Set the ILU option. See IluOptionEnum. More... | |
int | SetOpenMPOption (int omp_option) |
Set the OpenMP option. See IluOpenMPOptionEnum. More... | |
int | SetPolyOrder (int order) |
Set the polynomia order in some OpenMP option. See IluOpenMPOptionEnum. More... | |
int | SetPermutationOption (int perm_option) |
Set the ILU permutation option. See IluReorderingOptionEnum. More... | |
int | SetModified (bool modified) |
Enable/Disable modified ILU. More... | |
template<typename T > | |
int | SetModifiedShift (T milu_shift) |
Set the shift for the modified ILU. More... | |
int | GetSize () |
Get the size of the problem. More... | |
virtual long int | GetNumNonzeros () |
Get the total number of nonzeros the ILU. More... | |
CsrMatrixClass< DataType > & | GetL () |
Get the L matrix of the ILU factorizaiton without diagonal. More... | |
SequentialVectorClass< DataType > & | GetD () |
Get the inverse of diagonal of the U matrix. More... | |
CsrMatrixClass< DataType > & | GetU () |
Get the U matrix of the ILU factorizaiton without diagonal. More... | |
CsrMatrixClass< DataType > & | GetE () |
Get the U matrix of the ILU factorizaiton without diagonal. More... | |
CsrMatrixClass< DataType > & | GetF () |
Get the U matrix of the ILU factorizaiton without diagonal. More... | |
CsrMatrixClass< DataType > & | GetS () |
Get the U matrix of the ILU factorizaiton without diagonal. More... | |
int | GetNB () |
Get the U matrix of the ILU factorizaiton without diagonal. More... | |
IntVectorClass< int > & | GetRowPermutationVector () |
Get the row permutation vector. More... | |
IntVectorClass< int > & | GetColPermutationVector () |
Get the column permutation vector. More... | |
![]() | |
SolverClass () | |
The constructor of solver class. More... | |
SolverClass (const SolverClass< MatrixType, VectorType, DataType > &solver) | |
The copy constructor of solver class. More... | |
SolverClass (SolverClass< MatrixType, VectorType, DataType > &&solver) | |
The move constructor of solver class. More... | |
SolverClass< MatrixType, VectorType, DataType > & | operator= (const SolverClass< MatrixType, VectorType, DataType > &solver) |
The = operator of solver class. More... | |
SolverClass< MatrixType, VectorType, DataType > & | operator= (SolverClass< MatrixType, VectorType, DataType > &&solver) |
The = operator of solver class. More... | |
virtual | ~SolverClass () |
The destructor of solver class. More... | |
virtual int | Solve (DenseMatrixClass< DataType > &x, DenseMatrixClass< DataType > &rhs) |
Solve phase with multiple right-hand-sides. Call this function after Setup. More... | |
MatrixType * | GetMatrix () |
Get pointer to the matrix. More... | |
SolverClass< MatrixType, VectorType, DataType > * | GetPreconditioner () |
Get pointer to the preconditioner. More... | |
int | SetMatrix (MatrixType &matrix) |
Set the target matrix for the current solver. More... | |
int | SetMatrixP (MatrixType *matrix) |
Set the target matrix for the current solver. More... | |
int | SetPreconditioner (SolverClass< MatrixType, VectorType, DataType > &precond) |
Set the preconditioner for the current solver. More... | |
int | SetPreconditionerP (SolverClass< MatrixType, VectorType, DataType > *precond) |
Set the preconditioner for the current solver. More... | |
bool | IsReady () const |
Check if the solver is ready to be used. More... | |
int | SetOwnMatrix (bool own_matrix) |
Set if the matrix is owned by this solver, if so, matrix is freed when free the solver. More... | |
int | SetOwnPreconditioner (bool own_preconditioner) |
Set if the preconditioner is owned by this solver, if so, preconditioner is freed when free the solver. More... | |
int | SetPrintOption (int print_option) |
Set the print option. More... | |
PrecisionEnum | GerPrecision () const |
Get the precision. More... | |
SolverTypeEnum | GetSolverType () const |
Get the solver type. More... | |
Static Public Member Functions | |
template<typename T > | |
static void | Swap (T *v, int i, int j) |
Swap v[i] and v[j]. More... | |
template<typename T1 , typename T2 > | |
static void | Swap (T1 *v, T2 *w, int i, int j) |
Swap v[i] and v[j], w[i] and w[j]. More... | |
template<typename T1 , typename T2 > | |
static void | AbsMinHeapAdd_RN (T1 *heap, T2 *v, int len) |
Add value to a min heap based on the absolute value. RN stands for reverse (heap from right to left), normal (v1 based on normal order). More... | |
template<typename T1 , typename T2 > | |
static void | AbsMinHeapRemove_RN (T1 *heap, T2 *v, int len) |
Remove value from a min heap based on the absolute value. RN stands for reverse (heap from right to left), normal (v1 based on normal order). More... | |
template<typename T1 , typename T2 > | |
static void | MinHeapAdd_NNR (int *heap, T1 *v1, T2 *v2, int len) |
Add value to a min heap. NNR stands for normal (heap from left to right), normal (v1 based on normal order), reverse (v2 based on index order). More... | |
template<typename T1 , typename T2 > | |
static void | MinHeapRemovd_NNR (int *heap, T1 *v1, T2 *v2, int len) |
Remove value from a min heap. NNR stands for normal (heap from left to right), normal (v1 based on normal order), reverse (v2 based on index order). More... | |
template<typename T > | |
static void | Qsplit (T *a, int *ind, int left, int bound, int right) |
Does a quick-sort split of a real array. More... | |
Additional Inherited Members | |
![]() | |
int | CheckReadySetups (const char *str) const |
Return error is the preconditioner is ready. More... | |
![]() | |
PrecisionEnum | _solver_precision |
The precision of the solver. More... | |
SolverTypeEnum | _solver_type |
The type of the solver. More... | |
bool | _is_mixed |
Is the preconditioner a mixed precision preconditioner? More... | |
MatrixType * | _matrix |
The matrix. More... | |
bool | _own_matrix |
If the matrix is owned by this solver, default is false. More... | |
SolverClass< MatrixType, VectorType, DataType > * | _preconditioner |
The preconditioner. More... | |
bool | _own_preconditioner |
If the preconditioner is owned by this solver, default is false. More... | |
VectorType * | _solution |
Pointer to the solution, note that this vector is not going to be freed. More... | |
VectorType * | _right_hand_side |
Pointer to the right-hand-size, note that this vector is not going to be freed. More... | |
bool | _ready |
If the solver is ready. More... | |
int | _print_option |
The print option. More... | |
The local ilu preconditioner, only work for sequential CSR matrix.
template pargemslr::precond_ilu_csr_seq_complexd::IluClass | ( | ) |
The constructor of precondioner class.
pargemslr::IluClass< MatrixType, VectorType, DataType >::IluClass | ( | const IluClass< MatrixType, VectorType, DataType > & | precond | ) |
The copy constructor of precondioner class.
pargemslr::IluClass< MatrixType, VectorType, DataType >::IluClass | ( | IluClass< MatrixType, VectorType, DataType > && | precond | ) |
The move constructor of precondioner class.
|
virtual |
The destructor of precondioner class.
|
inlinestatic |
Add value to a min heap based on the absolute value. RN stands for reverse (heap from right to left), normal (v1 based on normal order).
That is, the heap starts from heap[0], and goes to heap[-1], heap[-2] ...
When swaping elements in the heap, elements in v1 swap in the same way (swap heap[i]<->heap[j] and v1[i]<->v1[j]).
[in] | heap | The heap. |
[in] | v1 | The second array. |
[in] | v2 | The third array. |
[in] | len | The length. |
|
inlinestatic |
Remove value from a min heap based on the absolute value. RN stands for reverse (heap from right to left), normal (v1 based on normal order).
That is, the heap starts from heap[0], and goes to heap[-1], heap[-2] ...
When swaping elements in the heap, elements in v1 swap in the same way (swap heap[i]<->heap[j] and v1[i]<->v1[j]).
[in] | heap | The heap. |
[in] | v1 | The second array. |
[in] | v2 | The third array. |
[in] | len | The length. |
|
virtual |
Free the current precondioner.
Reimplemented from pargemslr::SolverClass< MatrixType, VectorType, DataType >.
template IntVectorClass< int > & pargemslr::precond_ilu_csr_seq_complexd::GetColPermutationVector | ( | ) |
Get the column permutation vector.
template SequentialVectorClass< complexd > & pargemslr::precond_ilu_csr_seq_complexd::GetD | ( | ) |
Get the inverse of diagonal of the U matrix.
template CsrMatrixClass< complexd > & pargemslr::precond_ilu_csr_seq_complexd::GetE | ( | ) |
Get the U matrix of the ILU factorizaiton without diagonal.
template CsrMatrixClass< complexd > & pargemslr::precond_ilu_csr_seq_complexd::GetF | ( | ) |
Get the U matrix of the ILU factorizaiton without diagonal.
template CsrMatrixClass< complexd > & pargemslr::precond_ilu_csr_seq_complexd::GetL | ( | ) |
Get the L matrix of the ILU factorizaiton without diagonal.
template int pargemslr::precond_ilu_csr_seq_complexd::GetNB | ( | ) |
Get the U matrix of the ILU factorizaiton without diagonal.
|
virtual |
Get the total number of nonzeros the ILU.
Reimplemented from pargemslr::SolverClass< MatrixType, VectorType, DataType >.
template IntVectorClass< int > & pargemslr::precond_ilu_csr_seq_complexd::GetRowPermutationVector | ( | ) |
Get the row permutation vector.
template CsrMatrixClass< complexd > & pargemslr::precond_ilu_csr_seq_complexd::GetS | ( | ) |
Get the U matrix of the ILU factorizaiton without diagonal.
template int pargemslr::precond_ilu_csr_seq_complexd::GetSize | ( | ) |
Get the size of the problem.
template CsrMatrixClass< complexd > & pargemslr::precond_ilu_csr_seq_complexd::GetU | ( | ) |
Get the U matrix of the ILU factorizaiton without diagonal.
|
inlinestatic |
Add value to a min heap. NNR stands for normal (heap from left to right), normal (v1 based on normal order), reverse (v2 based on index order).
That is, the heap starts from heap[0], and goes to heap[1] ...
When swaping elements in the heap, elements in v1 swap in the same way (swap heap[i]<->heap[j] and v1[i]<->v1[j]). When swaping elements in the heap, elements in v2 swap in based on the heap value (swap heap[i]<->heap[j] and v1[heal[i]]<->v1[heap[j]]).
[in] | heap | The heap. |
[in] | v1 | The second array. |
[in] | v2 | The third array. |
[in] | len | The length. |
|
inlinestatic |
Remove value from a min heap. NNR stands for normal (heap from left to right), normal (v1 based on normal order), reverse (v2 based on index order).
That is, the heap starts from heap[0], and goes to heap[1] ...
When swaping elements in the heap, elements in v1 swap in the same way (swap heap[i]<->heap[j] and v1[i]<->v1[j]). When swaping elements in the heap, elements in v2 swap in based on the heap value (swap heap[i]<->heap[j] and v1[heal[i]]<->v1[heap[j]]).
[in] | heap | The heap. |
[in] | v1 | The second array. |
[in] | v2 | The third array. |
[in] | len | The length. |
|
virtual |
Move the preconditioner to another location. Only can be called after Setup.
[in] | location | The target solver location. |
IluClass< MatrixType, VectorType, DataType > & pargemslr::IluClass< MatrixType, VectorType, DataType >::operator= | ( | const IluClass< MatrixType, VectorType, DataType > & | precond | ) |
The operator = of precondioner class.
IluClass< MatrixType, VectorType, DataType > & pargemslr::IluClass< MatrixType, VectorType, DataType >::operator= | ( | IluClass< MatrixType, VectorType, DataType > && | precond | ) |
The operator = of precondioner class.
|
inlinestatic |
Does a quick-sort split of a real array.
[in/out]a | the array to sort. | |
[in] | ind | permuted indices. |
[in] | n | length of the array. |
[in] | left | the start location. |
[in] | split | from here. |
[in] | right | the end location. |
|
inline |
Set the drop tols for ILUT.
[in] | droptol | The new drop tol for ILUT. |
|
inline |
Set the drop tols in E, F part for Partial ILUT.
[in] | droptol_ef | The new drop tol in E, F part for Partial ILUT. |
|
inline |
Set the drop tols in S part for Partial ILUT.
[in] | droptol_ef | The new drop tol in S part for Partial ILUT. |
|
inline |
Set if we turn on the complex shift or not (complex version only).
[in] | complex_shift | The new drop tol for ILUT. |
|
inline |
Set the level of fill for ILU(K).
[in] | lfil | The new level of fill for ILU(K). |
template int pargemslr::precond_ilu_csr_seq_complexd::SetMaxNnzPerRow | ( | int | max_row_nnz | ) |
Set the max fill allowed for each row/col of L and U.
[in] | max_row_nnz | The new max fill allowed for each row/col of L and U. |
template int pargemslr::precond_ilu_csr_seq_complexd::SetMaxNnzPerRowSPart | ( | int | max_row_nnz_s | ) |
Set the max fill allowed for each row/col of S in partial ILU.
[in] | max_row_nnz_s | The new max fill allowed for each row/col of S in partial ILU. |
template int pargemslr::precond_ilu_csr_seq_complexd::SetModified | ( | bool | modified | ) |
Enable/Disable modified ILU.
[in] | modified | The new ILUT option. |
|
inline |
Set the shift for the modified ILU.
[in] | milu_shift | The shift for the modified ILU. |
template int pargemslr::precond_ilu_csr_seq_complexd::SetNB | ( | int | nB | ) |
Set the size of the B block.
[in] | nB | The number of nodes in the B block. |
template int pargemslr::precond_ilu_csr_seq_complexd::SetOpenMPOption | ( | int | omp_option | ) |
Set the OpenMP option. See IluOpenMPOptionEnum.
[in] | omp_option | The new OpenMP option. |
template int pargemslr::precond_ilu_csr_seq_complexd::SetOption | ( | int | option | ) |
Set the ILU option. See IluOptionEnum.
[in] | option | The new ILUT option. |
template int pargemslr::precond_ilu_csr_seq_complexd::SetPermutationOption | ( | int | perm_option | ) |
Set the ILU permutation option. See IluReorderingOptionEnum.
[in] | perm_option | The new ILU permutation option. |
template int pargemslr::precond_ilu_csr_seq_complexd::SetPolyOrder | ( | int | order | ) |
Set the polynomia order in some OpenMP option. See IluOpenMPOptionEnum.
[in] | order | The new order. |
|
virtual |
Set the data location that the preconditioner apply to.
[in] | location | The target solver location. |
Implements pargemslr::SolverClass< MatrixType, VectorType, DataType >.
int pargemslr::IluClass< MatrixType, VectorType, DataType >::Setup | ( | MatrixType & | L_mat, |
VectorType & | D_vec, | ||
MatrixType & | U_mat, | ||
int * | pperm, | ||
int * | qperm | ||
) |
Setup ILU with exist factorization L, D, and U. The lower triangular part of L, inverse of diagonal of U, and the upper triangular part of U.
[in] | L_mat | the lower triangular part of L. |
[in] | D_vec | the inverse of diagonal of U. |
[in] | U_mat | the upper triangular part of U. |
[in] | pperm | the row permutation vector, set to NULL to use the nature ordering. |
[in] | qperm | the col permutation vector, set to NULL to use the nature ordering. |
|
virtual |
Setup the precondioner phase. Will be called by the solver if not called directly.
[in] | x | The initial guess. |
[in] | rhs | The right-hand-side. |
Implements pargemslr::SolverClass< MatrixType, VectorType, DataType >.
int pargemslr::IluClass< MatrixType, VectorType, DataType >::SetupILUK | ( | VectorType & | x, |
VectorType & | rhs | ||
) |
Setup ILU(K).
[in] | x | The initial guess. |
[in] | rhs | The right-hand-side. |
int pargemslr::IluClass< MatrixType, VectorType, DataType >::SetupILUT | ( | VectorType & | x, |
VectorType & | rhs | ||
) |
Setup ILUT, ingore the ilu option.
[in] | x | The initial guess. |
[in] | rhs | The right-hand-side. |
int pargemslr::IluClass< MatrixType, VectorType, DataType >::SetupPartialILUT | ( | VectorType & | x, |
VectorType & | rhs | ||
) |
Setup Partial ILUT, form approximate Schur Complement.
[in] | x | The initial guess. |
[in] | rhs | The right-hand-side. |
int pargemslr::IluClass< MatrixType, VectorType, DataType >::SetupPermutation | ( | VectorType & | x, |
VectorType & | rhs | ||
) |
Build the permutation vector.
[in] | x | The initial guess. |
[in] | rhs | The right-hand-side. |
|
inlinevirtual |
Setup with parameter array.
[in] | params | The parameter array. |
Reimplemented from pargemslr::SolverClass< MatrixType, VectorType, DataType >.
|
virtual |
Solve phase. Call this function after Setup. Solve with cusparse if unified memory/device memory is used.
[in,out] | x | The initial guess. |
[in] | rhs | The right-hand-side. |
Implements pargemslr::SolverClass< MatrixType, VectorType, DataType >.
int pargemslr::IluClass< MatrixType, VectorType, DataType >::SolveL | ( | VectorType & | x, |
VectorType & | rhs | ||
) |
Solve with L only. Call this function after Setup. Solve with cusparse if unified memory/device memory is used.
[in,out] | x | The initial guess. |
[in] | rhs | The right-hand-side. |
int pargemslr::IluClass< MatrixType, VectorType, DataType >::SolveU | ( | VectorType & | x, |
VectorType & | rhs | ||
) |
Solve with U only. Call this function after Setup. Solve with cusparse if unified memory/device memory is used.
[in,out] | x | The initial guess. |
[in] | rhs | The right-hand-side. |
|
inlinestatic |
Swap v[i] and v[j].
[in] | v | The array. |
[in] | i | The first index. |
[in] | j | The second index. |
|
inlinestatic |
Swap v[i] and v[j], w[i] and w[j].
[in] | v | The first array. |
[in] | w | The second array. |
[in] | i | The first index. |
[in] | j | The second index. |