1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-18 09:45:55 +01:00

Tensor reformatted with NAMESPACE too

This commit is contained in:
paboyle 2018-01-13 00:31:02 +00:00
parent f4272aa6fd
commit c037244874
21 changed files with 1634 additions and 1626 deletions

View File

@ -30,7 +30,7 @@ Author: neo <cossu@post.kek.jp>
#define GRID_MATH_TA_H #define GRID_MATH_TA_H
namespace Grid { NAMESPACE_BEGIN(Grid);
/////////////////////////////////////////////// ///////////////////////////////////////////////
// Ta function for scalar, vector, matrix // Ta function for scalar, vector, matrix
@ -119,7 +119,6 @@ namespace Grid {
return ret; return ret;
} }
NAMESPACE_END(Grid);
}
#endif #endif

View File

@ -29,7 +29,7 @@ Author: neo <cossu@post.kek.jp>
#ifndef GRID_MATH_ARITH_ADD_H #ifndef GRID_MATH_ARITH_ADD_H
#define GRID_MATH_ARITH_ADD_H #define GRID_MATH_ARITH_ADD_H
namespace Grid { NAMESPACE_BEGIN(Grid);
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
@ -139,8 +139,7 @@ strong_inline auto operator + (const iScalar<ltype>& lhs,const iMatrix<rtype,N>&
return ret; return ret;
} }
NAMESPACE_END(Grid);
}
#endif #endif

View File

@ -28,8 +28,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
#ifndef GRID_MATH_ARITH_MAC_H #ifndef GRID_MATH_ARITH_MAC_H
#define GRID_MATH_ARITH_MAC_H #define GRID_MATH_ARITH_MAC_H
namespace Grid { NAMESPACE_BEGIN(Grid);
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////// MAC /////////////////////////////////////////// /////////////////////////////////////////// MAC ///////////////////////////////////////////
@ -103,6 +102,7 @@ strong_inline void mac(iVector<rrtype,N> * __restrict__ ret,const iVector<ltype,
} }
return; return;
} }
} NAMESPACE_END(Grid);
#endif #endif

View File

@ -28,8 +28,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
#ifndef GRID_MATH_ARITH_MUL_H #ifndef GRID_MATH_ARITH_MUL_H
#define GRID_MATH_ARITH_MUL_H #define GRID_MATH_ARITH_MUL_H
namespace Grid { NAMESPACE_BEGIN(Grid);
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////// MUL /////////////////////////////////////////// /////////////////////////////////////////// MUL ///////////////////////////////////////////
@ -247,7 +246,7 @@ auto operator * (const iVector<l,N>& lhs,const iScalar<r>& rhs) -> iVector<declt
return ret; return ret;
} }
NAMESPACE_END(Grid);
}
#endif #endif

View File

@ -29,8 +29,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
#ifndef GRID_MATH_ARITH_SCALAR_H #ifndef GRID_MATH_ARITH_SCALAR_H
#define GRID_MATH_ARITH_SCALAR_H #define GRID_MATH_ARITH_SCALAR_H
namespace Grid { NAMESPACE_BEGIN(Grid);
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Must support native C++ types Integer, Complex, Real // Must support native C++ types Integer, Complex, Real
@ -283,6 +282,6 @@ template<class l,int N> strong_inline iMatrix<l,N> operator - (Integer lhs,const
return slhs-rhs; return slhs-rhs;
} }
NAMESPACE_END(Grid);
}
#endif #endif

View File

@ -29,8 +29,7 @@ Author: neo <cossu@post.kek.jp>
#ifndef GRID_MATH_ARITH_SUB_H #ifndef GRID_MATH_ARITH_SUB_H
#define GRID_MATH_ARITH_SUB_H #define GRID_MATH_ARITH_SUB_H
namespace Grid { NAMESPACE_BEGIN(Grid);
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////// SUB /////////////////////////////////////////// /////////////////////////////////////////// SUB ///////////////////////////////////////////
@ -138,7 +137,6 @@ strong_inline auto operator - (const iMatrix<ltype,N>& lhs,const iScalar<rtype>&
return ret; return ret;
} }
NAMESPACE_END(Grid);
}
#endif #endif

View File

