mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-09 23:45:36 +00:00
Fixed compile issues with maxLocalNorm2 for non-scalar lattices
maxLocalNorm2 test now reuses the random field
This commit is contained in:
parent
eda9ab487b
commit
55de69a569
@ -166,11 +166,12 @@ template<class vobj> inline RealD norm2(const Lattice<vobj> &arg){
|
|||||||
ComplexD nrm = innerProduct(arg,arg);
|
ComplexD nrm = innerProduct(arg,arg);
|
||||||
return real(nrm);
|
return real(nrm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//The global maximum of the site norm2
|
||||||
template<class vobj> inline RealD maxLocalNorm2(const Lattice<vobj> &arg)
|
template<class vobj> inline RealD maxLocalNorm2(const Lattice<vobj> &arg)
|
||||||
{
|
{
|
||||||
typedef typename vobj::tensor_reduced vscalar;
|
typedef typename vobj::tensor_reduced vscalar; //iScalar<iScalar<.... <vPODtype> > >
|
||||||
typedef typename vobj::scalar_object scalar;
|
typedef typename vscalar::scalar_object scalar; //iScalar<iScalar<.... <PODtype> > >
|
||||||
typedef typename getPrecision<vobj>::real_scalar_type rscalar;
|
|
||||||
|
|
||||||
Lattice<vscalar> inner = localNorm2(arg);
|
Lattice<vscalar> inner = localNorm2(arg);
|
||||||
|
|
||||||
|
@ -232,12 +232,13 @@ int main(int argc, char **argv) {
|
|||||||
scalar = localNorm2(cVec);
|
scalar = localNorm2(cVec);
|
||||||
|
|
||||||
std::cout << "Testing maxLocalNorm2" <<std::endl;
|
std::cout << "Testing maxLocalNorm2" <<std::endl;
|
||||||
for(Integer gsite=0;gsite<Fine.gSites();gsite++){
|
|
||||||
|
LatticeComplex rand_scalar(&Fine);
|
||||||
|
random(FineRNG, rand_scalar); //uniform [0,1]
|
||||||
|
for(Integer gsite=0;gsite<Fine.gSites();gsite++){ //check on every site independently
|
||||||
|
scalar = rand_scalar;
|
||||||
TComplex big(10.0);
|
TComplex big(10.0);
|
||||||
Coordinate coor;
|
Coordinate coor;
|
||||||
|
|
||||||
random(FineRNG, scalar);
|
|
||||||
Fine.GlobalIndexToGlobalCoor(gsite,coor);
|
Fine.GlobalIndexToGlobalCoor(gsite,coor);
|
||||||
pokeSite(big,scalar,coor);
|
pokeSite(big,scalar,coor);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user