2015-05-18 07:47:05 +01:00
|
|
|
#ifndef GRID_NORMAL_EQUATIONS_H
|
|
|
|
#define GRID_NORMAL_EQUATIONS_H
|
|
|
|
|
|
|
|
namespace Grid {
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
2015-06-05 05:31:27 +01:00
|
|
|
// Take a matrix and form an NE solver calling a Herm solver
|
2015-05-18 07:47:05 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
template<class Field> class NormalEquations : public OperatorFunction<Field>{
|
|
|
|
private:
|
|
|
|
SparseMatrixBase<Field> & _Matrix;
|
|
|
|
OperatorFunction<Field> & _HermitianSolver;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////
|
2015-06-05 05:31:27 +01:00
|
|
|
// Wrap the usual normal equations trick
|
2015-05-18 07:47:05 +01:00
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
NormalEquations(SparseMatrixBase<Field> &Matrix, OperatorFunction<Field> &HermitianSolver)
|
|
|
|
: _Matrix(Matrix), _HermitianSolver(HermitianSolver) {};
|
|
|
|
|
|
|
|
void operator() (const Field &in, Field &out){
|
|
|
|
|
|
|
|
Field src(in._grid);
|
|
|
|
|
|
|
|
_Matrix.Mdag(in,src);
|
|
|
|
_HermitianSolver(src,out); // Mdag M out = Mdag in
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|