1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

Tensor ambiguous fix

This commit is contained in:
Peter Boyle 2019-08-29 09:36:41 -05:00
parent 9b7a6d197f
commit b473405652

View File

@ -109,7 +109,7 @@ accelerator_inline iMatrix<l,N> operator * (double lhs,const iMatrix<l,N>& rhs)
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Complex support; cast to "scalar_type" through constructor // Complex support; cast to "scalar_type" through constructor
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
template<class l,IfNotSame<typename iScalar<l>::scalar_type,double> = 0> template<class l,IfNotSame<typename iScalar<l>::scalar_type,ComplexD> = 0>
accelerator_inline iScalar<l> operator * (const iScalar<l>& lhs,ComplexD rhs) accelerator_inline iScalar<l> operator * (const iScalar<l>& lhs,ComplexD rhs)
{ {
// typename std::enable_if<!std::is_same<typename iScalar<l>::scalar_type,ComplexD>::value,int>::type i=0; // typename std::enable_if<!std::is_same<typename iScalar<l>::scalar_type,ComplexD>::value,int>::type i=0;
@ -118,14 +118,14 @@ accelerator_inline iScalar<l> operator * (const iScalar<l>& lhs,ComplexD rhs)
return lhs*srhs; return lhs*srhs;
} }
template<class l,IfNotSame<typename iScalar<l>::scalar_type,double> = 0> template<class l,IfNotSame<typename iScalar<l>::scalar_type,ComplexD> = 0>
accelerator_inline iScalar<l> operator * (ComplexD lhs,const iScalar<l>& rhs) accelerator_inline iScalar<l> operator * (ComplexD lhs,const iScalar<l>& rhs)
{ {
// typename std::enable_if<!std::is_same<typename iScalar<l>::scalar_type,ComplexD>::value,int>::type i=0; // typename std::enable_if<!std::is_same<typename iScalar<l>::scalar_type,ComplexD>::value,int>::type i=0;
return rhs*lhs; return rhs*lhs;
} }
template<class l,int N,IfNotSame<typename iScalar<l>::scalar_type,double> = 0> template<class l,int N,IfNotSame<typename iScalar<l>::scalar_type,ComplexD> = 0>
accelerator_inline iVector<l,N> operator * (const iVector<l,N>& lhs,ComplexD rhs) accelerator_inline iVector<l,N> operator * (const iVector<l,N>& lhs,ComplexD rhs)
{ {
// typename std::enable_if<!std::is_same<typename iScalar<l>::scalar_type,ComplexD>::value,int>::type i=0; // typename std::enable_if<!std::is_same<typename iScalar<l>::scalar_type,ComplexD>::value,int>::type i=0;
@ -133,14 +133,14 @@ accelerator_inline iVector<l,N> operator * (const iVector<l,N>& lhs,ComplexD 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,IfNotSame<typename iScalar<l>::scalar_type,double> = 0> template<class l,int N,IfNotSame<typename iScalar<l>::scalar_type,ComplexD> = 0>
accelerator_inline iVector<l,N> operator * (ComplexD lhs,const iVector<l,N>& rhs) accelerator_inline iVector<l,N> operator * (ComplexD lhs,const iVector<l,N>& rhs)
{ {
// typename std::enable_if<!std::is_same<typename iScalar<l>::scalar_type,ComplexD>::value,int>::type i=0; // typename std::enable_if<!std::is_same<typename iScalar<l>::scalar_type,ComplexD>::value,int>::type i=0;
return rhs*lhs; return rhs*lhs;
} }
template<class l,int N,IfNotSame<typename iScalar<l>::scalar_type,double> = 0> template<class l,int N,IfNotSame<typename iScalar<l>::scalar_type,ComplexD> = 0>
accelerator_inline iMatrix<l,N> operator * (const iMatrix<l,N>& lhs,ComplexD rhs) accelerator_inline iMatrix<l,N> operator * (const iMatrix<l,N>& lhs,ComplexD rhs)
{ {
// typename std::enable_if<!std::is_same<typename iScalar<l>::scalar_type,ComplexD>::value,int>::type i=0; // typename std::enable_if<!std::is_same<typename iScalar<l>::scalar_type,ComplexD>::value,int>::type i=0;
@ -148,7 +148,7 @@ accelerator_inline iMatrix<l,N> operator * (const iMatrix<l,N>& lhs,ComplexD 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,IfNotSame<typename iScalar<l>::scalar_type,double> = 0> template<class l,int N,IfNotSame<typename iScalar<l>::scalar_type,ComplexD> = 0>
accelerator_inline iMatrix<l,N> operator * (ComplexD lhs,const iMatrix<l,N>& rhs) accelerator_inline iMatrix<l,N> operator * (ComplexD lhs,const iMatrix<l,N>& rhs)
{ {
// typename std::enable_if<!std::is_same<typename iScalar<l>::scalar_type,ComplexD>::value,int>::type i=0; // typename std::enable_if<!std::is_same<typename iScalar<l>::scalar_type,ComplexD>::value,int>::type i=0;
@ -158,7 +158,7 @@ accelerator_inline iMatrix<l,N> operator * (ComplexD lhs,const iMatrix<l,N>& rhs
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Integer support; cast to "scalar_type" through constructor // Integer support; cast to "scalar_type" through constructor
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
template<class l,IfNotSame<typename iScalar<l>::scalar_type,double> = 0> template<class l,IfNotSame<typename iScalar<l>::scalar_type,Integer> = 0>
accelerator_inline iScalar<l> operator * (const iScalar<l>& lhs,Integer rhs) accelerator_inline iScalar<l> operator * (const iScalar<l>& lhs,Integer rhs)
{ {
// typename std::enable_if<!std::is_same<typename iScalar<l>::scalar_type,ComplexD>::value,int>::type i=0; // typename std::enable_if<!std::is_same<typename iScalar<l>::scalar_type,ComplexD>::value,int>::type i=0;
@ -166,14 +166,14 @@ accelerator_inline iScalar<l> operator * (const iScalar<l>& lhs,Integer 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,IfNotSame<typename iScalar<l>::scalar_type,double> = 0> template<class l,IfNotSame<typename iScalar<l>::scalar_type,Integer> = 0>
accelerator_inline iScalar<l> operator * (Integer lhs,const iScalar<l>& rhs) accelerator_inline iScalar<l> operator * (Integer lhs,const iScalar<l>& rhs)
{ {
// typename std::enable_if<!std::is_same<typename iScalar<l>::scalar_type,Integer>::value,int>::type i=0; // typename std::enable_if<!std::is_same<typename iScalar<l>::scalar_type,Integer>::value,int>::type i=0;
return rhs*lhs; return rhs*lhs;
} }
template<class l,int N,IfNotSame<typename iScalar<l>::scalar_type,double> = 0> template<class l,int N,IfNotSame<typename iScalar<l>::scalar_type,Integer> = 0>
accelerator_inline iVector<l,N> operator * (const iVector<l,N>& lhs,Integer rhs) accelerator_inline iVector<l,N> operator * (const iVector<l,N>& lhs,Integer rhs)
{ {
// typename std::enable_if<!std::is_same<typename iScalar<l>::scalar_type,Integer>::value,int>::type i=0; // typename std::enable_if<!std::is_same<typename iScalar<l>::scalar_type,Integer>::value,int>::type i=0;
@ -181,14 +181,14 @@ accelerator_inline iVector<l,N> operator * (const iVector<l,N>& lhs,Integer 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,IfNotSame<typename iScalar<l>::scalar_type,double> = 0> template<class l,int N,IfNotSame<typename iScalar<l>::scalar_type,Integer> = 0>
accelerator_inline iVector<l,N> operator * (Integer lhs,const iVector<l,N>& rhs) accelerator_inline iVector<l,N> operator * (Integer lhs,const iVector<l,N>& rhs)
{ {
// typename std::enable_if<!std::is_same<typename iScalar<l>::scalar_type,Integer>::value,int>::type i=0; // typename std::enable_if<!std::is_same<typename iScalar<l>::scalar_type,Integer>::value,int>::type i=0;
return rhs*lhs; return rhs*lhs;
} }
template<class l,int N,IfNotSame<typename iScalar<l>::scalar_type,double> = 0> template<class l,int N,IfNotSame<typename iScalar<l>::scalar_type,Integer> = 0>
accelerator_inline iMatrix<l,N> operator * (const iMatrix<l,N>& lhs,Integer rhs) accelerator_inline iMatrix<l,N> operator * (const iMatrix<l,N>& lhs,Integer rhs)
{ {
// typename std::enable_if<!std::is_same<typename iScalar<l>::scalar_type,Integer>::value,int>::type i=0; // typename std::enable_if<!std::is_same<typename iScalar<l>::scalar_type,Integer>::value,int>::type i=0;
@ -196,7 +196,7 @@ accelerator_inline iMatrix<l,N> operator * (const iMatrix<l,N>& lhs,Integer 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,IfNotSame<typename iScalar<l>::scalar_type,double> = 0> template<class l,int N,IfNotSame<typename iScalar<l>::scalar_type,Integer> = 0>
accelerator_inline iMatrix<l,N> operator * (Integer lhs,const iMatrix<l,N>& rhs) accelerator_inline iMatrix<l,N> operator * (Integer lhs,const iMatrix<l,N>& rhs)
{ {
// typename std::enable_if<!std::is_same<typename iScalar<l>::scalar_type,Integer>::value,int>::type i=0; // typename std::enable_if<!std::is_same<typename iScalar<l>::scalar_type,Integer>::value,int>::type i=0;
@ -208,22 +208,22 @@ accelerator_inline iMatrix<l,N> operator * (Integer lhs,const iMatrix<l,N>& rhs)
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
// 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,IfNotSame<typename iScalar<l>::scalar_type,double> = 0> template<class l>
accelerator_inline iScalar<l> operator + (const iScalar<l>& lhs,const typename iScalar<l>::scalar_type rhs) accelerator_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,IfNotSame<typename iScalar<l>::scalar_type,double> = 0> template<class l>
accelerator_inline iScalar<l> operator + (const typename iScalar<l>::scalar_type lhs,const iScalar<l>& rhs) { return rhs+lhs; } accelerator_inline iScalar<l> operator + (const typename iScalar<l>::scalar_type lhs,const iScalar<l>& rhs) { return rhs+lhs; }
template<class l,int N,IfNotSame<typename iScalar<l>::scalar_type,double> = 0> template<class l,int N>
accelerator_inline iMatrix<l,N> operator + (const iMatrix<l,N>& lhs,const typename iScalar<l>::scalar_type rhs) accelerator_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,IfNotSame<typename iScalar<l>::scalar_type,double> = 0> template<class l,int N>
accelerator_inline iMatrix<l,N> operator + (const typename iScalar<l>::scalar_type lhs,const iMatrix<l,N>& rhs) { return rhs+lhs; } accelerator_inline iMatrix<l,N> operator + (const typename iScalar<l>::scalar_type lhs,const iMatrix<l,N>& rhs) { return rhs+lhs; }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -251,8 +251,6 @@ accelerator_inline iMatrix<l,N> operator + (double lhs,const iMatrix<l,N>& rhs)
// Integer support cast to scalar type through constructor // Integer support cast to scalar type through constructor
template<class l,IfNotSame<typename iScalar<l>::scalar_type,double> = 0> template<class l,IfNotSame<typename iScalar<l>::scalar_type,double> = 0>
accelerator_inline iScalar<l> operator + (const iScalar<l>& lhs,Integer rhs) accelerator_inline iScalar<l> operator + (const iScalar<l>& lhs,Integer rhs)
{ {
@ -278,26 +276,26 @@ accelerator_inline iMatrix<l,N> operator + (Integer lhs,const iMatrix<l,N>& rhs)
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
// 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,IfNotSame<typename iScalar<l>::scalar_type,double> = 0> template<class l>
accelerator_inline iScalar<l> operator - (const iScalar<l>& lhs,const typename iScalar<l>::scalar_type rhs) accelerator_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,IfNotSame<typename iScalar<l>::scalar_type,double> = 0> template<class l>
accelerator_inline iScalar<l> operator - (const typename iScalar<l>::scalar_type lhs,const iScalar<l>& rhs) accelerator_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,IfNotSame<typename iScalar<l>::scalar_type,double> = 0> template<class l,int N>
accelerator_inline iMatrix<l,N> operator - (const iMatrix<l,N>& lhs,const typename iScalar<l>::scalar_type rhs) accelerator_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,IfNotSame<typename iScalar<l>::scalar_type,double> = 0> template<class l,int N>
accelerator_inline iMatrix<l,N> operator - (const typename iScalar<l>::scalar_type lhs,const iMatrix<l,N>& rhs) accelerator_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;
@ -340,28 +338,28 @@ accelerator_inline iMatrix<l,N> operator - (double lhs,const iMatrix<l,N>& rhs)
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Integer support; cast to "scalar_type" through constructor // Integer support; cast to "scalar_type" through constructor
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
template<class l,IfNotSame<typename iScalar<l>::scalar_type,double> = 0> template<class l,IfNotSame<typename iScalar<l>::scalar_type,Integer> = 0>
accelerator_inline iScalar<l> operator - (const iScalar<l>& lhs,Integer rhs) accelerator_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,IfNotSame<typename iScalar<l>::scalar_type,double> = 0> template<class l,IfNotSame<typename iScalar<l>::scalar_type,Integer> = 0>
accelerator_inline iScalar<l> operator - (Integer lhs,const iScalar<l>& rhs) accelerator_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,IfNotSame<typename iScalar<l>::scalar_type,double> = 0> template<class l,int N,IfNotSame<typename iScalar<l>::scalar_type,Integer> = 0>
accelerator_inline iMatrix<l,N> operator - (const iMatrix<l,N>& lhs,Integer rhs) accelerator_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,IfNotSame<typename iScalar<l>::scalar_type,double> = 0> template<class l,int N,IfNotSame<typename iScalar<l>::scalar_type,Integer> = 0>
accelerator_inline iMatrix<l,N> operator - (Integer lhs,const iMatrix<l,N>& rhs) accelerator_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;