mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 07:55:35 +00:00
Added support for Ta to Lattice types
This commit is contained in:
parent
bb73569fd6
commit
949b6a7afa
@ -48,5 +48,16 @@ PARALLEL_FOR_LOOP
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class vobj> inline auto Ta(const Lattice<vobj> &z) -> Lattice<decltype(Ta(z._odata[0]))>
|
||||||
|
{
|
||||||
|
Lattice<decltype(Ta(z._odata[0]))> ret(z._grid);
|
||||||
|
PARALLEL_FOR_LOOP
|
||||||
|
for(int ss=0;ss<z._grid->oSites();ss++){
|
||||||
|
ret._odata[ss] = Ta(z._odata[ss]);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,10 +5,10 @@ namespace Grid {
|
|||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// Ta function for scalar, vector, matrix
|
// Ta function for scalar, vector, matrix
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
/* inline ComplexF Ta( const ComplexF &arg){ return arg;} */
|
inline ComplexF Ta( const ComplexF &arg){ return arg;}
|
||||||
/* inline ComplexD Ta( const ComplexD &arg){ return arg;} */
|
inline ComplexD Ta( const ComplexD &arg){ return arg;}
|
||||||
/* inline RealF Ta( const RealF &arg){ return arg;} */
|
inline RealF Ta( const RealF &arg){ return arg;}
|
||||||
/* inline RealD Ta( const RealD &arg){ return arg;} */
|
inline RealD Ta( const RealD &arg){ return arg;}
|
||||||
|
|
||||||
|
|
||||||
template<class vtype> inline iScalar<vtype> Ta(const iScalar<vtype>&r)
|
template<class vtype> inline iScalar<vtype> Ta(const iScalar<vtype>&r)
|
||||||
@ -28,8 +28,13 @@ namespace Grid {
|
|||||||
template<class vtype,int N> inline iMatrix<vtype,N> Ta(const iMatrix<vtype,N> &arg)
|
template<class vtype,int N> inline iMatrix<vtype,N> Ta(const iMatrix<vtype,N> &arg)
|
||||||
{
|
{
|
||||||
iMatrix<vtype,N> ret(arg);
|
iMatrix<vtype,N> ret(arg);
|
||||||
vtype factor = (1/(double)N);
|
double factor = (1/(double)N);
|
||||||
ret = (ret - adj(arg))*0.5;
|
for(int c1=0;c1<N;c1++){
|
||||||
|
for(int c2=0;c2<N;c2++){
|
||||||
|
ret._internal[c1][c2]= (ret._internal[c1][c2] - adj(arg._internal[c2][c1]));
|
||||||
|
ret._internal[c1][c2] *= 0.5;
|
||||||
|
}}
|
||||||
|
//ret = (ret - adj(arg))*0.5;
|
||||||
ret -= trace(ret)*factor;
|
ret -= trace(ret)*factor;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,9 @@ int main (int argc, char ** argv)
|
|||||||
cMat = outerProduct(cVec,cVec);
|
cMat = outerProduct(cVec,cVec);
|
||||||
scalar = localInnerProduct(cVec,cVec);
|
scalar = localInnerProduct(cVec,cVec);
|
||||||
|
|
||||||
|
cMat = Ta(cMat); //traceless antihermitian
|
||||||
|
|
||||||
|
|
||||||
scalar += scalar;
|
scalar += scalar;
|
||||||
scalar -= scalar;
|
scalar -= scalar;
|
||||||
scalar *= scalar;
|
scalar *= scalar;
|
||||||
@ -214,13 +216,12 @@ int main (int argc, char ** argv)
|
|||||||
scm=transposeIndex<1>(scm);
|
scm=transposeIndex<1>(scm);
|
||||||
|
|
||||||
|
|
||||||
random(SerialRNG, cm);
|
//random(SerialRNG, cm);
|
||||||
std::cout << cm << std::endl;
|
//std::cout << cm << std::endl;
|
||||||
|
|
||||||
cm = Ta(cm);
|
cm = Ta(cm);
|
||||||
//cm = adj(cm);
|
//TComplex tracecm= trace(cm);
|
||||||
TComplex tracecm= trace(cm);
|
//std::cout << cm << " "<< tracecm << std::endl;
|
||||||
std::cout << cm << " "<< tracecm << std::endl;
|
|
||||||
|
|
||||||
|
|
||||||
// Foo = Foo+scalar; // LatticeColourMatrix+Scalar
|
// Foo = Foo+scalar; // LatticeColourMatrix+Scalar
|
||||||
|
Loading…
Reference in New Issue
Block a user