1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-10 14:10:46 +01:00

strong_inline forces ICPC to do it.

This commit is contained in:
Peter Boyle 2015-05-15 11:40:59 +01:00
parent 5d8303e94d
commit e59b6a805c

View File

@ -9,58 +9,58 @@ namespace Grid {
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// multiplication by fundamental scalar type // multiplication by fundamental scalar type
template<class l,int N> inline iScalar<l> operator * (const iScalar<l>& lhs,const typename iScalar<l>::scalar_type rhs) template<class l,int N> strong_inline iScalar<l> operator * (const iScalar<l>& lhs,const typename iScalar<l>::scalar_type rhs)
{ {
typename iScalar<l>::tensor_reduced srhs; srhs=rhs; typename iScalar<l>::tensor_reduced srhs; srhs=rhs;
return lhs*srhs; return lhs*srhs;
} }
template<class l,int N> inline iScalar<l> operator * (const typename iScalar<l>::scalar_type lhs,const iScalar<l>& rhs) { return rhs*lhs; } template<class l,int N> strong_inline iScalar<l> operator * (const typename iScalar<l>::scalar_type lhs,const iScalar<l>& rhs) { return rhs*lhs; }
template<class l,int N> inline iVector<l,N> operator * (const iVector<l,N>& lhs,const typename iScalar<l>::scalar_type rhs) template<class l,int N> strong_inline iVector<l,N> operator * (const iVector<l,N>& lhs,const typename iScalar<l>::scalar_type rhs)
{ {
typename iVector<l,N>::tensor_reduced srhs; srhs=rhs; typename iVector<l,N>::tensor_reduced srhs; srhs=rhs;
return lhs*srhs; return lhs*srhs;
} }
template<class l,int N> inline iVector<l,N> operator * (const typename iScalar<l>::scalar_type lhs,const iVector<l,N>& rhs) { return rhs*lhs; } template<class l,int N> strong_inline iVector<l,N> operator * (const typename iScalar<l>::scalar_type lhs,const iVector<l,N>& rhs) { return rhs*lhs; }
template<class l,int N> inline iMatrix<l,N> operator * (const iMatrix<l,N>& lhs,const typename iScalar<l>::scalar_type &rhs) template<class l,int N> strong_inline iMatrix<l,N> operator * (const iMatrix<l,N>& lhs,const typename iScalar<l>::scalar_type &rhs)
{ {
typename iMatrix<l,N>::tensor_reduced srhs; srhs=rhs; typename iMatrix<l,N>::tensor_reduced srhs; srhs=rhs;
return lhs*srhs; return lhs*srhs;
} }
template<class l,int N> inline iMatrix<l,N> operator * (const typename iScalar<l>::scalar_type & lhs,const iMatrix<l,N>& rhs) { return rhs*lhs; } template<class l,int N> strong_inline iMatrix<l,N> operator * (const typename iScalar<l>::scalar_type & lhs,const iMatrix<l,N>& rhs) { return rhs*lhs; }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Double support; cast to "scalar_type" through constructor // Double support; cast to "scalar_type" through constructor
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
template<class l> inline iScalar<l> operator * (const iScalar<l>& lhs,double rhs) template<class l> strong_inline iScalar<l> operator * (const iScalar<l>& lhs,double rhs)
{ {
typename iScalar<l>::scalar_type t; t=rhs; typename iScalar<l>::scalar_type t; t=rhs;
typename iScalar<l>::tensor_reduced srhs;srhs=t; typename iScalar<l>::tensor_reduced srhs;srhs=t;
return lhs*srhs; return lhs*srhs;
} }
template<class l> inline iScalar<l> operator * (double lhs,const iScalar<l>& rhs) { return rhs*lhs; } template<class l> strong_inline iScalar<l> operator * (double lhs,const iScalar<l>& rhs) { return rhs*lhs; }
template<class l,int N> inline iVector<l,N> operator * (const iVector<l,N>& lhs,double rhs) template<class l,int N> strong_inline iVector<l,N> operator * (const iVector<l,N>& lhs,double rhs)
{ {
typename iScalar<l>::scalar_type t;t=rhs; typename iScalar<l>::scalar_type t;t=rhs;
typename iScalar<l>::tensor_reduced srhs;srhs=t; typename iScalar<l>::tensor_reduced srhs;srhs=t;
return lhs*srhs; return lhs*srhs;
} }
template<class l,int N> inline iVector<l,N> operator * (double lhs,const iVector<l,N>& rhs) { return rhs*lhs; } template<class l,int N> strong_inline iVector<l,N> operator * (double lhs,const iVector<l,N>& rhs) { return rhs*lhs; }
template<class l,int N> inline iMatrix<l,N> operator * (const iMatrix<l,N>& lhs,double rhs) template<class l,int N> strong_inline iMatrix<l,N> operator * (const iMatrix<l,N>& lhs,double rhs)
{ {
typename iScalar<l>::scalar_type t;t=rhs; typename iScalar<l>::scalar_type t;t=rhs;
typename iScalar<l>::tensor_reduced srhs;srhs=t; typename iScalar<l>::tensor_reduced srhs;srhs=t;
return lhs*srhs; return lhs*srhs;
} }
template<class l,int N> inline iMatrix<l,N> operator * (double lhs,const iMatrix<l,N>& rhs) { return rhs*lhs; } template<class l,int N> strong_inline iMatrix<l,N> operator * (double lhs,const iMatrix<l,N>& rhs) { return rhs*lhs; }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Complex support; cast to "scalar_type" through constructor // Complex support; cast to "scalar_type" through constructor
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
template<class l> inline iScalar<l> operator * (const iScalar<l>& lhs,ComplexD rhs) template<class l> strong_inline iScalar<l> operator * (const iScalar<l>& lhs,ComplexD rhs)
{ {
typename iScalar<l>::scalar_type t;t=rhs; typename iScalar<l>::scalar_type t;t=rhs;
typename iScalar<l>::tensor_reduced srhs;srhs=t; typename iScalar<l>::tensor_reduced srhs;srhs=t;
@ -68,131 +68,131 @@ template<class l> inline iScalar<l> operator * (const iScalar<l>& lhs,ComplexD r
return lhs*srhs; return lhs*srhs;
} }
template<class l> inline iScalar<l> operator * (ComplexD lhs,const iScalar<l>& rhs) { return rhs*lhs; } template<class l> strong_inline iScalar<l> operator * (ComplexD lhs,const iScalar<l>& rhs) { return rhs*lhs; }
template<class l,int N> inline iVector<l,N> operator * (const iVector<l,N>& lhs,ComplexD rhs) template<class l,int N> strong_inline iVector<l,N> operator * (const iVector<l,N>& lhs,ComplexD rhs)
{ {
typename iScalar<l>::scalar_type t;t=rhs; typename iScalar<l>::scalar_type t;t=rhs;
typename iScalar<l>::tensor_reduced srhs;srhs=t; typename iScalar<l>::tensor_reduced srhs;srhs=t;
return lhs*srhs; return lhs*srhs;
} }
template<class l,int N> inline iVector<l,N> operator * (ComplexD lhs,const iVector<l,N>& rhs) { return rhs*lhs; } template<class l,int N> strong_inline iVector<l,N> operator * (ComplexD lhs,const iVector<l,N>& rhs) { return rhs*lhs; }
template<class l,int N> inline iMatrix<l,N> operator * (const iMatrix<l,N>& lhs,ComplexD rhs) template<class l,int N> strong_inline iMatrix<l,N> operator * (const iMatrix<l,N>& lhs,ComplexD rhs)
{ {
typename iScalar<l>::scalar_type t;t=rhs; typename iScalar<l>::scalar_type t;t=rhs;
typename iScalar<l>::tensor_reduced srhs;srhs=t; typename iScalar<l>::tensor_reduced srhs;srhs=t;
return lhs*srhs; return lhs*srhs;
} }
template<class l,int N> inline iMatrix<l,N> operator * (ComplexD lhs,const iMatrix<l,N>& rhs) { return rhs*lhs; } template<class l,int N> strong_inline iMatrix<l,N> operator * (ComplexD lhs,const iMatrix<l,N>& rhs) { return rhs*lhs; }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Integer support; cast to "scalar_type" through constructor // Integer support; cast to "scalar_type" through constructor
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
template<class l> inline iScalar<l> operator * (const iScalar<l>& lhs,Integer rhs) template<class l> strong_inline iScalar<l> operator * (const iScalar<l>& lhs,Integer rhs)
{ {
typename iScalar<l>::scalar_type t; t=rhs; typename iScalar<l>::scalar_type t; t=rhs;
typename iScalar<l>::tensor_reduced srhs; srhs=t; typename iScalar<l>::tensor_reduced srhs; srhs=t;
return lhs*srhs; return lhs*srhs;
} }
template<class l> inline iScalar<l> operator * (Integer lhs,const iScalar<l>& rhs) { return rhs*lhs; } template<class l> strong_inline iScalar<l> operator * (Integer lhs,const iScalar<l>& rhs) { return rhs*lhs; }
template<class l,int N> inline iVector<l,N> operator * (const iVector<l,N>& lhs,Integer rhs) template<class l,int N> strong_inline iVector<l,N> operator * (const iVector<l,N>& lhs,Integer rhs)
{ {
typename iScalar<l>::scalar_type t;t=rhs; typename iScalar<l>::scalar_type t;t=rhs;
typename iScalar<l>::tensor_reduced srhs;srhs=t; typename iScalar<l>::tensor_reduced srhs;srhs=t;
return lhs*srhs; return lhs*srhs;
} }
template<class l,int N> inline iVector<l,N> operator * (Integer lhs,const iVector<l,N>& rhs) { return rhs*lhs; } template<class l,int N> strong_inline iVector<l,N> operator * (Integer lhs,const iVector<l,N>& rhs) { return rhs*lhs; }
template<class l,int N> inline iMatrix<l,N> operator * (const iMatrix<l,N>& lhs,Integer rhs) template<class l,int N> strong_inline iMatrix<l,N> operator * (const iMatrix<l,N>& lhs,Integer rhs)
{ {
typename iScalar<l>::scalar_type t;t=rhs; typename iScalar<l>::scalar_type t;t=rhs;
typename iScalar<l>::tensor_reduced srhs;srhs=t; typename iScalar<l>::tensor_reduced srhs;srhs=t;
return lhs*srhs; return lhs*srhs;
} }
template<class l,int N> inline iMatrix<l,N> operator * (Integer lhs,const iMatrix<l,N>& rhs) { return rhs*lhs; } template<class l,int N> strong_inline iMatrix<l,N> operator * (Integer lhs,const iMatrix<l,N>& rhs) { return rhs*lhs; }
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
// addition by fundamental scalar type applies to matrix(down diag) and scalar // addition by fundamental scalar type applies to matrix(down diag) and scalar
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
template<class l,int N> inline iScalar<l> operator + (const iScalar<l>& lhs,const typename iScalar<l>::scalar_type rhs) template<class l,int N> strong_inline iScalar<l> operator + (const iScalar<l>& lhs,const typename iScalar<l>::scalar_type rhs)
{ {
typename iScalar<l>::tensor_reduced srhs; srhs=rhs; typename iScalar<l>::tensor_reduced srhs; srhs=rhs;
return lhs+srhs; return lhs+srhs;
} }
template<class l,int N> inline iScalar<l> operator + (const typename iScalar<l>::scalar_type lhs,const iScalar<l>& rhs) { return rhs+lhs; } template<class l,int N> strong_inline iScalar<l> operator + (const typename iScalar<l>::scalar_type lhs,const iScalar<l>& rhs) { return rhs+lhs; }
template<class l,int N> inline iMatrix<l,N> operator + (const iMatrix<l,N>& lhs,const typename iScalar<l>::scalar_type rhs) template<class l,int N> strong_inline iMatrix<l,N> operator + (const iMatrix<l,N>& lhs,const typename iScalar<l>::scalar_type rhs)
{ {
typename iMatrix<l,N>::tensor_reduced srhs; srhs=rhs; typename iMatrix<l,N>::tensor_reduced srhs; srhs=rhs;
return lhs+srhs; return lhs+srhs;
} }
template<class l,int N> inline iMatrix<l,N> operator + (const typename iScalar<l>::scalar_type lhs,const iMatrix<l,N>& rhs) { return rhs+lhs; } template<class l,int N> strong_inline iMatrix<l,N> operator + (const typename iScalar<l>::scalar_type lhs,const iMatrix<l,N>& rhs) { return rhs+lhs; }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Double support; cast to "scalar_type" through constructor // Double support; cast to "scalar_type" through constructor
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
template<class l> inline iScalar<l> operator + (const iScalar<l>& lhs,double rhs) template<class l> strong_inline iScalar<l> operator + (const iScalar<l>& lhs,double rhs)
{ {
typename iScalar<l>::scalar_type t; t=rhs; typename iScalar<l>::scalar_type t; t=rhs;
typename iScalar<l>::tensor_reduced srhs; srhs=t; typename iScalar<l>::tensor_reduced srhs; srhs=t;
return lhs+srhs; return lhs+srhs;
} }
template<class l> inline iScalar<l> operator + (double lhs,const iScalar<l>& rhs) { return rhs+lhs; } template<class l> strong_inline iScalar<l> operator + (double lhs,const iScalar<l>& rhs) { return rhs+lhs; }
template<class l,int N> inline iMatrix<l,N> operator + (const iMatrix<l,N>& lhs,double rhs) template<class l,int N> strong_inline iMatrix<l,N> operator + (const iMatrix<l,N>& lhs,double rhs)
{ {
typename iScalar<l>::scalar_type t;t=rhs; typename iScalar<l>::scalar_type t;t=rhs;
typename iScalar<l>::tensor_reduced srhs;srhs=t; typename iScalar<l>::tensor_reduced srhs;srhs=t;
return lhs+srhs; return lhs+srhs;
} }
template<class l,int N> inline iMatrix<l,N> operator + (double lhs,const iMatrix<l,N>& rhs) { return rhs+lhs; } template<class l,int N> strong_inline iMatrix<l,N> operator + (double lhs,const iMatrix<l,N>& rhs) { return rhs+lhs; }
// Integer support cast to scalar type through constructor // Integer support cast to scalar type through constructor
template<class l> inline iScalar<l> operator + (const iScalar<l>& lhs,Integer rhs) template<class l> strong_inline iScalar<l> operator + (const iScalar<l>& lhs,Integer rhs)
{ {
typename iScalar<l>::scalar_type t; t=rhs; typename iScalar<l>::scalar_type t; t=rhs;
typename iScalar<l>::tensor_reduced srhs; srhs=t; typename iScalar<l>::tensor_reduced srhs; srhs=t;
return lhs+srhs; return lhs+srhs;
} }
template<class l> inline iScalar<l> operator + (Integer lhs,const iScalar<l>& rhs) { return rhs+lhs; } template<class l> strong_inline iScalar<l> operator + (Integer lhs,const iScalar<l>& rhs) { return rhs+lhs; }
template<class l,int N> inline iMatrix<l,N> operator + (const iMatrix<l,N>& lhs,Integer rhs) template<class l,int N> strong_inline iMatrix<l,N> operator + (const iMatrix<l,N>& lhs,Integer rhs)
{ {
typename iScalar<l>::scalar_type t;t=rhs; typename iScalar<l>::scalar_type t;t=rhs;
typename iScalar<l>::tensor_reduced srhs;srhs=t; typename iScalar<l>::tensor_reduced srhs;srhs=t;
return lhs+srhs; return lhs+srhs;
} }
template<class l,int N> inline iMatrix<l,N> operator + (Integer lhs,const iMatrix<l,N>& rhs) { return rhs+lhs; } template<class l,int N> strong_inline iMatrix<l,N> operator + (Integer lhs,const iMatrix<l,N>& rhs) { return rhs+lhs; }
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
// subtraction of fundamental scalar type applies to matrix(down diag) and scalar // subtraction of fundamental scalar type applies to matrix(down diag) and scalar
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
template<class l,int N> inline iScalar<l> operator - (const iScalar<l>& lhs,const typename iScalar<l>::scalar_type rhs) template<class l,int N> strong_inline iScalar<l> operator - (const iScalar<l>& lhs,const typename iScalar<l>::scalar_type rhs)
{ {
typename iScalar<l>::tensor_reduced srhs; srhs=rhs; typename iScalar<l>::tensor_reduced srhs; srhs=rhs;
return lhs-srhs; return lhs-srhs;
} }
template<class l,int N> inline iScalar<l> operator - (const typename iScalar<l>::scalar_type lhs,const iScalar<l>& rhs) template<class l,int N> strong_inline iScalar<l> operator - (const typename iScalar<l>::scalar_type lhs,const iScalar<l>& rhs)
{ {
typename iScalar<l>::tensor_reduced slhs;slhs=lhs; typename iScalar<l>::tensor_reduced slhs;slhs=lhs;
return slhs-rhs; return slhs-rhs;
} }
template<class l,int N> inline iMatrix<l,N> operator - (const iMatrix<l,N>& lhs,const typename iScalar<l>::scalar_type rhs) template<class l,int N> strong_inline iMatrix<l,N> operator - (const iMatrix<l,N>& lhs,const typename iScalar<l>::scalar_type rhs)
{ {
typename iScalar<l>::tensor_reduced srhs; srhs=rhs; typename iScalar<l>::tensor_reduced srhs; srhs=rhs;
return lhs-srhs; return lhs-srhs;
} }
template<class l,int N> inline iMatrix<l,N> operator - (const typename iScalar<l>::scalar_type lhs,const iMatrix<l,N>& rhs) template<class l,int N> strong_inline iMatrix<l,N> operator - (const typename iScalar<l>::scalar_type lhs,const iMatrix<l,N>& rhs)
{ {
typename iScalar<l>::tensor_reduced slhs;slhs=lhs; typename iScalar<l>::tensor_reduced slhs;slhs=lhs;
return slhs-rhs; return slhs-rhs;
@ -201,26 +201,26 @@ template<class l,int N> inline iMatrix<l,N> operator - (const typename iScalar<l
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Double support; cast to "scalar_type" through constructor // Double support; cast to "scalar_type" through constructor
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
template<class l> inline iScalar<l> operator - (const iScalar<l>& lhs,double rhs) template<class l> strong_inline iScalar<l> operator - (const iScalar<l>& lhs,double rhs)
{ {
typename iScalar<l>::scalar_type t; t=rhs; typename iScalar<l>::scalar_type t; t=rhs;
typename iScalar<l>::tensor_reduced srhs; srhs=t; typename iScalar<l>::tensor_reduced srhs; srhs=t;
return lhs-srhs; return lhs-srhs;
} }
template<class l> inline iScalar<l> operator - (double lhs,const iScalar<l>& rhs) template<class l> strong_inline iScalar<l> operator - (double lhs,const iScalar<l>& rhs)
{ {
typename iScalar<l>::scalar_type t(lhs); typename iScalar<l>::scalar_type t(lhs);
typename iScalar<l>::tensor_reduced slhs;slhs=t; typename iScalar<l>::tensor_reduced slhs;slhs=t;
return slhs-rhs; return slhs-rhs;
} }
template<class l,int N> inline iMatrix<l,N> operator - (const iMatrix<l,N>& lhs,double rhs) template<class l,int N> strong_inline iMatrix<l,N> operator - (const iMatrix<l,N>& lhs,double rhs)
{ {
typename iScalar<l>::scalar_type t;t=rhs; typename iScalar<l>::scalar_type t;t=rhs;
typename iScalar<l>::tensor_reduced srhs;srhs=t; typename iScalar<l>::tensor_reduced srhs;srhs=t;
return lhs-srhs; return lhs-srhs;
} }
template<class l,int N> inline iMatrix<l,N> operator - (double lhs,const iMatrix<l,N>& rhs) template<class l,int N> strong_inline iMatrix<l,N> operator - (double lhs,const iMatrix<l,N>& rhs)
{ {
typename iScalar<l>::scalar_type t(lhs); typename iScalar<l>::scalar_type t(lhs);
typename iScalar<l>::tensor_reduced slhs;slhs=t; typename iScalar<l>::tensor_reduced slhs;slhs=t;
@ -230,25 +230,25 @@ template<class l,int N> inline iMatrix<l,N> operator - (double lhs,const iMatrix
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Integer support; cast to "scalar_type" through constructor // Integer support; cast to "scalar_type" through constructor
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
template<class l> inline iScalar<l> operator - (const iScalar<l>& lhs,Integer rhs) template<class l> strong_inline iScalar<l> operator - (const iScalar<l>& lhs,Integer rhs)
{ {
typename iScalar<l>::scalar_type t; t=rhs; typename iScalar<l>::scalar_type t; t=rhs;
typename iScalar<l>::tensor_reduced srhs; srhs=t; typename iScalar<l>::tensor_reduced srhs; srhs=t;
return lhs-srhs; return lhs-srhs;
} }
template<class l> inline iScalar<l> operator - (Integer lhs,const iScalar<l>& rhs) template<class l> strong_inline iScalar<l> operator - (Integer lhs,const iScalar<l>& rhs)
{ {
typename iScalar<l>::scalar_type t;t=lhs; typename iScalar<l>::scalar_type t;t=lhs;
typename iScalar<l>::tensor_reduced slhs;slhs=t; typename iScalar<l>::tensor_reduced slhs;slhs=t;
return slhs-rhs; return slhs-rhs;
} }
template<class l,int N> inline iMatrix<l,N> operator - (const iMatrix<l,N>& lhs,Integer rhs) template<class l,int N> strong_inline iMatrix<l,N> operator - (const iMatrix<l,N>& lhs,Integer rhs)
{ {
typename iScalar<l>::scalar_type t;t=rhs; typename iScalar<l>::scalar_type t;t=rhs;
typename iScalar<l>::tensor_reduced srhs;srhs=t; typename iScalar<l>::tensor_reduced srhs;srhs=t;
return lhs-srhs; return lhs-srhs;
} }
template<class l,int N> inline iMatrix<l,N> operator - (Integer lhs,const iMatrix<l,N>& rhs) template<class l,int N> strong_inline iMatrix<l,N> operator - (Integer lhs,const iMatrix<l,N>& rhs)
{ {
typename iScalar<l>::scalar_type t;t=lhs; typename iScalar<l>::scalar_type t;t=lhs;
typename iScalar<l>::tensor_reduced slhs;slhs=t; typename iScalar<l>::tensor_reduced slhs;slhs=t;