@ -24,7 +24,7 @@ directory
#ifndef GRID_MATH_TENSORS_H #ifndef GRID_MATH_TENSORS_H
#define GRID_MATH_TENSORS_H #define GRID_MATH_TENSORS_H
namespace Grid { NAMESPACE_BEGIN(Grid);
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
// Scalar, Vector, Matrix objects. // Scalar, Vector, Matrix objects.
@ -478,7 +478,9 @@ void vprefetch(const iMatrix<v, N> &vv) {
} }
} }
} }
}
NAMESPACE_END(Grid);
#endif #endif

View File

@ -27,7 +27,9 @@ Author: neo <cossu@post.kek.jp>
/* END LEGAL */ /* END LEGAL */
#ifndef GRID_MATH_DET_H #ifndef GRID_MATH_DET_H
#define GRID_MATH_DET_H #define GRID_MATH_DET_H
namespace Grid {
NAMESPACE_BEGIN(Grid);
/////////////////////////////////////////////// ///////////////////////////////////////////////
// Determinant function for scalar, vector, matrix // Determinant function for scalar, vector, matrix
/////////////////////////////////////////////// ///////////////////////////////////////////////
@ -66,7 +68,6 @@ namespace Grid {
return det; return det;
} }
NAMESPACE_END(Grid);
}
#endif #endif

View File

@ -30,7 +30,7 @@ Author: neo <cossu@post.kek.jp>
#define DEFAULT_MAT_EXP 12 #define DEFAULT_MAT_EXP 12
namespace Grid { NAMESPACE_BEGIN(Grid);
/////////////////////////////////////////////// ///////////////////////////////////////////////
// Exponentiate function for scalar, vector, matrix // Exponentiate function for scalar, vector, matrix
@ -137,8 +137,6 @@ template<class vtype,int N, typename std::enable_if< GridTypeMapper<vtype>::Tens
} }
NAMESPACE_END(Grid);
}
#endif #endif

View File

@ -35,7 +35,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
// trace of a different index can distribute across the vector index in a replicated way // trace of a different index can distribute across the vector index in a replicated way
// but we do not trace a vector index. // but we do not trace a vector index.
namespace Grid { NAMESPACE_BEGIN(Grid);
/* Needed? /* Needed?
template<int Level> inline ComplexF traceIndex(const ComplexF arg) { return arg;} template<int Level> inline ComplexF traceIndex(const ComplexF arg) { return arg;}
@ -404,5 +404,6 @@ void pokeIndex (vtype &ret,const decltype(TensorIndexRecursion<Level>::peekIndex
#undef RemoveCRV #undef RemoveCRV
} NAMESPACE_END(Grid);
#endif #endif

View File

@ -28,7 +28,9 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
/* END LEGAL */ /* END LEGAL */
#ifndef GRID_MATH_INNER_H #ifndef GRID_MATH_INNER_H
#define GRID_MATH_INNER_H #define GRID_MATH_INNER_H
namespace Grid {
NAMESPACE_BEGIN(Grid);
/////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////
// innerProduct Scalar x Scalar -> Scalar // innerProduct Scalar x Scalar -> Scalar
// innerProduct Vector x Vector -> Scalar // innerProduct Vector x Vector -> Scalar
@ -133,5 +135,6 @@ inline vRealD innerProductD(const vRealF &l,const vRealF &r){
return ret; return ret;
} }
} NAMESPACE_END(Grid);
#endif #endif

View File

@ -28,7 +28,7 @@ Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk>
#ifndef GRID_TENSOR_LOGICAL_H #ifndef GRID_TENSOR_LOGICAL_H
#define GRID_TENSOR_LOGICAL_H #define GRID_TENSOR_LOGICAL_H
namespace Grid { NAMESPACE_BEGIN(Grid);
#define LOGICAL_BINOP(Op) \ #define LOGICAL_BINOP(Op) \
template<class v> strong_inline iScalar<v> operator Op (const iScalar<v>& lhs,const iScalar<v>& rhs) \ template<class v> strong_inline iScalar<v> operator Op (const iScalar<v>& lhs,const iScalar<v>& rhs) \
@ -55,5 +55,6 @@ LOGICAL_BINOP(&);
LOGICAL_BINOP(||); LOGICAL_BINOP(||);
LOGICAL_BINOP(&&); LOGICAL_BINOP(&&);
} NAMESPACE_END(Grid);
#endif #endif

View File

