mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-27 22:25:56 +01:00
Namespace and indentation
This commit is contained in:
parent
550b905bb8
commit
8c675064bd
@ -1,4 +1,4 @@
|
|||||||
/*************************************************************************************
|
/*************************************************************************************
|
||||||
|
|
||||||
Grid physics library, www.github.com/paboyle/Grid
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
@ -23,19 +23,18 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
|||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
See the full license in the file "LICENSE" in the top level distribution directory
|
See the full license in the file "LICENSE" in the top level distribution directory
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
/* END LEGAL */
|
/* END LEGAL */
|
||||||
#ifndef GRID_LATTICE_ARITH_H
|
#ifndef GRID_LATTICE_ARITH_H
|
||||||
#define GRID_LATTICE_ARITH_H
|
#define GRID_LATTICE_ARITH_H
|
||||||
|
|
||||||
namespace Grid {
|
NAMESPACE_BEGIN(Grid);
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
// avoid copy back routines for mult, mac, sub, add
|
||||||
// avoid copy back routines for mult, mac, sub, add
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
template<class obj1,class obj2,class obj3> strong_inline
|
||||||
template<class obj1,class obj2,class obj3> strong_inline
|
void mult(Lattice<obj1> &ret,const Lattice<obj2> &lhs,const Lattice<obj3> &rhs){
|
||||||
void mult(Lattice<obj1> &ret,const Lattice<obj2> &lhs,const Lattice<obj3> &rhs){
|
|
||||||
ret.checkerboard = lhs.checkerboard;
|
ret.checkerboard = lhs.checkerboard;
|
||||||
conformable(ret,rhs);
|
conformable(ret,rhs);
|
||||||
conformable(lhs,rhs);
|
conformable(lhs,rhs);
|
||||||
@ -48,10 +47,10 @@ namespace Grid {
|
|||||||
mult(&ret._odata[ss],&lhs._odata[ss],&rhs._odata[ss]);
|
mult(&ret._odata[ss],&lhs._odata[ss],&rhs._odata[ss]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class obj1,class obj2,class obj3> strong_inline
|
template<class obj1,class obj2,class obj3> strong_inline
|
||||||
void mac(Lattice<obj1> &ret,const Lattice<obj2> &lhs,const Lattice<obj3> &rhs){
|
void mac(Lattice<obj1> &ret,const Lattice<obj2> &lhs,const Lattice<obj3> &rhs){
|
||||||
ret.checkerboard = lhs.checkerboard;
|
ret.checkerboard = lhs.checkerboard;
|
||||||
conformable(ret,rhs);
|
conformable(ret,rhs);
|
||||||
conformable(lhs,rhs);
|
conformable(lhs,rhs);
|
||||||
@ -64,10 +63,10 @@ namespace Grid {
|
|||||||
mac(&ret._odata[ss],&lhs._odata[ss],&rhs._odata[ss]);
|
mac(&ret._odata[ss],&lhs._odata[ss],&rhs._odata[ss]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class obj1,class obj2,class obj3> strong_inline
|
template<class obj1,class obj2,class obj3> strong_inline
|
||||||
void sub(Lattice<obj1> &ret,const Lattice<obj2> &lhs,const Lattice<obj3> &rhs){
|
void sub(Lattice<obj1> &ret,const Lattice<obj2> &lhs,const Lattice<obj3> &rhs){
|
||||||
ret.checkerboard = lhs.checkerboard;
|
ret.checkerboard = lhs.checkerboard;
|
||||||
conformable(ret,rhs);
|
conformable(ret,rhs);
|
||||||
conformable(lhs,rhs);
|
conformable(lhs,rhs);
|
||||||
@ -80,9 +79,9 @@ namespace Grid {
|
|||||||
sub(&ret._odata[ss],&lhs._odata[ss],&rhs._odata[ss]);
|
sub(&ret._odata[ss],&lhs._odata[ss],&rhs._odata[ss]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
template<class obj1,class obj2,class obj3> strong_inline
|
template<class obj1,class obj2,class obj3> strong_inline
|
||||||
void add(Lattice<obj1> &ret,const Lattice<obj2> &lhs,const Lattice<obj3> &rhs){
|
void add(Lattice<obj1> &ret,const Lattice<obj2> &lhs,const Lattice<obj3> &rhs){
|
||||||
ret.checkerboard = lhs.checkerboard;
|
ret.checkerboard = lhs.checkerboard;
|
||||||
conformable(ret,rhs);
|
conformable(ret,rhs);
|
||||||
conformable(lhs,rhs);
|
conformable(lhs,rhs);
|
||||||
@ -95,13 +94,13 @@ namespace Grid {
|
|||||||
add(&ret._odata[ss],&lhs._odata[ss],&rhs._odata[ss]);
|
add(&ret._odata[ss],&lhs._odata[ss],&rhs._odata[ss]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// avoid copy back routines for mult, mac, sub, add
|
// avoid copy back routines for mult, mac, sub, add
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
template<class obj1,class obj2,class obj3> strong_inline
|
template<class obj1,class obj2,class obj3> strong_inline
|
||||||
void mult(Lattice<obj1> &ret,const Lattice<obj2> &lhs,const obj3 &rhs){
|
void mult(Lattice<obj1> &ret,const Lattice<obj2> &lhs,const obj3 &rhs){
|
||||||
ret.checkerboard = lhs.checkerboard;
|
ret.checkerboard = lhs.checkerboard;
|
||||||
conformable(lhs,ret);
|
conformable(lhs,ret);
|
||||||
parallel_for(int ss=0;ss<lhs._grid->oSites();ss++){
|
parallel_for(int ss=0;ss<lhs._grid->oSites();ss++){
|
||||||
@ -109,10 +108,10 @@ namespace Grid {
|
|||||||
mult(&tmp,&lhs._odata[ss],&rhs);
|
mult(&tmp,&lhs._odata[ss],&rhs);
|
||||||
vstream(ret._odata[ss],tmp);
|
vstream(ret._odata[ss],tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class obj1,class obj2,class obj3> strong_inline
|
template<class obj1,class obj2,class obj3> strong_inline
|
||||||
void mac(Lattice<obj1> &ret,const Lattice<obj2> &lhs,const obj3 &rhs){
|
void mac(Lattice<obj1> &ret,const Lattice<obj2> &lhs,const obj3 &rhs){
|
||||||
ret.checkerboard = lhs.checkerboard;
|
ret.checkerboard = lhs.checkerboard;
|
||||||
conformable(ret,lhs);
|
conformable(ret,lhs);
|
||||||
parallel_for(int ss=0;ss<lhs._grid->oSites();ss++){
|
parallel_for(int ss=0;ss<lhs._grid->oSites();ss++){
|
||||||
@ -120,10 +119,10 @@ namespace Grid {
|
|||||||
mac(&tmp,&lhs._odata[ss],&rhs);
|
mac(&tmp,&lhs._odata[ss],&rhs);
|
||||||
vstream(ret._odata[ss],tmp);
|
vstream(ret._odata[ss],tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class obj1,class obj2,class obj3> strong_inline
|
template<class obj1,class obj2,class obj3> strong_inline
|
||||||
void sub(Lattice<obj1> &ret,const Lattice<obj2> &lhs,const obj3 &rhs){
|
void sub(Lattice<obj1> &ret,const Lattice<obj2> &lhs,const obj3 &rhs){
|
||||||
ret.checkerboard = lhs.checkerboard;
|
ret.checkerboard = lhs.checkerboard;
|
||||||
conformable(ret,lhs);
|
conformable(ret,lhs);
|
||||||
parallel_for(int ss=0;ss<lhs._grid->oSites();ss++){
|
parallel_for(int ss=0;ss<lhs._grid->oSites();ss++){
|
||||||
@ -135,9 +134,9 @@ namespace Grid {
|
|||||||
sub(&ret._odata[ss],&lhs._odata[ss],&rhs);
|
sub(&ret._odata[ss],&lhs._odata[ss],&rhs);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
template<class obj1,class obj2,class obj3> strong_inline
|
template<class obj1,class obj2,class obj3> strong_inline
|
||||||
void add(Lattice<obj1> &ret,const Lattice<obj2> &lhs,const obj3 &rhs){
|
void add(Lattice<obj1> &ret,const Lattice<obj2> &lhs,const obj3 &rhs){
|
||||||
ret.checkerboard = lhs.checkerboard;
|
ret.checkerboard = lhs.checkerboard;
|
||||||
conformable(lhs,ret);
|
conformable(lhs,ret);
|
||||||
parallel_for(int ss=0;ss<lhs._grid->oSites();ss++){
|
parallel_for(int ss=0;ss<lhs._grid->oSites();ss++){
|
||||||
@ -149,13 +148,13 @@ namespace Grid {
|
|||||||
add(&ret._odata[ss],&lhs._odata[ss],&rhs);
|
add(&ret._odata[ss],&lhs._odata[ss],&rhs);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// avoid copy back routines for mult, mac, sub, add
|
// avoid copy back routines for mult, mac, sub, add
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
template<class obj1,class obj2,class obj3> strong_inline
|
template<class obj1,class obj2,class obj3> strong_inline
|
||||||
void mult(Lattice<obj1> &ret,const obj2 &lhs,const Lattice<obj3> &rhs){
|
void mult(Lattice<obj1> &ret,const obj2 &lhs,const Lattice<obj3> &rhs){
|
||||||
ret.checkerboard = rhs.checkerboard;
|
ret.checkerboard = rhs.checkerboard;
|
||||||
conformable(ret,rhs);
|
conformable(ret,rhs);
|
||||||
parallel_for(int ss=0;ss<rhs._grid->oSites();ss++){
|
parallel_for(int ss=0;ss<rhs._grid->oSites();ss++){
|
||||||
@ -167,10 +166,10 @@ namespace Grid {
|
|||||||
mult(&ret._odata[ss],&lhs,&rhs._odata[ss]);
|
mult(&ret._odata[ss],&lhs,&rhs._odata[ss]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class obj1,class obj2,class obj3> strong_inline
|
template<class obj1,class obj2,class obj3> strong_inline
|
||||||
void mac(Lattice<obj1> &ret,const obj2 &lhs,const Lattice<obj3> &rhs){
|
void mac(Lattice<obj1> &ret,const obj2 &lhs,const Lattice<obj3> &rhs){
|
||||||
ret.checkerboard = rhs.checkerboard;
|
ret.checkerboard = rhs.checkerboard;
|
||||||
conformable(ret,rhs);
|
conformable(ret,rhs);
|
||||||
parallel_for(int ss=0;ss<rhs._grid->oSites();ss++){
|
parallel_for(int ss=0;ss<rhs._grid->oSites();ss++){
|
||||||
@ -182,10 +181,10 @@ namespace Grid {
|
|||||||
mac(&ret._odata[ss],&lhs,&rhs._odata[ss]);
|
mac(&ret._odata[ss],&lhs,&rhs._odata[ss]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class obj1,class obj2,class obj3> strong_inline
|
template<class obj1,class obj2,class obj3> strong_inline
|
||||||
void sub(Lattice<obj1> &ret,const obj2 &lhs,const Lattice<obj3> &rhs){
|
void sub(Lattice<obj1> &ret,const obj2 &lhs,const Lattice<obj3> &rhs){
|
||||||
ret.checkerboard = rhs.checkerboard;
|
ret.checkerboard = rhs.checkerboard;
|
||||||
conformable(ret,rhs);
|
conformable(ret,rhs);
|
||||||
parallel_for(int ss=0;ss<rhs._grid->oSites();ss++){
|
parallel_for(int ss=0;ss<rhs._grid->oSites();ss++){
|
||||||
@ -197,9 +196,9 @@ namespace Grid {
|
|||||||
sub(&ret._odata[ss],&lhs,&rhs._odata[ss]);
|
sub(&ret._odata[ss],&lhs,&rhs._odata[ss]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
template<class obj1,class obj2,class obj3> strong_inline
|
template<class obj1,class obj2,class obj3> strong_inline
|
||||||
void add(Lattice<obj1> &ret,const obj2 &lhs,const Lattice<obj3> &rhs){
|
void add(Lattice<obj1> &ret,const obj2 &lhs,const Lattice<obj3> &rhs){
|
||||||
ret.checkerboard = rhs.checkerboard;
|
ret.checkerboard = rhs.checkerboard;
|
||||||
conformable(ret,rhs);
|
conformable(ret,rhs);
|
||||||
parallel_for(int ss=0;ss<rhs._grid->oSites();ss++){
|
parallel_for(int ss=0;ss<rhs._grid->oSites();ss++){
|
||||||
@ -211,10 +210,10 @@ namespace Grid {
|
|||||||
add(&ret._odata[ss],&lhs,&rhs._odata[ss]);
|
add(&ret._odata[ss],&lhs,&rhs._odata[ss]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class sobj,class vobj> strong_inline
|
template<class sobj,class vobj> strong_inline
|
||||||
void axpy(Lattice<vobj> &ret,sobj a,const Lattice<vobj> &x,const Lattice<vobj> &y){
|
void axpy(Lattice<vobj> &ret,sobj a,const Lattice<vobj> &x,const Lattice<vobj> &y){
|
||||||
ret.checkerboard = x.checkerboard;
|
ret.checkerboard = x.checkerboard;
|
||||||
conformable(ret,x);
|
conformable(ret,x);
|
||||||
conformable(x,y);
|
conformable(x,y);
|
||||||
@ -226,9 +225,9 @@ namespace Grid {
|
|||||||
ret._odata[ss]=a*x._odata[ss]+y._odata[ss];
|
ret._odata[ss]=a*x._odata[ss]+y._odata[ss];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
template<class sobj,class vobj> strong_inline
|
template<class sobj,class vobj> strong_inline
|
||||||
void axpby(Lattice<vobj> &ret,sobj a,sobj b,const Lattice<vobj> &x,const Lattice<vobj> &y){
|
void axpby(Lattice<vobj> &ret,sobj a,sobj b,const Lattice<vobj> &x,const Lattice<vobj> &y){
|
||||||
ret.checkerboard = x.checkerboard;
|
ret.checkerboard = x.checkerboard;
|
||||||
conformable(ret,x);
|
conformable(ret,x);
|
||||||
conformable(x,y);
|
conformable(x,y);
|
||||||
@ -240,24 +239,24 @@ namespace Grid {
|
|||||||
ret._odata[ss]=a*x._odata[ss]+b*y._odata[ss];
|
ret._odata[ss]=a*x._odata[ss]+b*y._odata[ss];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class sobj,class vobj> strong_inline
|
template<class sobj,class vobj> strong_inline
|
||||||
RealD axpy_norm(Lattice<vobj> &ret,sobj a,const Lattice<vobj> &x,const Lattice<vobj> &y){
|
RealD axpy_norm(Lattice<vobj> &ret,sobj a,const Lattice<vobj> &x,const Lattice<vobj> &y){
|
||||||
ret.checkerboard = x.checkerboard;
|
ret.checkerboard = x.checkerboard;
|
||||||
conformable(ret,x);
|
conformable(ret,x);
|
||||||
conformable(x,y);
|
conformable(x,y);
|
||||||
axpy(ret,a,x,y);
|
axpy(ret,a,x,y);
|
||||||
return norm2(ret);
|
return norm2(ret);
|
||||||
}
|
}
|
||||||
template<class sobj,class vobj> strong_inline
|
template<class sobj,class vobj> strong_inline
|
||||||
RealD axpby_norm(Lattice<vobj> &ret,sobj a,sobj b,const Lattice<vobj> &x,const Lattice<vobj> &y){
|
RealD axpby_norm(Lattice<vobj> &ret,sobj a,sobj b,const Lattice<vobj> &x,const Lattice<vobj> &y){
|
||||||
ret.checkerboard = x.checkerboard;
|
ret.checkerboard = x.checkerboard;
|
||||||
conformable(ret,x);
|
conformable(ret,x);
|
||||||
conformable(x,y);
|
conformable(x,y);
|
||||||
axpby(ret,a,b,x,y);
|
axpby(ret,a,b,x,y);
|
||||||
return norm2(ret); // FIXME implement parallel norm in ss loop
|
return norm2(ret); // FIXME implement parallel norm in ss loop
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NAMESPACE_END(Grid);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user