5 #ifndef _ELECOFFDIAGONALTENSOR_H_
6 #define _ELECOFFDIAGONALTENSOR_H_
24 template <
class T,
int N>
68 os <<
"[ " <<
_data <<
" " <<
"]";
121 throw CException(
"operator not defined for elec offdiag /= s");
129 throw CException(
"no operator defined for /= elec offdiag");
135 throw CException(
"operator not defined for elec offdiag *= s");
143 throw CException(
"no operator defined for *= elec offdiag");
160 return mag2() < tolerance*tolerance;
193 throw CException(
"elec offdiag accumlateOneNorm is not defined!");
194 for(
int i=0; i<N; i++)
201 throw CException(
"elec offdiag accumlateDotProduct is not defined!");
202 for(
int i=0; i<N; i++)
208 throw CException(
" elec offdiag reduceSume is not defined!");
209 for(
int i=0; i<N; i++)
215 throw CException(
" elec offdiag safeDivide is not defined!");
216 for(
int i=0; i<N; i++)
222 throw CException(
" elec offdiag normalize is not defined!");
223 for(
int i=0; i<N; i++)
229 throw CException(
" elec offdiag setMax is not defined!");
230 for(
int i=0; i<N; i++)
243 template<
class T,
int N>
252 template<
class T,
int N>
259 template<
class T,
int N>
266 template<
class T,
int N>
273 template<
class T,
int N>
277 throw CException(
"no operator defined for diag * diag");
280 template<
class T,
int N>
287 template<
class T,
int N>
294 template<
class T,
int N>
305 template<
class T,
int N>
312 template<
class T,
int N>
323 template<
class T,
int N>
327 throw CException(
"operator not defined for offdiag/offdiag");
332 template<
class T,
int N>
336 throw CException(
"operator not defined for s/diag");
339 template<
class T,
int N>
342 throw CException(
"diag to offdiag not defined");
ElecOffDiagonalTensor(const T &o)
static string getTypeName()
static void reduceSum(T_Scalar &sum, const This_T &x)
ElecOffDiagonalTensor & operator/=(const T s)
ElecOffDiagonalTensor & operator+=(const ElecOffDiagonalTensor &o)
NumTypeTraits< T >::T_Scalar T_Scalar
static void accumulateDotProduct(ElecOffDiagonalTensor &sum, const ElecOffDiagonalTensor &v0, const ElecOffDiagonalTensor &v1)
static ElecOffDiagonalTensor getNegativeUnity()
ElecOffDiagonalTensor & operator*=(const ElecOffDiagonalTensor &o)
ElecOffDiagonalTensor & operator/=(const ElecOffDiagonalTensor &o)
ElecOffDiagonalTensor & operator=(const T &o)
static void getShape(int *shp)
static void setMax(ElecOffDiagonalTensor &x, const ElecOffDiagonalTensor &y)
static void write(FILE *fp, const ElecOffDiagonalTensor &x)
bool operator<(const double tolerance) const
ElecOffDiagonalTensor & operator=(const ElecOffDiagonalTensor &o)
T DiagToOffDiag(const ElecOffDiagonalTensor< T, N > &x)
void printFromC(ostream &os) const
ElecOffDiagonalTensor< T, N > This_T
ElecOffDiagonalTensor & operator*=(const T s)
const T & operator[](int n) const
ElecOffDiagonalTensor< T, N > operator/(const ElecOffDiagonalTensor< T, N > &a, const T s)
ElecOffDiagonalTensor operator-()
ElecOffDiagonalTensor< T, N > operator*(const ElecOffDiagonalTensor< T, N > &a, const ElecOffDiagonalTensor< T, N > &b)
ElecOffDiagonalTensor< T, N > operator+(const ElecOffDiagonalTensor< T, N > &a, const ElecOffDiagonalTensor< T, N > &b)
ElecOffDiagonalTensor< T, N > operator-(const ElecOffDiagonalTensor< T, N > &a, const ElecOffDiagonalTensor< T, N > &b)
string intAsString(const int i)
ostream & operator<<(ostream &os, const ElecOffDiagonalTensor< T, N > &v)
static ElecOffDiagonalTensor getUnity()
static void normalize(ElecOffDiagonalTensor &x, const ElecOffDiagonalTensor &y)
static void accumulateOneNorm(ElecOffDiagonalTensor &sum, const ElecOffDiagonalTensor &v)
static int getDimension()
NumTypeTraits< T >::T_BuiltIn T_BuiltIn
ElecOffDiagonalTensor(const ElecOffDiagonalTensor &o)
static void safeDivide(ElecOffDiagonalTensor &x, const ElecOffDiagonalTensor &y)
ElecOffDiagonalTensor & operator-=(const T s)
static double doubleMeasure(const ElecOffDiagonalTensor &x)
ElecOffDiagonalTensor & operator-=(const ElecOffDiagonalTensor &o)
ElecOffDiagonalTensor & operator+=(const T s)
static ElecOffDiagonalTensor getZero()