Iterative Set Of Linear Equations solver, extending the generic LRSolver. More...
#include <slr.h>
Public Member Functions | |
SetOfEqSolver (int nbast, int nocc, const ergo_real *fock_matrix, const ergo_real *s, ergo_real freq) | |
Creates the set-of-equations solver. | |
void | setRHS (OneElOperator &op) |
initializes the rhs field | |
virtual | ~SetOfEqSolver () |
virtual ergo_real | getPreconditionerShift (int) const |
returns the preconditioning shift. | |
virtual int | getInitialGuess (VarVectorCollection &vecs) |
returns the initial guess for the linear set of equations. | |
virtual bool | getResidual (VarVectorCollection &residualv) |
get the residual of the set of linear equations. | |
virtual void | increaseSubspaceLimit (int newSize) |
expands above the default limit | |
ergo_real | getPolarisability (OneElOperator &oper) |
computes polarizability by contracting the response vector with specified operator | |
Protected Member Functions | |
virtual void | addToSpace (VarVectorCollection &vecs, E2Evaluator &e2) |
extends the subspace with v and its transformed vector Av. | |
ergo_real | multiplyXtimesVec (const VarVector &rhs) |
multiplies current solution by some vector. | |
Protected Attributes | |
ergo_real * | rhsSub |
RHS vector projected onto subspace. | |
ergo_real | xTimesRHS |
Private Attributes | |
ergo_real | frequency |
frequency for which the SOE is to be solved. | |
VarVector | rhs |
RHS of the SOE. |
Iterative Set Of Linear Equations solver, extending the generic LRSolver.
LR::SetOfEqSolver::SetOfEqSolver | ( | int | nbast, | |
int | nocc, | |||
const ergo_real * | fock_matrix, | |||
const ergo_real * | s, | |||
ergo_real | freq | |||
) | [inline] |
Creates the set-of-equations solver.
The KS and overlap matrix may be deleted immediately after the object creation.
virtual LR::SetOfEqSolver::~SetOfEqSolver | ( | ) | [inline, virtual] |
References rhsSub.
void LR::SetOfEqSolver::addToSpace | ( | VarVectorCollection & | v, | |
E2Evaluator & | e2 | |||
) | [protected, virtual] |
extends the subspace with v and its transformed vector Av.
The eSub and sSub projected matrices are modified as well. We do not store explicitely the swapped vectors (y x), only the (x y) combination.
Reimplemented from LR::LRSolver.
References LR::dot(), LR::VarVector::nvar, rhs, rhsSub, LR::LRSolver::subspaceSize, LR::LRSolver::vects, LR::VarVector::x(), and LR::VarVector::y().
int LR::SetOfEqSolver::getInitialGuess | ( | VarVectorCollection & | guess | ) | [virtual] |
returns the initial guess for the linear set of equations.
The explicit value is obtained from the diagonal assumption for the E[2] operator and is: (E[2]- freq*S[2])*g = Y -> g = Y./(E[2]-freq*S[2])
Implements LR::LRSolver.
References LR::LRSolver::e2diag, LR::VarVector::nvar, rhs, LR::VarVector::setSize(), and LR::VarVectorCollection::setSize().
ergo_real LR::SetOfEqSolver::getPolarisability | ( | OneElOperator & | oper | ) |
computes polarizability by contracting the response vector with specified operator
References multiplyXtimesVec(), and LR::LRSolver::operToVec().
Referenced by solveForRHS().
virtual ergo_real LR::SetOfEqSolver::getPreconditionerShift | ( | int | i | ) | const [inline, virtual] |
returns the preconditioning shift.
Proper preconditioning is vital for the quick convergence.
Implements LR::LRSolver.
References frequency.
bool LR::SetOfEqSolver::getResidual | ( | VarVectorCollection & | residualv | ) | [virtual] |
get the residual of the set of linear equations.
This is done in two steps: Solution in the subspace: Xsub = (eSub-freq*Ssub)\Ysub; Residual vector is: residualv= (Av-freq*Sv)*Xsub - Y;
Implements LR::LRSolver.
References A, LR::LRSolver::convThreshold, do_output(), LR::LRSolver::eSub, frequency, LR::LRSolver::getAvMinusFreqSv(), LOG_AREA_LR, LOG_CAT_INFO, multiplyXtimesVec(), LR::VarVector::nvar, rhs, rhsSub, LR::VarVectorCollection::setSize(), solve_linear_equation_system(), LR::LRSolver::sSub, LR::LRSolver::subspaceSize, template_blas_sqrt(), LR::LRSolver::xSub, and xTimesRHS.
void LR::SetOfEqSolver::increaseSubspaceLimit | ( | int | newSize | ) | [virtual] |
expands above the default limit
Reimplemented from LR::LRSolver.
References LR::LRSolver::maxSubspaceSize, and rhsSub.
Referenced by es_get_polarisability().
multiplies current solution by some vector.
If such contractions are to be done several times, perhaps a single vector solution should be created and only then contracted with rhs vector.
References LR::LRSolver::projectOnSubspace(), LR::LRSolver::subspaceSize, and LR::LRSolver::xSub.
Referenced by getPolarisability(), and getResidual().
void LR::SetOfEqSolver::setRHS | ( | OneElOperator & | op | ) |
initializes the rhs field
References LR::LRSolver::ao2mo(), LR::commuteWithDMO(), LR::OneElOperator::getOper(), LR::LRSolver::nbast, LR::LRSolver::nocc, rhs, and LR::VarVector::setFromFull().
Referenced by solveForRHS().
ergo_real LR::SetOfEqSolver::frequency [private] |
frequency for which the SOE is to be solved.
Referenced by getPreconditionerShift(), and getResidual().
VarVector LR::SetOfEqSolver::rhs [private] |
RHS of the SOE.
Referenced by addToSpace(), getInitialGuess(), getResidual(), and setRHS().
ergo_real* LR::SetOfEqSolver::rhsSub [protected] |
RHS vector projected onto subspace.
Referenced by addToSpace(), getResidual(), increaseSubspaceLimit(), and ~SetOfEqSolver().
ergo_real LR::SetOfEqSolver::xTimesRHS [protected] |
Referenced by getResidual().