diff --git a/lib/algorithms/CoarsenedMatrix.h b/lib/algorithms/CoarsenedMatrix.h index 006da07f..ba417be3 100644 --- a/lib/algorithms/CoarsenedMatrix.h +++ b/lib/algorithms/CoarsenedMatrix.h @@ -11,7 +11,6 @@ namespace Grid { int npoint; std::vector directions ; std::vector displacements; - std::vector opdirs; // FIXME -- don't like xposing the operator directions // as different to the geometrical dirs @@ -26,18 +25,22 @@ namespace Grid { npoint = 2*_d+1; directions.resize(npoint); displacements.resize(npoint); - opdirs.resize(npoint); for(int d=0;d<_d;d++){ directions[2*d ] = d+base; directions[2*d+1] = d+base; - opdirs[2*d ] = d; - opdirs[2*d+1] = d; displacements[2*d ] = +1; displacements[2*d+1] = -1; } directions [2*_d]=0; displacements[2*_d]=0; - opdirs [2*_d]=0; + + //// report back + std::cout<<"directions :"; + for(int d=0;d - class CoarsenedMatrix : public SparseMatrixBase > > { + class CoarsenedMatrix : public SparseMatrixBase > > { public: - typedef iVector siteVector; - typedef Lattice > CoarseVector; - typedef Lattice > CoarseMatrix; + typedef iVector siteVector; + typedef Lattice CoarseVector; + typedef Lattice > CoarseMatrix; typedef Lattice< CComplex > CoarseScalar; // used for inner products on fine field typedef Lattice FineField; @@ -82,7 +85,6 @@ namespace Grid { CartesianStencil Stencil; std::vector A; - std::vector Aslow; std::vector > comm_buf; @@ -91,25 +93,28 @@ namespace Grid { /////////////////////// GridBase * Grid(void) { return _grid; }; // this is all the linalg routines need to know - RealD M (const CoarseVector &in, CoarseVector &out){ - + RealD M (const CoarseVector &in, CoarseVector &out){ + + conformable(_grid,in._grid); + conformable(in._grid,out._grid); + SimpleCompressor compressor; Stencil.HaloExchange(in,comm_buf,compressor); -PARALLEL_FOR_LOOP + //PARALLEL_FOR_LOOP for(int ss=0;ssoSites();ss++){ siteVector res = zero; - siteVector tmp; siteVector nbr; + int offset,local,perm,ptype; - int offset,local,perm; for(int point=0;point_rdimensions[dir])/(Grid()->_rdimensions[dir]); @@ -187,7 +191,7 @@ PARALLEL_FOR_LOOP linop.OpDiag(phi,Mphi); } else { - linop.OpDir(phi,Mphi,opdir,disp); + linop.OpDir(phi,Mphi,dir,disp); } //////////////////////////////////////////////////////////////////////// @@ -240,6 +244,62 @@ PARALLEL_FOR_LOOP std::cout<< iProj < > val(Grid()); random(RNG,val); + + Complex one(1.0); + + iMatrix ident; ident=one; + + val = val*adj(val); + val = val + 1.0; + + A[8] = val*ident; + + // for(int s=0;soSites();s++) { + // A[8]._odata[s]=val._odata[s]; + // } + } + void ForceHermitian(void) { + for(int d=0;d<4;d++){ + int dd=d+1; + A[2*d] = adj(Cshift(A[2*d+1],dd,1)); + } + A[8] = 0.5*(A[8] + adj(A[8])); + } + void AssertHermitian(void) { + CoarseMatrix AA (Grid()); + CoarseMatrix AAc (Grid()); + CoarseMatrix Diff (Grid()); + for(int d=0;d<4;d++){ + + int dd=d+1; + AAc = Cshift(A[2*d+1],dd,1); + AA = A[2*d]; + + Diff = AA - adj(AAc); + + std::cout<<"Norm diff dim "<