36template<
class T,
unsigned D>
61 PInsist(D==2,
"Number of arguments does not match SymTenzor dimension!!");
62 X[0] = x00;
X[1] = x10;
X[2] = x11;
66 const T& x21,
const T& x22) {
67 PInsist(D==3,
"Number of arguments does not match SymTenzor dimension!!");
68 X[0]= x00;
X[1]= x10;
X[2]= x11;
69 X[3]= x20;
X[4]= x21;
X[5]= x22;
81 for (
unsigned int i=0; i<D; ++i) {
82 (*this)(i,i) = t(i,i);
83 for (
unsigned int j=i+1; j<D; ++j)
84 (*
this)(i,j) = (t(i,j)+t(j,i))*0.5;
108 for (
unsigned int i=0; i<D; ++i) {
109 (*this)(i,i) = rhs(i,i);
110 for (
unsigned int j=i+1; j<D; ++j)
111 (*
this)(i,j) = (rhs(i,j)+rhs(j,i))*0.5;
176 for (
unsigned int i = 0 ; i < D ; i++ ) {
177 X[((i+1)*i/2) + i] = rhs;
182 int size(
void)
const {
return sizeof(*this); }
188 int lo = i < j ? i : j;
189 int hi = i > j ? i : j;
190 return X[((hi+1)*hi/2) + lo];
194 int lo = i < j ? i : j;
195 int hi = i > j ? i : j;
196 return X[((hi+1)*hi/2) + lo];
202 int lo = i < j ? i : j;
203 int hi = i > j ? i : j;
204 return X[((hi+1)*hi/2) + lo];
210 int lo = i < j ? i : j;
211 int hi = i > j ? i : j;
212 return X[((hi+1)*hi/2) + lo];
218 return X[hi*(hi+1)/2 + lo];
223 return X[hi*(hi+1)/2 + lo];
256 return !(*
this == that);
286template <
class T,
unsigned D>
289 for (
unsigned int i = 0 ; i < D ; i++ )
294template <
class T,
unsigned D>
300template <
class T,
unsigned D>
302 PInsist(D<3,
"Tenzor det() function not implemented for D>3!");
303 return T(-999999.999999);
310 rhs(0,0)*(rhs(1,1)*rhs(2,2) - rhs(1,2)*rhs(2,1)) +
311 rhs(0,1)*(rhs(1,2)*rhs(2,0) - rhs(1,0)*rhs(2,2)) +
312 rhs(0,2)*(rhs(1,0)*rhs(2,1) - rhs(1,1)*rhs(2,0));
319 result = rhs(0,0)*rhs(1,1) - rhs(0,1)*rhs(1,0);
335template <
class T,
unsigned D>
337 PInsist(D<4,
"SymTenzor cofactors() function not implemented for D>3!");
345 result(0,0) = rhs(1,1)*rhs(2,2) - rhs(1,2)*rhs(2,1);
346 result(1,0) = rhs(0,2)*rhs(2,1) - rhs(0,1)*rhs(2,2);
347 result(2,0) = rhs(0,1)*rhs(1,2) - rhs(1,1)*rhs(0,2);
348 result(0,1) = rhs(2,0)*rhs(1,2) - rhs(1,0)*rhs(2,2);
349 result(1,1) = rhs(0,0)*rhs(2,2) - rhs(0,2)*rhs(2,0);
350 result(2,1) = rhs(1,0)*rhs(0,2) - rhs(0,0)*rhs(1,2);
351 result(0,2) = rhs(1,0)*rhs(2,1) - rhs(2,0)*rhs(1,1);
352 result(1,2) = rhs(0,1)*rhs(2,0) - rhs(0,0)*rhs(2,1);
353 result(2,2) = rhs(0,0)*rhs(1,1) - rhs(1,0)*rhs(0,1);
361 result(0,0) = rhs(1,1);
362 result(1,0) = -rhs(0,1);
363 result(0,1) = -rhs(1,0);
364 result(1,1) = rhs(0,0);
385template<
class T,
unsigned D>
393template<
class T,
unsigned D>
429template <
class T1,
class T2,
unsigned D >
436template <
class T1,
class T2,
unsigned D >
443template <
class T1,
class T2,
unsigned D >
450template <
class T1,
class T2,
unsigned D >
457template <
class T1,
class T2,
unsigned D >
468template <
class T1,
class T2,
unsigned D >
475template <
class T1,
class T2,
unsigned D >
482template <
class T1,
class T2,
unsigned D >
491template<
class T,
unsigned D>
494 for (
unsigned int i=0; i<D; i++) {
496 for (
unsigned int j=0; j<D-1; j++) {
497 out << rhs(i,j) <<
" , ";
499 out << rhs(i,D-1) <<
")";
503 out <<
"( " << rhs(0,0) <<
" )";
T trace(const SymTenzor< T, D > &rhs)
SymTenzor< T, D > operator-(const SymTenzor< T, D > &op)
Tenzor< T, D > cofactors(const SymTenzor< T, D > &)
std::ostream & operator<<(std::ostream &out, const SymTenzor< T, D > &rhs)
Tenzor< typename PETEBinaryReturn< T1, T2, OpMultipply >::type, D > dot(const SymTenzor< T1, D > &lhs, const SymTenzor< T2, D > &rhs)
const SymTenzor< T, D > & operator+(const SymTenzor< T, D > &op)
T det(const SymTenzor< T, D > &)
SymTenzor< T, D > transpose(const SymTenzor< T, D > &rhs)
PETEBinaryReturn< T1, T2, OpMultipply >::type dotdot(const SymTenzor< T1, D > &lhs, const SymTenzor< T2, D > &rhs)
#define TSV_ELEMENTWISE_OPERATOR2(TSV1, TSV2, OP, APP)
#define TSV_ELEMENTWISE_OPERATOR(TSV, OP, APP)
double Min(double a, double b)
double Max(double a, double b)
SymTenzor(DontInitialize)
bool operator!=(const SymTenzor< T, D > &that) const
Element_t operator[](unsigned int i) const
const SymTenzor< T, D > & operator=(const SymTenzor< T, D > &rhs)
SymTenzor< T, D > & operator+=(const T &rhs)
Message & getMessage(Message &m)
SymTenzor< T, D > & operator-=(const SymTenzor< T1, D > &rhs)
void diagonal(const T &rhs)
bool operator==(const SymTenzor< T, D > &that) const
SymTenzor< T, D > & operator-=(const T &rhs)
Element_t & operator()(unsigned int i)
SymTenzor(const T &x00, const T &x10, const T &x11)
SymTenzor(const T &x00, const T &x10, const T &x11, const T &x20, const T &x21, const T &x22)
SymTenzor(const Tenzor< T, D > &t)
SymTenzor(const SymTenzor< T, D > &rhs)
SymTenzor< T, D > & operator+=(const SymTenzor< T1, D > &rhs)
SymTenzor< T, D > & operator*=(const T &rhs)
Message & putMessage(Message &m) const
Element_t & operator()(unsigned int i, unsigned int j)
Element_t HL(unsigned int hi, unsigned int lo) const
Element_t & operator()(std::pair< int, int > a)
Element_t operator()(unsigned int i, unsigned int j) const
Element_t & HL(unsigned int hi, unsigned int lo)
Element_t operator()(unsigned int i) const
SymTenzor< T, D > & operator/=(const SymTenzor< T1, D > &rhs)
Element_t & operator[](unsigned int i)
SymTenzor< T, D > & operator/=(const T &rhs)
SymTenzor< T, D > & operator*=(const SymTenzor< T1, D > &rhs)
Element_t operator()(std::pair< int, int > a) const
Message & setCopy(const bool c)
PETE_ComputeBinaryType< T1, T2, Op, Op::tag >::type type