@ -27,7 +27,9 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
/* END LEGAL */ /* END LEGAL */
#ifndef GRID_MATH_OUTER_H #ifndef GRID_MATH_OUTER_H
#define GRID_MATH_OUTER_H #define GRID_MATH_OUTER_H
namespace Grid {
NAMESPACE_BEGIN(Grid);
/////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////
// outerProduct Scalar x Scalar -> Scalar // outerProduct Scalar x Scalar -> Scalar
// Vector x Vector -> Matrix // Vector x Vector -> Matrix
@ -75,5 +77,6 @@ inline RealD outerProduct(const RealD &l, const RealD& r)
return l*r; return l*r;
} }
} NAMESPACE_END(Grid);
#endif #endif

View File

@ -28,7 +28,8 @@ Author: neo <cossu@post.kek.jp>
/* END LEGAL */ /* END LEGAL */
#ifndef GRID_MATH_REALITY_H #ifndef GRID_MATH_REALITY_H
#define GRID_MATH_REALITY_H #define GRID_MATH_REALITY_H
namespace Grid {
NAMESPACE_BEGIN(Grid);
/////////////////////////////////////////////// ///////////////////////////////////////////////
// multiply by I; make recursive. // multiply by I; make recursive.
@ -230,6 +231,6 @@ template<class itype,int N> inline auto imag(const iVector<itype,N> &z) -> iVect
return ret; return ret;
} }
NAMESPACE_END(Grid);
}
#endif #endif

View File

@ -28,7 +28,8 @@ Author: neo <cossu@post.kek.jp>
/* END LEGAL */ /* END LEGAL */
#ifndef GRID_MATH_TRACE_H #ifndef GRID_MATH_TRACE_H
#define GRID_MATH_TRACE_H #define GRID_MATH_TRACE_H
namespace Grid {
NAMESPACE_BEGIN(Grid);
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
// Traces: both all indices and a specific index. Indices must be // Traces: both all indices and a specific index. Indices must be
@ -69,6 +70,6 @@ template<class vtype,int N>
return ret; return ret;
} }
NAMESPACE_END(Grid);
}
#endif #endif

View File

@ -24,7 +24,7 @@ Author: Christopher Kelly <ckelly@phys.columbia.edu>
#include <type_traits> #include <type_traits>
namespace Grid { NAMESPACE_BEGIN(Grid);
////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////
// Want to recurse: GridTypeMapper<Matrix<vComplexD> >::scalar_type == ComplexD. // Want to recurse: GridTypeMapper<Matrix<vComplexD> >::scalar_type == ComplexD.
@ -288,7 +288,9 @@ namespace Grid {
enum { value = sizeof(real_scalar_type)/sizeof(float) }; enum { value = sizeof(real_scalar_type)/sizeof(float) };
}; };
}
NAMESPACE_END(Grid);
#endif #endif

View File

@ -27,9 +27,8 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
/* END LEGAL */ /* END LEGAL */
#ifndef GRID_MATH_TRANSPOSE_H #ifndef GRID_MATH_TRANSPOSE_H
#define GRID_MATH_TRANSPOSE_H #define GRID_MATH_TRANSPOSE_H
namespace Grid {
NAMESPACE_BEGIN(Grid);
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Transpose all indices // Transpose all indices
@ -126,5 +125,6 @@ transposeIndex (const iScalar<vtype> &arg)
} }
#endif #endif
} NAMESPACE_END(Grid);
#endif #endif

View File

@ -29,7 +29,8 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
/* END LEGAL */ /* END LEGAL */
#ifndef GRID_TENSOR_UNARY_H #ifndef GRID_TENSOR_UNARY_H
#define GRID_TENSOR_UNARY_H #define GRID_TENSOR_UNARY_H
namespace Grid {
NAMESPACE_BEGIN(Grid);
#define UNARY(func) \ #define UNARY(func) \
template<class obj> inline auto func(const iScalar<obj> &z) -> iScalar<obj> \ template<class obj> inline auto func(const iScalar<obj> &z) -> iScalar<obj> \
@ -149,6 +150,6 @@ BINARY_RSCALAR(pow,RealD);
#undef UNARY #undef UNARY
#undef BINARY_RSCALAR #undef BINARY_RSCALAR
NAMESPACE_END(Grid);
}
#endif #endif