CHROMA
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members

Solve a M*psi=chi linear system by FGMRESDR. More...

#include <syssolver_linop_fgmres_dr.h>

Inheritance diagram for Chroma::LinOpSysSolverFGMRESDR:
Chroma::LinOpSystemSolver< LatticeFermion > Chroma::SystemSolver< LatticeFermion >

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
 
- Public Member Functions inherited from Chroma::SystemSolver< LatticeFermion >
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< TV_
 
multi1d< TZ_
 
multi1d< Handle< Givens > > givens_rots_
 
multi1d< DComplex > c_
 
multi1d< DComplex > eta_
 
multi1d< DComplex > g_
 
multi2d< DComplex > Hk_QR_
 
multi1d< DComplex > Hk_QR_taus_
 

Detailed Description

Solve a M*psi=chi linear system by FGMRESDR.

Definition at line 155 of file syssolver_linop_fgmres_dr.h.

Member Typedef Documentation

◆ Q

Definition at line 160 of file syssolver_linop_fgmres_dr.h.

◆ T

using Chroma::LinOpSysSolverFGMRESDR::T = LatticeFermion

Definition at line 158 of file syssolver_linop_fgmres_dr.h.

◆ U

using Chroma::LinOpSysSolverFGMRESDR::U = LatticeColorMatrix

Definition at line 159 of file syssolver_linop_fgmres_dr.h.

Constructor & Destructor Documentation

◆ LinOpSysSolverFGMRESDR() [1/2]

Chroma::LinOpSysSolverFGMRESDR::LinOpSysSolverFGMRESDR ( Handle< LinearOperator< T > >  A,
Handle< FermState< T, Q, Q > >  state,
const SysSolverFGMRESDRParams invParam 
)
inline

◆ ~LinOpSysSolverFGMRESDR()

Chroma::LinOpSysSolverFGMRESDR::~LinOpSysSolverFGMRESDR ( )
inline

Destructor is automatic.

Definition at line 212 of file syssolver_linop_fgmres_dr.h.

◆ LinOpSysSolverFGMRESDR() [2/2]

Chroma::LinOpSysSolverFGMRESDR::LinOpSysSolverFGMRESDR ( )
inlineprivate

Definition at line 253 of file syssolver_linop_fgmres_dr.h.

Member Function Documentation

◆ FlexibleArnoldi()

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().

◆ GetEigenvectors()

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().

◆ InitMatrices()

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().

◆ LeastSquaresSolve()

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().

◆ operator()()

SystemSolverResults_t Chroma::LinOpSysSolverFGMRESDR::operator() ( T psi,
const T chi 
) const
virtual

◆ subset()

const Subset& Chroma::LinOpSysSolverFGMRESDR::subset ( void  ) const
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_.

Referenced by TEST_F(), and TEST_P().

Member Data Documentation

◆ A_

Handle< LinearOperator<T> > Chroma::LinOpSysSolverFGMRESDR::A_
private

◆ c_

multi1d<DComplex> Chroma::LinOpSysSolverFGMRESDR::c_
mutableprivate

Definition at line 280 of file syssolver_linop_fgmres_dr.h.

Referenced by InitMatrices(), and operator()().

◆ eta_

multi1d<DComplex> Chroma::LinOpSysSolverFGMRESDR::eta_
mutableprivate

Definition at line 281 of file syssolver_linop_fgmres_dr.h.

Referenced by InitMatrices(), and operator()().

◆ g_

multi1d<DComplex> Chroma::LinOpSysSolverFGMRESDR::g_
mutableprivate

Definition at line 282 of file syssolver_linop_fgmres_dr.h.

Referenced by InitMatrices(), and operator()().

◆ givens_rots_

multi1d< Handle<Givens> > Chroma::LinOpSysSolverFGMRESDR::givens_rots_
mutableprivate

Definition at line 265 of file syssolver_linop_fgmres_dr.h.

Referenced by InitMatrices(), and operator()().

◆ H_

multi2d<DComplex> Chroma::LinOpSysSolverFGMRESDR::H_
mutableprivate

Definition at line 261 of file syssolver_linop_fgmres_dr.h.

Referenced by InitMatrices(), and operator()().

◆ Hk_QR_

multi2d<DComplex> Chroma::LinOpSysSolverFGMRESDR::Hk_QR_
mutableprivate

Definition at line 283 of file syssolver_linop_fgmres_dr.h.

Referenced by operator()().

◆ Hk_QR_taus_

multi1d<DComplex> Chroma::LinOpSysSolverFGMRESDR::Hk_QR_taus_
mutableprivate

Definition at line 284 of file syssolver_linop_fgmres_dr.h.

Referenced by operator()().

◆ invParam_

SysSolverFGMRESDRParams Chroma::LinOpSysSolverFGMRESDR::invParam_
private

Definition at line 256 of file syssolver_linop_fgmres_dr.h.

Referenced by InitMatrices(), LinOpSysSolverFGMRESDR(), and operator()().

◆ preconditioner_

Handle< LinOpSystemSolver<T> > Chroma::LinOpSysSolverFGMRESDR::preconditioner_
private

Definition at line 257 of file syssolver_linop_fgmres_dr.h.

Referenced by FlexibleArnoldi(), and LinOpSysSolverFGMRESDR().

◆ R_

multi2d<DComplex> Chroma::LinOpSysSolverFGMRESDR::R_
mutableprivate

Definition at line 262 of file syssolver_linop_fgmres_dr.h.

Referenced by InitMatrices(), and operator()().

◆ state_

Handle< FermState<T,Q,Q> > Chroma::LinOpSysSolverFGMRESDR::state_
private

Definition at line 255 of file syssolver_linop_fgmres_dr.h.

Referenced by LinOpSysSolverFGMRESDR().

◆ V_

multi1d<T> Chroma::LinOpSysSolverFGMRESDR::V_
mutableprivate

Definition at line 263 of file syssolver_linop_fgmres_dr.h.

Referenced by InitMatrices(), and operator()().

◆ Z_

multi1d<T> Chroma::LinOpSysSolverFGMRESDR::Z_
mutableprivate

Definition at line 264 of file syssolver_linop_fgmres_dr.h.

Referenced by InitMatrices(), and operator()().


The documentation for this class was generated from the following files: