ug4
|
#include <pinvit.h>
Public Types | |
typedef TAlgebra | algebra_type |
typedef DebugWritingObject< TAlgebra > | base_type |
Base type. | |
typedef TAlgebra::matrix_type | matrix_type |
typedef TAlgebra::vector_type | vector_type |
typedef vector_type::value_type | vector_value_type |
![]() | |
typedef TAlgebra | algebra_type |
type of algebra | |
typedef TAlgebra::matrix_type | matrix_type |
type of matrix | |
typedef TAlgebra::vector_type | vector_type |
type of vector | |
![]() | |
typedef TAlgebra::vector_type | vector_type |
type of vector | |
Public Attributes | |
bool | m_bStoreDefects |
bool | m_bStoreLambdas |
std::vector< std::vector< double > > | m_defects |
size_t | m_iteration |
std::vector< std::vector< double > > | m_lambdas |
Private Types | |
typedef IPreconditioner< TAlgebra >::matrix_operator_type | matrix_operator_type |
Private Member Functions | |
double | B_norm (vector_type &x) |
void | calculate_correction (vector_type &corr, vector_type &defect) |
void | compute_rayleigh_and_defect (vector_type &x, double &lambda, vector_type &defect, double &defectNorm) |
SmartPtr< IDebugWriter< algebra_type > > | debug_writer () |
returns the debug writer | |
ConstSmartPtr< IDebugWriter< algebra_type > > | debug_writer () const |
void | get_linear_independent_rows (DenseMatrix< VariableArray2< double > > mat, std::vector< bool > &bLinearIndependent) |
void | get_projected_eigenvalue_problem (DenseMatrix< VariableArray2< double > > &rA, DenseMatrix< VariableArray2< double > > &rB, SmartPtrVector< vector_type > &pTestVectors, std::vector< std::string > &vTestVectorDescription) |
void | get_testvectors (int iteration, SmartPtrVector< vector_type > &vCorr, std::vector< std::string > &vCorrectionName, size_t numCorrections, SmartPtrVector< vector_type > &vOldX, SmartPtrVector< vector_type > &vAdditional, SmartPtrVector< vector_type > &pTestVectors, std::vector< std::string > &vTestVectorDescription, std::vector< bool > &bConverged) |
void | normalize_approximations () |
void | print_eigenvalues_and_defect (int iteration, const std::vector< double > &vDefectNorm, std::vector< double > &vOldDefectNorm, const std::vector< double > &vLambda, std::vector< bool > &bConverged) |
void | print_used_testvectors (std::vector< std::string > &vTestVectorDescription, std::vector< bool > bUse) |
template<typename T > | |
void | remove_unused (T &v, const std::vector< bool > vbUse) |
virtual void | set_debug (SmartPtr< IDebugWriter< algebra_type > > spDebugWriter) |
set debug writer | |
void | write_debug (const matrix_type &mat, const char *filename) |
write debug output for a matrix (if debug writer set) | |
void | write_debug (const matrix_type &mat, std::string name) |
write debug output for a matrix (if debug writer set) | |
void | write_debug (int iteration, int i, vector_type &x, vector_type &defect, vector_type &corr, bool bConverged) |
void | write_debug_old (int iteration, int i, vector_type &oldX) |
Private Attributes | |
std::vector< double > | freq_change |
std::vector< double > | lambda |
size_t | m_additionalEigenvectorsToKeep |
bool | m_bAbortOnFreqConverged_linear_elasticity |
bool | m_bDebugCalcProjectedEigenvalues |
bool | m_bLaplacian |
bool | m_bPrintEigenvaluesAndDefect |
bool | m_bPrintFrequencies_linear_elasticity |
bool | m_bPrintProjectedEigenproblem |
bool | m_bPrintProjectedEigenvalues |
bool | m_bPrintProjectedEigenvectors |
bool | m_bPrintUsedTestvectors |
bool | m_bRelativePrecision |
bool | m_bUseAdditionalCorrections |
size_t | m_currentAdditionalCorrections |
size_t | m_currentAdditionalEigenvectors |
double | m_dDensity_linear_elasticity |
double | m_dFreqPrecision |
double | m_dMinimumDefectToCalcCorrection |
double | m_dPrecision |
size_t | m_iPINVIT |
double | m_linearDependentEps |
size_t | m_maxIterations |
SmartPtr< ILinearOperator< vector_type > > | m_pA |
matrix_operator_type * | m_pB |
SmartPtr< ILinearIterator< vector_type > > | m_spPrecond |
SmartPtrVector< vector_type > | px |
std::vector< bool > | vbDirichlet |
Additional Inherited Members | |
![]() | |
void | enter_debug_writer_section (const char *secDir) |
enters a debugging section | |
void | enter_debug_writer_section (std::string secDir) |
enters a debugging section | |
void | leave_debug_writer_section () |
leaves a debugging section | |
void | write_debug (const matrix_type &mat, const char *filename) |
write debug output for a matrix (if debug writer set) | |
void | write_debug (const matrix_type &mat, std::string name) |
write debug output for a matrix (if debug writer set) | |
![]() | |
void | enter_vector_debug_writer_section (const char *secDir) |
enters a debugging section | |
void | enter_vector_debug_writer_section (std::string secDir) |
enters a debugging section | |
void | leave_vector_debug_writer_section () |
leaves a debugging section | |
void | print_debugger_message (const char *msg) |
prints a debugger message (listing all the sections) | |
void | print_debugger_message (std::string msg) |
prints a debugger message (listing all the sections) | |
virtual void | write_debug (const vector_type &vec, std::string name) |
writing debug output for a vector (if debug writer set) | |
![]() | |
SmartPtr< IDebugWriter< algebra_type > > | m_spDebugWriter |
Debug Writer. | |
![]() | |
SmartPtr< IVectorDebugWriter< vector_type > > | m_spVectorDebugWriter |
Debug Writer. | |
PINVIT Eigensolver
This Eigensolver solves problems of the form Ax = lambda B x For sparse matrices A and B, and we want to find the smallest (in terms of abs(lambda) ) e.g. 1-100 solutions (eigenvalues) of the problem. For this we need a preconditioner, calculating c = Pd (e.g. Jacobi, Gauss-Seidel, Geometric/Algebraic Multigrid, ILU).
This implements the PINVIT(s) methods, with s=2 = LOBPCG see Martin Rupp - Berechnung der Resonanzschwingungen einer Gitarrendecke (Diploma thesis) and Andrew Knyazew, Toward the optimal Preconditioned Eigensolver: Locally Optimal Block Preconditioned Conjugate Gradient Method. http://epubs.siam.org/doi/pdf/10.1137/S1064827500366124
iPINVIT=1 -> Preconditioned Inverse Block Iteration [Neymeyr] iPINVIT=2 -> Preconditioned Block Gradient Method iPINVIT=3 -> LOBPCG (locally optimal block preconditioned gradient) [Knyazew] iPINVIT>=4 -> gerneralized methods.
example:
If you want to use a solver as preconditioner, use precond = OperatorInverseIterator(linSolver)
typedef TAlgebra ug::PINVIT< TAlgebra >::algebra_type |
typedef DebugWritingObject<TAlgebra> ug::PINVIT< TAlgebra >::base_type |
Base type.
|
private |
typedef TAlgebra::matrix_type ug::PINVIT< TAlgebra >::matrix_type |
typedef TAlgebra::vector_type ug::PINVIT< TAlgebra >::vector_type |
typedef vector_type::value_type ug::PINVIT< TAlgebra >::vector_value_type |
|
inline |
References ug::PINVIT< TAlgebra >::m_additionalEigenvectorsToKeep, ug::PINVIT< TAlgebra >::m_bAbortOnFreqConverged_linear_elasticity, ug::PINVIT< TAlgebra >::m_bDebugCalcProjectedEigenvalues, ug::PINVIT< TAlgebra >::m_bLaplacian, ug::PINVIT< TAlgebra >::m_bPrintEigenvaluesAndDefect, ug::PINVIT< TAlgebra >::m_bPrintFrequencies_linear_elasticity, ug::PINVIT< TAlgebra >::m_bPrintProjectedEigenproblem, ug::PINVIT< TAlgebra >::m_bPrintProjectedEigenvalues, ug::PINVIT< TAlgebra >::m_bPrintProjectedEigenvectors, ug::PINVIT< TAlgebra >::m_bPrintUsedTestvectors, ug::PINVIT< TAlgebra >::m_bRelativePrecision, ug::PINVIT< TAlgebra >::m_bStoreDefects, ug::PINVIT< TAlgebra >::m_bStoreLambdas, ug::PINVIT< TAlgebra >::m_bUseAdditionalCorrections, ug::PINVIT< TAlgebra >::m_currentAdditionalEigenvectors, ug::PINVIT< TAlgebra >::m_dDensity_linear_elasticity, ug::PINVIT< TAlgebra >::m_dFreqPrecision, ug::PINVIT< TAlgebra >::m_dMinimumDefectToCalcCorrection, ug::PINVIT< TAlgebra >::m_dPrecision, ug::PINVIT< TAlgebra >::m_iPINVIT, ug::PINVIT< TAlgebra >::m_linearDependentEps, ug::PINVIT< TAlgebra >::m_pA, ug::PINVIT< TAlgebra >::m_pB, and SPNULL.
|
inline |
adds a vector which should be used for eigenvalue computation
vec |
References ug::PINVIT< TAlgebra >::px.
|
inline |
perform the calculation
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
For a given eigenvalue approximation, computes the rayleigh quotient, the defect, the norm of the defect, and the correction calculated by the preconditioner
[in] | x | current normalized eigenvalue approximation (<x,x> = 1) |
[out] | lambda | lambda = <x, Ax> / <x, Bx> |
[out] | defect | defect = lambda x - Ax |
[out] | vDefectNorm | vDefectNorm = | defect |_2 |
[out] | vCorr | P defect |
|
inlinevirtual |
References ug::ConfigShift(), ug::PINVIT< TAlgebra >::m_additionalEigenvectorsToKeep, ug::PINVIT< TAlgebra >::m_bLaplacian, ug::PINVIT< TAlgebra >::m_bRelativePrecision, ug::PINVIT< TAlgebra >::m_bUseAdditionalCorrections, ug::PINVIT< TAlgebra >::m_dMinimumDefectToCalcCorrection, ug::PINVIT< TAlgebra >::m_dPrecision, ug::PINVIT< TAlgebra >::m_iPINVIT, ug::PINVIT< TAlgebra >::m_maxIterations, ug::PINVIT< TAlgebra >::m_spPrecond, and ug::PINVIT< TAlgebra >::px.
Referenced by ug::PINVIT< TAlgebra >::tostring().
|
inline |
|
inline |
debug_calc_projected_eigenvalues
r_ev | |
pTestVectors | |
iteration | |
bWrite |
|
inlineprivate |
returns the debug writer
|
inlineprivate |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
Calculates a maximal set of rows which are linear independent
[in] | mat | the input matrix |
[out] | bLinearIndependent | output vector (true if linear independent) |
|
inline |
|
inlineprivate |
Calculate projected eigenvalue problem on space spanned by testvectors in pTestVectors
[out] | rA | reduced eigenvalue problem matrix A |
[out] | rB | reduced eigenvalue problem matrix B |
[in,out] | pTestVectors | the testvectors, out: the used testvectors |
[in,out] | vTestVectorDescription | their description |
|
inlineprivate |
depending on the PINVIT-method, this function calculates the used testvectors
PINVIT(s) for s>=2: L^k = span_i < x^{k-s+2}_i , .. x^{k}_i, c^k_i> that is the space spanned by the current eigenvalue, its correction, and the s-2 previous eigenvalue approximations
if an eigenvalue is converged, we don't calculate a correction for this and previous approximations will be not too much different, so we also won't add previous approximations
[in] | iteration | iteration number |
[in] | vCorr | correction for eigenvector approximation |
[in] | vOldX | previous eigenvector approximations |
[out] | pTestVectors | vector in which we store the used test vectors for the projected eigenvalue problem |
[out] | vTestVectorDescription | description of the vectors (ev, corr or oldEv) |
[in] | vDefectNorm | norm of the defects |
|
inline |
|
inlineprivate |
|
inline |
|
inlineprivate |
prints the current eigenvalues and convergence status
[in] | iteration | iteration number |
[in] | vDefectNorm | vector of defect norms |
[in,out] | vOldDefectNorm | vector of defect norms from previous iteration |
[in] | vLambda | vector of eigenvalue approximations |
|
inline |
|
inlineprivate |
|
inlineprivate |
remove all entries with vbUse[i]==false from vector i
[in,out] | v | vector to contain result |
[in] | vbUse | if vbUse[i] is true, add it to new vector |
|
inline |
|
inline |
|
inlineprivatevirtual |
set debug writer
Reimplemented from ug::DebugWritingObject< TAlgebra >.
|
inline |
|
inline |
|
inline |
References ug::PINVIT< TAlgebra >::m_linearDependentEps.
|
inline |
|
inline |
References ug::PINVIT< TAlgebra >::m_pB.
|
inline |
References ug::PINVIT< TAlgebra >::m_maxIterations.
|
inline |
|
inline |
iPINVIT=1 -> Preconditioned Inverse Block Iteration [Neymeyr] iPINVIT=2 -> Preconditioned Block Gradient Method iPINVIT=3 -> LOBPCG (locally optimal block preconditioned gradient) [Knyazew] iPINVIT>=4 -> gerneralized methods.
iPINVIT |
References ug::PINVIT< TAlgebra >::m_iPINVIT, and UG_ASSERT.
|
inline |
|
inline |
set the preconditioner (or Linear Iterator) e.g. Gauss-Seidel, AMG/GMG, Jacobi, ILU, ...
precond |
References ug::PINVIT< TAlgebra >::m_spPrecond.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
References ug::PINVIT< TAlgebra >::config_string().
|
inlineprivate |
write debug output for a matrix (if debug writer set)
|
inlineprivate |
write debug output for a matrix (if debug writer set)
|
inlineprivate |
|
inlineprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Referenced by ug::PINVIT< TAlgebra >::PINVIT().
|
private |
|
private |
Referenced by ug::PINVIT< TAlgebra >::PINVIT().
|
private |
Referenced by ug::PINVIT< TAlgebra >::PINVIT().
|
private |
Referenced by ug::PINVIT< TAlgebra >::PINVIT().
|
private |
Referenced by ug::PINVIT< TAlgebra >::PINVIT().
|
private |
bool ug::PINVIT< TAlgebra >::m_bStoreDefects |
Referenced by ug::PINVIT< TAlgebra >::PINVIT().
bool ug::PINVIT< TAlgebra >::m_bStoreLambdas |
Referenced by ug::PINVIT< TAlgebra >::PINVIT().
|
private |
|
private |
|
private |
Referenced by ug::PINVIT< TAlgebra >::PINVIT().
|
private |
std::vector<std::vector<double> > ug::PINVIT< TAlgebra >::m_defects |
|
private |
|
private |
|
private |
|
private |
size_t ug::PINVIT< TAlgebra >::m_iteration |
std::vector<std::vector<double> > ug::PINVIT< TAlgebra >::m_lambdas |
|
private |
Referenced by ug::PINVIT< TAlgebra >::PINVIT(), and ug::PINVIT< TAlgebra >::set_linear_dependent_eps().
|
private |
Referenced by ug::PINVIT< TAlgebra >::config_string(), and ug::PINVIT< TAlgebra >::set_max_iterations().
|
private |
Referenced by ug::PINVIT< TAlgebra >::PINVIT(), and ug::PINVIT< TAlgebra >::set_linear_operator_A().
|
private |
Referenced by ug::PINVIT< TAlgebra >::PINVIT(), and ug::PINVIT< TAlgebra >::set_linear_operator_B().
|
private |
Referenced by ug::PINVIT< TAlgebra >::config_string(), and ug::PINVIT< TAlgebra >::set_preconditioner().
|
private |
Referenced by ug::PINVIT< TAlgebra >::add_vector(), and ug::PINVIT< TAlgebra >::config_string().
|
private |
Referenced by ug::PINVIT< TAlgebra >::set_linear_operator_A().