30 namespace UnprecOvlapContFrac5DFermActArrayEnv
34 multi1d<LatticeColorMatrix>,
45 multi1d<LatticeColorMatrix>,
76 XMLReader
in(xml, path);
79 if(
in.count(
"AuxFermAct") == 1 ) {
80 XMLReader xml_tmp(
in,
"AuxFermAct");
81 std::ostringstream os;
92 if(
in.count(
"ApproximationType") == 1 )
113 QDPIO::cerr <<
"Caught Exception reading unprec ContFrac Fermact params: " << e << std::endl;
129 push( xml_out, path);
132 xml_out <<
p.AuxFermAct;
133 write(xml_out,
"Mass",
p.Mass);
134 write(xml_out,
"RatPolyDeg",
p.RatPolyDeg);
135 write(xml_out,
"ApproximationType",
p.approximation_type);
136 write(xml_out,
"ApproxMin",
p.ApproxMin);
137 write(xml_out,
"ApproxMax",
p.ApproxMax);
153 fbc(fbc_),
params(params_)
158 if (
fbc.operator->() == 0)
175 if( isEvenRatPolyDeg ) {
188 XMLReader fermacttop(xml_s);
192 struct UnprecCastFailure {
193 UnprecCastFailure(
std::string e) : auxfermact(e) {};
199 read(fermacttop, fermact_path +
"/FermAct", auxfermact);
200 QDPIO::cout <<
"AuxFermAct: " << auxfermact << std::endl;
213 if( S_aux_ptr == 0 )
throw UnprecCastFailure(auxfermact);
220 catch(
const UnprecCastFailure& e)
223 QDPIO::cerr <<
"Unable to upcast auxiliary fermion action to "
224 <<
"UnprecWilsonTypeFermAct " << std::endl;
226 <<
"auxiliary FermActs" << std::endl;
227 QDPIO::cerr <<
"You passed : " << std::endl;
228 QDPIO::cerr << e.auxfermact << std::endl;
231 catch (
const std::exception& e)
234 QDPIO::cerr <<
"Error reading data: " << e.what() << std::endl;
239 QDPIO::cerr <<
"Caught Exception" << e << std::endl;
247 multi1d<Real>&
alpha,
250 multi1d<Real>& EigValFunc,
253 int NEigVal =
state.getEigVal().size();
262 zolotarev_data *rdata;
271 epsilon = approxMin / approxMax;
272 QDPIO::cout <<
"Initing Linop with Zolotarev Coefficients: epsilon = " <<
epsilon << std::endl;
274 scale_fac = Real(1) / approxMax;
279 QDPIO::cout <<
"Initing Linop with Higham Rep tanh Coefficients" << std::endl;
292 Real maxerr = (Real)(rdata->Delta);
295 if(
N5 != rdata->db ) {
296 QDPIO::cerr <<
"Mismatch between N5 and N5 from Coefficient Code" << std::endl;
297 QDPIO::cerr <<
"N5 = " <<
N5 <<
" rdata->db=" << rdata->db << std::endl;
303 for(
int i = 0;
i <
N5;
i++) {
308 for(
int i=0;
i <
N5-1;
i++) {
320 multi1d<Real> gamma(
N5-1);
321 for(
int i=0;
i <
N5-1;
i++) {
322 gamma[
i] = Real(1)/ sqrt(
beta[
i] );
329 for(
int i=0;
i <
N5-1;
i++) {
336 for(
int i=0;
i <
N5-2;
i++) {
342 QDPIO::cout <<
"UnprecOvlapContfrac5d: " << std::endl
344 <<
" N5=" <<
N5 <<
" scale=" << scale_fac
345 <<
" Nwils = " << NEigVal <<
" Mass=" <<
params.
Mass << std::endl ;
346 QDPIO::cout <<
"Approximation on [-1,eps] U [eps,1] with eps = " <<
epsilon <<std::endl;
348 QDPIO::cout <<
"Maximum error | R(x) - sgn(x) | <= Delta = " << maxerr << std::endl;
360 QDPIO::cout <<
"Coefficients from Zolotarev" << std::endl;
363 QDPIO::cout <<
"Approximation type " << type <<
" with R(0) = 0"
367 QDPIO::cout <<
"Approximation type " << type <<
" with R(0) = infinity" << std::endl;
372 QDPIO::cout <<
"Coefficients from Higham Tanh representation" << std::endl;
375 QDPIO::cout <<
"Coefficients from Unscaled Higham Tanh representation" << std::endl;
386 for(
int i=0;
i < NEigVal;
i++) {
387 if( toBool(
state.getEigVal()[
i] > Real(0) ) ) {
388 EigValFunc[
i] = Real(1);
390 else if( toBool(
state.getEigVal()[
i] < Real(0) ) ) {
391 EigValFunc[
i] = Real(-1);
412 multi1d<LatticeColorMatrix>,
413 multi1d<LatticeColorMatrix> >*
424 if (
state.getEigVec().size() !=
state.getEigVal().size()) {
425 QDPIO::cerr <<
"UnprecOvlapContFrac5DFermActArray::linOp(): ";
426 QDPIO::cerr <<
"UnprecOvlapContFrac5DFermActArray: inconsistent sizes of eigenvectors and values"
427 <<
"state.getEigVec.size() = " <<
state.getEigVec().size()
428 <<
" state.getEigVal.size() = " <<
state.getEigVal().size()
433 int NEigVal =
state.getEigVal().size();
439 multi1d<Real> EigValFunc(NEigVal);
456 catch( std::bad_cast )
458 QDPIO::cerr <<
"UnprecOvlapContFrac5DFermActArray::linOp(): ";
459 QDPIO::cerr <<
"Couldnt cast FermState<T,P,Q> to OverlapFermState<T,P,Q> "
476 multi1d<LatticeColorMatrix>,
477 multi1d<LatticeColorMatrix> >*
488 if (
state.getEigVec().size() !=
state.getEigVal().size()) {
489 QDPIO::cerr <<
"UnprecOvlapContFrac5DFermActArray::linOp(): ";
490 QDPIO::cerr <<
"UnprecOvlapContFrac5DFermActArray: inconsistent sizes of eigenvectors and values"
491 <<
"state.getEigVec.size() = " <<
state.getEigVec().size()
492 <<
" state.getEigVal.size() = " <<
state.getEigVal().size()
497 int NEigVal =
state.getEigVal().size();
503 multi1d<Real> EigValFunc(NEigVal);
520 catch( std::bad_cast ) {
521 QDPIO::cerr <<
"UnprecOvlapContFrac5DFermActArray::linOp(): ";
522 QDPIO::cerr <<
"Couldnt cast FermState<T,P,Q> to OverlapFermState<T,P,Q> "
548 if (
state.getEigVec().size() !=
state.getEigVal().size()) {
549 QDPIO::cerr <<
"UnprecOvlapContFrac5DFermActArray::lnonHermLinOp(): ";
550 QDPIO::cerr <<
"UnprecOvlapContFrac5DFermActArray: inconsistent sizes of eigenvectors and values"
551 <<
"state.getEigVec.size() = " <<
state.getEigVec().size()
552 <<
" state.getEigVal.size() = " <<
state.getEigVal().size()
558 int NEigVal =
state.getEigVal().size();
564 multi1d<Real> EigValFunc(NEigVal);
579 catch( std::bad_cast )
581 QDPIO::cerr <<
"UnprecOvlapContFrac5DFermActArray::lnonHermLinOp(): ";
582 QDPIO::cerr <<
"Couldnt cast FermState<T,P,Q> to OverlapConnectState "
627 const Subset&
subset()
const {
return all;}
640 const int N5 =
A->size();
645 multi1d<LatticeFermion> chi5(
N5);
646 multi1d<LatticeFermion> psi5(
N5);
658 multi1d<LatticeFermion> tmp5(
N5);
661 for(
int i=0;
i <
N5;
i++) {
672 (*A)(tmp5, chi5,
MINUS);
693 res.
resid = sqrt(norm2(
r));
701 psi5[
N5-1] *= Real(2)/(Real(1)-
Mass);
730 std::istringstream is(invParam.
xml);
731 XMLReader paramtop(is);
748 QDPIO::cerr <<
"Caught Exception: " << e << std::endl;
759 const Real& approxMin_)
const
765 QDPIO::cerr <<
"Caught Exception: " << e << std::endl;
775 const Real& approxMin_,
776 const Real& approxMax_)
const
782 QDPIO::cerr <<
"Caught Exception: " << e << std::endl;
792 const multi1d<Real>& lambda_lo_,
793 const multi1d<LatticeFermion>& evecs_lo_,
794 const Real& lambda_hi_)
const
800 QDPIO::cerr <<
"Caught Exception: " << e << std::endl;
810 XMLReader& state_info_xml,
821 QDPIO::cerr <<
"Caught Exception: " << e << std::endl;
841 QDPIO::cerr <<
"Caught Exception: " << e << std::endl;
Primary include file for CHROMA library code.
Create a simple ferm connection state.
Base class for all fermion action boundary conditions.
Support class for fermion actions and linear operators.
Base class for quadratic matter actions (e.g., fermions)
Class for counted reference semantics.
Linear Operator to arrays.
M^dag.M linear operator over arrays.
Propagator of an un-preconditioned Extended-Overlap linear operator.
const Subset & subset() const
Return the subset on which the operator acts.
OvUnprecCF5DQprop(Handle< LinearOperatorArray< T > > A_, const Real &Mass_, const SysSolverCGParams &invParam_)
Constructor.
Handle< LinearOperatorArray< T > > A
SysSolverCGParams invParam
~OvUnprecCF5DQprop()
Destructor is automatic.
SystemSolverResults_t operator()(T &psi, const T &chi) const
Solver the linear system.
Overlap connection state.
Simple version of FermState.
Unpreconditioned linear operator including derivatives.
5D continued fraction overlap action (Borici,Wenger, Edwards)
OverlapConnectState * createState(const multi1d< LatticeColorMatrix > &u, XMLReader &state_info_xml, const std::string &state_info_path) const
Create OverlapConnectState from XML.
Handle< UnprecWilsonTypeFermAct< T, P, Q > > S_aux
UnprecLinearOperatorArray< T, P, Q > * linOp(Handle< FermState< T, P, Q > > state) const
Produce a linear operator for this action.
Handle< FermBC< T, P, Q > > fbc
LinearOperatorArray< T > * lnonHermMdagM(Handle< FermState< T, P, Q > > state) const
Produce a linear operator M^dag.M for this action.
Handle< CreateFermState< T, P, Q > > cfs
LinearOperatorArray< T > * lnonHermLinOp(Handle< FermState< T, P, Q > > state) const
Produce a linear operator for this action.
UnprecOvlapContFrac5DFermActParams params
Real getQuarkMass() const
Return the quark mass.
void init(Real &scale_fac, multi1d< Real > &alpha, multi1d< Real > &beta, int &NEig, multi1d< Real > &EigValFunc, const OverlapConnectState &state) const
Helper in construction.
UnprecLinearOperatorArray< T, P, Q > * linOpPV(Handle< FermState< T, P, Q > > state) const
Produce a Pauli-Villars linear operator for this action.
UnprecOvlapContFrac5DFermActArray()
SystemSolver< LatticeFermion > * qprop(Handle< FermState< T, P, Q > > state, const GroupXML_t &invParam) const
Compute quark propagator over base type.
Unpreconditioned Extended-Overlap (N&N) linear operator.
Unpreconditioned Extended-Overlap (N&N) linear operator.
Unpreconditioned Pauli-Villars Continued Fraction 5D.
Unpreconditioned Wilson-like fermion actions with derivatives.
Wilson-like fermion actions.
Fermion action factories.
Fermionic boundary condition reader.
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams ¶m)
Read parameters.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams ¶m)
Writer parameters.
Handle< FermBC< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > > reader(XMLReader &xml_in, const std::string &path)
Helper function for the FermionAction readers.
SystemSolverResults_t InvCG2(const LinearOperator< LatticeFermionF > &M, const LatticeFermionF &chi, LatticeFermionF &psi, const Real &RsdCG, int MaxCG)
Conjugate-Gradient (CGNE) algorithm for a generic Linear Operator.
@ COEFF_TYPE_TANH_UNSCALED
Conjugate-Gradient algorithm for a generic Linear Operator.
int epsilon(int i, int j, int k)
static const LatticeInteger & beta(const int dim)
static const LatticeInteger & alpha(const int dim)
static bool registered
Local registration flag.
bool registerAll()
Register all the factories.
WilsonTypeFermAct5D< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > * createFermAct5D(XMLReader &xml_in, const std::string &path)
Callback function.
const std::string name
Name to be used.
FermionAction< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > * createFermAct(XMLReader &xml_in, const std::string &path)
Callback function.
Asqtad Staggered-Dirac operator.
QDP_error_exit("too many BiCG iterations", n_count, rsd_sq, cp, c, re_rvr, im_rvr, re_a, im_a, re_b, im_b)
push(xml_out,"Condensates")
LinOpSysSolverMGProtoClover::T T
multi1d< LatticeFermion > chi(Ncb)
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
const WilsonTypeFermAct< multi1d< LatticeFermion > > & S_f
static QDP_ColorVector * in
Simple ferm state and a creator.
Hold group xml and type id.
Holds return info from SystemSolver call.
Params for 5D overlap ferm acts.
CoeffType approximation_type
ZOLOTAREV | TANH | Other approximation coeffs.
Real ApproxMin
Approximate min eigenvalue of H_T.
int RatPolyDeg
Degree of the Rational Poly.
std::string AuxFermAct
The auxiliary ferm act.
UnprecOvlapContFrac5DFermActParams()
Default empty construction.
Real ApproxMax
Approximate max eigenvalue of H_T.
Unpreconditioned extended-Overlap (5D) (Naryanan&Neuberger) action.
Unpreconditioned extended-Overlap (5D) (Naryanan&Neuberger) linear operator.
Unpreconditioned extended-Overlap (5D) (Naryanan&Neuberger) linear operator.
Unpreconditioned Pauli-Villars Continued Fraction 5D.
Unpreconditioned Wilson fermion action.
void zolotarev_free(ZOLOTAREV_DATA *f)
ZOLOTAREV_DATA * higham(PRECISION epsilon, int n)
ZOLOTAREV_DATA * zolotarev(PRECISION epsilon, int n, int type)