6 #ifndef central_tprec_linop_h
7 #define central_tprec_linop_h
9 #include "qdp_config.h"
25 template<
typename T,
typename P,
typename Q>
26 class CentralTimePrecLinearOperator :
public DiffLinearOperator<T,P,Q>
30 virtual ~CentralTimePrecLinearOperator() {}
33 const Subset& subset()
const = 0;
36 virtual const FermBC<T,P,Q>& getFermBC()
const = 0;
41 virtual bool schroedingerTP()
const
45 const FermBC<T,P,Q>& fbc=getFermBC();
48 if( fbc.nontrivialP() ) {
52 const SchrFermBC& schrReference =
dynamic_cast<const SchrFermBC&
>(fbc);
54 return ( schrReference.getDir() ==
tDir() );
56 catch( std::bad_cast ) {
68 virtual int tDir()
const = 0;
103 virtual void unprecLinOp(
T&
chi,
const T&
psi,
110 T tmp1,
tmp2; moveToFastMemoryHint(tmp1); moveToFastMemoryHint(
tmp2);
119 T tmp1,
tmp2; moveToFastMemoryHint(tmp1); moveToFastMemoryHint(
tmp2);
127 QDPIO::cerr <<
"unknown sign" << std::endl;
132 getFermBC().modifyF(
chi);
140 virtual Double logDetTDagT(
void)
const = 0;
143 virtual void derivLogDetTDagT(
P& ds_u,
enum PlusMinus isign)
const = 0;
147 template<
typename T,
typename P,
typename Q>
148 class Central2TimePrecLinearOperator :
public DiffLinearOperator<T,P,Q>
152 virtual ~Central2TimePrecLinearOperator() {}
155 const Subset& subset()
const = 0;
158 virtual const FermBC<T,P,Q>& getFermBC()
const = 0;
163 virtual bool schroedingerTP()
const
167 const FermBC<T,P,Q>& fbc=getFermBC();
170 if( fbc.nontrivialP() ) {
174 const SchrFermBC& schrReference =
dynamic_cast<const SchrFermBC&
>(fbc);
176 return ( schrReference.getDir() ==
tDir() );
178 catch( std::bad_cast ) {
190 virtual int tDir()
const = 0;
221 virtual void unprecLinOp(
T&
chi,
const T&
psi,
228 T tmp1,
tmp2; moveToFastMemoryHint(tmp1); moveToFastMemoryHint(
tmp2);
237 T tmp1,
tmp2; moveToFastMemoryHint(tmp1); moveToFastMemoryHint(
tmp2);
245 QDPIO::cerr <<
"unknown sign" << std::endl;
250 getFermBC().modifyF(
chi);
302 template<
typename T,
typename P,
typename Q>
303 class UnprecSpaceCentralPrecTimeLinearOperator :
public CentralTimePrecLinearOperator<T,P,Q>
307 virtual ~UnprecSpaceCentralPrecTimeLinearOperator() {}
310 const Subset& subset()
const {
return all;}
313 virtual const FermBC<T,P,Q>& getFermBC()
const = 0;
317 virtual int tDir()
const = 0;
338 T tmp1,
tmp2; moveToFastMemoryHint(tmp1); moveToFastMemoryHint(
tmp2);
364 QDPIO::cerr <<
"unknown sign" << std::endl;
368 getFermBC().modifyF(
chi);
378 virtual Double logDetTDagT(
void)
const = 0;
381 virtual void derivLogDetTDagT(
P& ds_u,
enum PlusMinus isign)
const = 0;
440 template<
typename T,
typename P,
typename Q>
441 class ILUPrecSpaceCentralPrecTimeLinearOperator :
public CentralTimePrecLinearOperator<T,P,Q>
445 virtual ~ILUPrecSpaceCentralPrecTimeLinearOperator() {}
448 const Subset& subset()
const {
return all;}
451 virtual const FermBC<T,P,Q>& getFermBC()
const = 0;
454 virtual int tDir()
const = 0;
474 T tmp1,
tmp2; moveToFastMemoryHint(tmp1); moveToFastMemoryHint(
tmp2);
510 QDPIO::cerr <<
"unknown sign" << std::endl;
513 getFermBC().modifyF(
chi);
519 virtual void unprecLinOp(
T&
chi,
const T&
psi,
526 T tmp1,
tmp2; moveToFastMemoryHint(tmp1); moveToFastMemoryHint(
tmp2);
535 T tmp1,
tmp2; moveToFastMemoryHint(tmp1); moveToFastMemoryHint(
tmp2);
543 QDPIO::cerr <<
"unknown sign" << std::endl;
547 getFermBC().modifyF(
chi);
550 virtual void derivCLeft(
P& ds_u,
const T& X,
const T& Y,
enum PlusMinus isign)
const = 0;
552 virtual void derivCRight(
P& ds_u,
const T& X,
const T& Y,
enum PlusMinus isign)
const = 0;
554 virtual void derivAMinusOne(
P& ds_u,
const T& X,
const T& Y,
enum PlusMinus isign)
const = 0;
559 T T_1, T_2, T_3, T_4;
565 cRightLinOp(T_1, Y,
PLUS);
568 cLeftLinOp(T_2, X,
MINUS);
572 AMinusOneOp(T_3, T_2,
MINUS);
580 AMinusOneOp(T_4, T_1,
PLUS);
586 derivAMinusOne(ds_u, T_2, T_1,
PLUS);
589 derivCRight(ds_tmp, T_3, Y,
PLUS);
592 derivCLeft(ds_tmp, X, T_4,
PLUS);
599 cLeftLinOp(T_1, Y,
MINUS);
602 cRightLinOp(T_2, X,
PLUS);
605 AMinusOneOp(T_3, T_1,
MINUS);
609 AMinusOneOp(T_4, T_2,
PLUS);
613 derivAMinusOne(ds_u, T_2, T_1,
MINUS);
616 derivCLeft(ds_tmp, T_4, Y,
MINUS);
620 derivCRight(ds_tmp, X, T_3,
MINUS);
626 QDPIO::cerr <<
"Bad Case: Should never get here" << std::endl;
630 getFermBC().zero(ds_u);
634 virtual Double logDetTDagT(
void)
const = 0;
637 virtual void derivLogDetTDagT(
P& ds_u,
enum PlusMinus isign)
const = 0;
677 template<
typename T,
typename P,
typename Q>
678 class EO3DPrecSpaceCentralPrecTimeLinearOperator :
public CentralTimePrecLinearOperator<T,P,Q>
682 virtual ~EO3DPrecSpaceCentralPrecTimeLinearOperator() {}
685 const Subset& subset()
const {
return rb3[1];}
688 virtual const FermBC<T,P,Q>& getFermBC()
const = 0;
691 virtual int tDir()
const = 0;
756 T tmp1,
tmp2; moveToFastMemoryHint(tmp1); moveToFastMemoryHint(
tmp2);
791 QDPIO::cerr <<
"unknown sign" << std::endl;
795 getFermBC().modifyF(
chi, rb3[1]);
800 virtual void unprecLinOp(
T&
chi,
const T&
psi,
805 moveToFastMemoryHint(tmp1);
806 moveToFastMemoryHint(
tmp2);
807 moveToFastMemoryHint(
tmp3);
820 tmp1[rb3[0]] +=
tmp3;
842 moveToFastMemoryHint(tmp1);
843 moveToFastMemoryHint(
tmp2);
844 moveToFastMemoryHint(
tmp3);
854 tmp1[rb3[0]] +=
tmp3;
876 QDPIO::cerr <<
"unknown sign" << std::endl;
880 getFermBC().modifyF(
chi);
887 virtual Double logDetTDagT(
void)
const = 0;
890 virtual void derivLogDetTDagT(
P& ds_u,
enum PlusMinus isign)
const = 0;
908 template<
typename T,
typename P,
typename Q>
909 class ILU2PrecSpaceCentralPrecTimeLinearOperator :
public Central2TimePrecLinearOperator<T,P,Q>
913 virtual ~ILU2PrecSpaceCentralPrecTimeLinearOperator() {}
916 const Subset& subset()
const {
return all;}
919 virtual const FermBC<T,P,Q>& getFermBC()
const = 0;
922 virtual int tDir()
const = 0;
953 cRightLinOp(
chi, tmp1,
PLUS, 0);
954 cRightLinOp(
chi, tmp1,
PLUS, 1);
1013 T tmp1,
tmp2,
tmp3; moveToFastMemoryHint(tmp1); moveToFastMemoryHint(
tmp2);
1033 chi[rb3[1]] += tmp1;
1055 chi[rb3[1]] += tmp1;
1060 QDPIO::cerr <<
"unknown sign" << std::endl;
1063 getFermBC().modifyF(
chi);
1069 virtual void unprecLinOp(
T&
chi,
const T&
psi,
1076 T tmp1,
tmp2; moveToFastMemoryHint(tmp1); moveToFastMemoryHint(
tmp2);
1084 T tmp1,
tmp2; moveToFastMemoryHint(tmp1); moveToFastMemoryHint(
tmp2);
1092 QDPIO::cerr <<
"unknown sign" << std::endl;
1096 getFermBC().modifyF(
chi);
1116 cRightLinOp(tmp1,
psi,
PLUS, (1-cb3d));
1121 cLeftLinOp(tmp1,
psi,
MINUS, 1-cb3d);
1132 cRightLinOp(tmp1,
psi,
PLUS, cb3d);
1137 cLeftLinOp(tmp1,
psi,
MINUS, cb3d);
1149 QDPIO::cerr <<
"Not Yet Implemented " << std::endl;
1155 virtual Double logDetTDagT(
void)
const
1157 QDPIO::cerr <<
"Not Yet Implemented " << std::endl;
1166 QDPIO::cerr<<
"Not Yet Implemented" << std::endl;
multi1d< Hadron2PtContraction_t > operator()(const multi1d< LatticeColorMatrix > &u)
Asqtad Staggered-Dirac operator.
multi1d< LatticeFermion > chi(Ncb)
FloatingPoint< double > Double
Fermion action boundary conditions.
multi1d< LatticeColorMatrix > P
multi1d< LatticeColorMatrix > deriv(const EvenOddPrecLinearOperator< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > &AP, const LatticeFermion &chi, const LatticeFermion &psi, enum PlusMinus isign)
Apply the operator onto a source std::vector.