CHROMA
|
Solve a M*psi=chi linear system by FGMRESDR. More...
#include <syssolver_linop_fgmres_dr.h>
Public Types | |
using | T = LatticeFermion |
using | U = LatticeColorMatrix |
using | Q = multi1d< U > |
Public Member Functions | |
LinOpSysSolverFGMRESDR (Handle< LinearOperator< T > > A, Handle< FermState< T, Q, Q > > state, const SysSolverFGMRESDRParams &invParam) | |
Constructor. More... | |
void | InitMatrices () |
Initialize the internal matrices. More... | |
~LinOpSysSolverFGMRESDR () | |
Destructor is automatic. More... | |
const Subset & | subset () const |
Return the subset on which the operator acts. More... | |
SystemSolverResults_t | operator() (T &psi, const T &chi) const |
Solver the linear system. More... | |
void | FlexibleArnoldi (int n_krylov, int n_deflate, const Real &rsd_target, multi1d< T > &V, multi1d< T > &Z, multi2d< DComplex > &H, multi2d< DComplex > &R, multi1d< Handle< Givens > > &givens_rots, multi1d< DComplex > &g, multi2d< DComplex > &Qk, multi1d< DComplex > &Qk_tau, int &ndim_cycle) const |
void | LeastSquaresSolve (const multi2d< DComplex > &R, const multi1d< DComplex > &rhs, multi1d< DComplex > &eta, int dim) const |
void | GetEigenvectors (int total_dim, const multi2d< DComplex > &H, multi1d< DComplex > &f_m, multi2d< DComplex > &evecs, multi1d< DComplex > &evals, multi1d< int > &order_array) const |
![]() | |
virtual | ~SystemSolver () |
Virtual destructor to help with cleanup;. More... | |
Private Member Functions | |
LinOpSysSolverFGMRESDR () | |
Private Attributes | |
Handle< LinearOperator< T > > | A_ |
Handle< FermState< T, Q, Q > > | state_ |
SysSolverFGMRESDRParams | invParam_ |
Handle< LinOpSystemSolver< T > > | preconditioner_ |
multi2d< DComplex > | H_ |
multi2d< DComplex > | R_ |
multi1d< T > | V_ |
multi1d< T > | Z_ |
multi1d< Handle< Givens > > | givens_rots_ |
multi1d< DComplex > | c_ |
multi1d< DComplex > | eta_ |
multi1d< DComplex > | g_ |
multi2d< DComplex > | Hk_QR_ |
multi1d< DComplex > | Hk_QR_taus_ |
Solve a M*psi=chi linear system by FGMRESDR.
Definition at line 155 of file syssolver_linop_fgmres_dr.h.
using Chroma::LinOpSysSolverFGMRESDR::Q = multi1d<U> |
Definition at line 160 of file syssolver_linop_fgmres_dr.h.
using Chroma::LinOpSysSolverFGMRESDR::T = LatticeFermion |
Definition at line 158 of file syssolver_linop_fgmres_dr.h.
using Chroma::LinOpSysSolverFGMRESDR::U = LatticeColorMatrix |
Definition at line 159 of file syssolver_linop_fgmres_dr.h.
|
inline |
Constructor.
A_ | Linear operator ( Read ) |
invParam | inverter parameters ( Read ) |
Definition at line 167 of file syssolver_linop_fgmres_dr.h.
References A_, Chroma::GroupXML_t::id, InitMatrices(), Chroma::SingletonHolder< T, CreationPolicy, LifetimePolicy, ThreadingModel >::Instance(), invParam_, Chroma::SysSolverFGMRESDRParams::NDefl, Chroma::GroupXML_t::path, preconditioner_, Chroma::SysSolverFGMRESDRParams::PrecondParams, state_, and Chroma::GroupXML_t::xml.
|
inline |
Destructor is automatic.
Definition at line 212 of file syssolver_linop_fgmres_dr.h.
|
inlineprivate |
Definition at line 253 of file syssolver_linop_fgmres_dr.h.
void Chroma::LinOpSysSolverFGMRESDR::FlexibleArnoldi | ( | int | n_krylov, |
int | n_deflate, | ||
const Real & | rsd_target, | ||
multi1d< T > & | V, | ||
multi1d< T > & | Z, | ||
multi2d< DComplex > & | H, | ||
multi2d< DComplex > & | R, | ||
multi1d< Handle< Givens > > & | givens_rots, | ||
multi1d< DComplex > & | g, | ||
multi2d< DComplex > & | Qk, | ||
multi1d< DComplex > & | Qk_tau, | ||
int & | ndim_cycle | ||
) | const |
Flexible Arnolid Process. Currently not using augmentation (n_deflate ignored)
NB: This currentl just forwards to a templated free function
Definition at line 429 of file syssolver_linop_fgmres_dr.cc.
References A_, and preconditioner_.
Referenced by operator()(), TEST_F(), and TEST_P().
void Chroma::LinOpSysSolverFGMRESDR::GetEigenvectors | ( | int | total_dim, |
const multi2d< DComplex > & | H, | ||
multi1d< DComplex > & | f_m, | ||
multi2d< DComplex > & | evecs, | ||
multi1d< DComplex > & | evals, | ||
multi1d< int > & | order_array | ||
) | const |
Get the eigenvectors of the matrix H_tilde = H_m + f_m h^{H}_m
of which we will keep the first NDefl corresponding to the NDefl eigenvalues of smallest modulus as our matrix G. In turn the Harmonic Ritz vectors are V_m G_m.
We need a two stage process here. One: first we need to solve H_m^H f_m = h^H_m where h_m is the last row of the \hat{H}_m
second, once in posession of f_m we need to constuct H_tilde and get its eigenvalues and eigenvectors.
NB: We use lapack here, specifically the routines: zgetrf/zgetrs to solve for f_m
zgeev to get the eigenvalues/eigenvectors
Definition at line 343 of file syssolver_linop_fgmres_dr.cc.
References Chroma::i, Chroma::info, and j.
Referenced by TEST_F().
void Chroma::LinOpSysSolverFGMRESDR::InitMatrices | ( | ) |
Initialize the internal matrices.
Initialize the key matrices (resize and zero)
Definition at line 199 of file syssolver_linop_fgmres_dr.cc.
References c_, eta_, g_, givens_rots_, H_, invParam_, Chroma::SysSolverFGMRESDRParams::NDefl, Chroma::SysSolverFGMRESDRParams::NKrylov, R_, V_, Z_, and Chroma::zero.
Referenced by LinOpSysSolverFGMRESDR().
void Chroma::LinOpSysSolverFGMRESDR::LeastSquaresSolve | ( | const multi2d< DComplex > & | R, |
const multi1d< DComplex > & | Q_rhs, | ||
multi1d< DComplex > & | eta, | ||
int | n_cols | ||
) | const |
Solve least squares system to get the coefficients for Updating the solution at the end of an GGMRES-DR Cycle. In this instantiation the system solved is
R \eta = rhs
where R is the matrix H from GMRES, reduced to upper triangular form by Givens rotations, and rhs is the result of the Givens rotations applied to the orignal g = [ beta, 0, 0 ... ]^T vector.
Hence this operation is a straightforward back substitution NB: the matrix R has dim+1 rows and dim columns, but the dim+1-th row has All zero entries and should be deleted. d
dim is passed in instead of using matrix dimensions in case the cycle terminated early.
Definition at line 257 of file syssolver_linop_fgmres_dr.cc.
References Chroma::eta.
Referenced by operator()(), and TEST_F().
|
virtual |
Solver the linear system.
psi | solution ( Modify ) |
chi | source ( Read ) |
Solve the linear system A psi = chi via FGMRES-DR Right now the DR part is not implemented.
Copy H into H_copy
Implements Chroma::SystemSolver< LatticeFermion >.
Definition at line 459 of file syssolver_linop_fgmres_dr.cc.
References A_, c_, Chroma::chi(), Chroma::END_CODE(), eta_, FlexibleArnoldi(), g_, givens_rots_, H_, Hk_QR_, Hk_QR_taus_, Chroma::i, Chroma::InlinePropAndMatElemDistillation2Env::local::innerProduct(), invParam_, j, LeastSquaresSolve(), Chroma::SysSolverFGMRESDRParams::MaxIter, Chroma::SystemSolverResults_t::n_count, Chroma::SysSolverFGMRESDRParams::NDefl, Chroma::SysSolverFGMRESDRParams::NKrylov, Chroma::PLUS, Chroma::psi, Chroma::r, R_, r_norm, Chroma::SystemSolverResults_t::resid, Chroma::SysSolverFGMRESDRParams::RsdTarget, Chroma::s(), Chroma::START_CODE(), Chroma::tmp, V_, Z_, and Chroma::zero.
|
inlinevirtual |
Return the subset on which the operator acts.
Implements Chroma::SystemSolver< LatticeFermion >.
Definition at line 215 of file syssolver_linop_fgmres_dr.h.
References A_.
|
private |
Definition at line 254 of file syssolver_linop_fgmres_dr.h.
Referenced by FlexibleArnoldi(), LinOpSysSolverFGMRESDR(), operator()(), and subset().
|
mutableprivate |
Definition at line 280 of file syssolver_linop_fgmres_dr.h.
Referenced by InitMatrices(), and operator()().
|
mutableprivate |
Definition at line 281 of file syssolver_linop_fgmres_dr.h.
Referenced by InitMatrices(), and operator()().
|
mutableprivate |
Definition at line 282 of file syssolver_linop_fgmres_dr.h.
Referenced by InitMatrices(), and operator()().
Definition at line 265 of file syssolver_linop_fgmres_dr.h.
Referenced by InitMatrices(), and operator()().
|
mutableprivate |
Definition at line 261 of file syssolver_linop_fgmres_dr.h.
Referenced by InitMatrices(), and operator()().
|
mutableprivate |
Definition at line 283 of file syssolver_linop_fgmres_dr.h.
Referenced by operator()().
|
mutableprivate |
Definition at line 284 of file syssolver_linop_fgmres_dr.h.
Referenced by operator()().
|
private |
Definition at line 256 of file syssolver_linop_fgmres_dr.h.
Referenced by InitMatrices(), LinOpSysSolverFGMRESDR(), and operator()().
|
private |
Definition at line 257 of file syssolver_linop_fgmres_dr.h.
Referenced by FlexibleArnoldi(), and LinOpSysSolverFGMRESDR().
|
mutableprivate |
Definition at line 262 of file syssolver_linop_fgmres_dr.h.
Referenced by InitMatrices(), and operator()().
Definition at line 255 of file syssolver_linop_fgmres_dr.h.
Referenced by LinOpSysSolverFGMRESDR().
|
mutableprivate |
Definition at line 263 of file syssolver_linop_fgmres_dr.h.
Referenced by InitMatrices(), and operator()().
|
mutableprivate |
Definition at line 264 of file syssolver_linop_fgmres_dr.h.
Referenced by InitMatrices(), and operator()().