23template <
class T,
unsigned D>
class SymTenzor;
33template<
class T,
unsigned D>
62 Tenzor(
const T& x00,
const T& x10,
const T& x01,
const T& x11) {
63 PInsist(D==2,
"Number of arguments does not match Tenzor dimension!!");
69 Tenzor(
const T& x00,
const T& x10,
const T& x20,
const T& x01,
const T& x11,
70 const T& x21,
const T& x02,
const T& x12,
const T& x22) {
71 PInsist(D==3,
"Number of arguments does not match Tenzor dimension!!");
167 for (
unsigned int i = 0 ; i < D ; i++ )
172 int size(
void)
const {
return sizeof(*this); }
213 PAssert ( (i.first>=0) && (i.second>=0) && (i.first<(
int)D) && (i.second<(
int)D) );
214 return (*
this)(i.first,i.second);
218 PAssert ( (i.first>=0) && (i.second>=0) && (i.first<(
int)D) && (i.second<(
int)D) );
219 return (*
this)(i.first,i.second);
229 return !(*
this == that);
263template <
class T,
unsigned D>
266 for (
unsigned int i = 0 ; i < D ; i++ )
273template <
class T,
unsigned D>
277 for (
unsigned int j = 0 ; j < D ; j++ )
278 for (
unsigned int i = 0 ; i < D ; i++ )
279 result(i,j) = rhs(j,i);
285template <
class T,
unsigned D>
287 PInsist(D<4,
"Tenzor det() function not implemented for D>3!");
288 return T(-999999.999999);
295 rhs(0,0)*(rhs(1,1)*rhs(2,2) - rhs(1,2)*rhs(2,1)) +
296 rhs(0,1)*(rhs(1,2)*rhs(2,0) - rhs(1,0)*rhs(2,2)) +
297 rhs(0,2)*(rhs(1,0)*rhs(2,1) - rhs(1,1)*rhs(2,0));
304 result = rhs(0,0)*rhs(1,1) - rhs(0,1)*rhs(1,0);
320template <
class T,
unsigned D>
322 PInsist(D<4,
"Tenzor cofactors() function not implemented for D>3!");
330 result(0,0) = rhs(1,1)*rhs(2,2) - rhs(1,2)*rhs(2,1);
331 result(1,0) = rhs(0,2)*rhs(2,1) - rhs(0,1)*rhs(2,2);
332 result(2,0) = rhs(0,1)*rhs(1,2) - rhs(1,1)*rhs(0,2);
333 result(0,1) = rhs(2,0)*rhs(1,2) - rhs(1,0)*rhs(2,2);
334 result(1,1) = rhs(0,0)*rhs(2,2) - rhs(0,2)*rhs(2,0);
335 result(2,1) = rhs(1,0)*rhs(0,2) - rhs(0,0)*rhs(1,2);
336 result(0,2) = rhs(1,0)*rhs(2,1) - rhs(2,0)*rhs(1,1);
337 result(1,2) = rhs(0,1)*rhs(2,0) - rhs(0,0)*rhs(2,1);
338 result(2,2) = rhs(0,0)*rhs(1,1) - rhs(1,0)*rhs(0,1);
346 result(0,0) = rhs(1,1);
347 result(1,0) = -rhs(0,1);
348 result(0,1) = -rhs(1,0);
349 result(1,1) = rhs(0,0);
370template<
class T,
unsigned D>
378template<
class T,
unsigned D>
405template <
class T1,
class T2,
unsigned D >
412template <
class T1,
class T2,
unsigned D >
419template <
class T1,
class T2,
unsigned D >
430template <
class T1,
class T2,
unsigned D >
441template<
class T1,
class T2,
unsigned int D>
448 for (
unsigned int i=0; i<D; ++i)
449 for (
unsigned int j=0; j<D; ++j)
450 ret(i,j) = v1[i]*v2[j];
456template<
class T,
unsigned D>
460 for (
unsigned int i=0; i<D; i++) {
462 for (
unsigned int j=0; j<D-1; j++) {
463 out << rhs(i,j) <<
" , ";
465 out << rhs(i,D-1) <<
")";
469 out <<
"( " << rhs(0,0) <<
" )";
478template <
class T,
unsigned D>
480 for (
unsigned int i=0; i<D; ++i)
481 for (
unsigned int j=0; j<D; ++j)
482 (*
this)(i,j) = rhs(i,j);
485template <
class T,
unsigned D>
487 for (
unsigned int i=0; i<D; ++i)
488 for (
unsigned int j=0; j<D; ++j)
489 (*
this)(i,j) = rhs(i,j);
Tenzor< typename PETEBinaryReturn< T1, T2, OpMultipply >::type, D > dot(const Tenzor< T1, D > &lhs, const Tenzor< T2, D > &rhs)
T det(const Tenzor< T, D > &)
T trace(const Tenzor< T, D > &rhs)
const Tenzor< T, D > & operator+(const Tenzor< T, D > &op)
PETEBinaryReturn< T1, T2, OpMultipply >::type dotdot(const Tenzor< T1, D > &lhs, const Tenzor< T2, D > &rhs)
Tenzor< T, D > operator-(const Tenzor< T, D > &op)
Tenzor< T, D > transpose(const Tenzor< T, D > &rhs)
Tenzor< typename PETEBinaryReturn< T1, T2, OpMultipply >::type, D > outerProduct(const Vektor< T1, D > &v1, const Vektor< T2, D > &v2)
Tenzor< T, D > cofactors(const Tenzor< T, D > &)
std::ostream & operator<<(std::ostream &out, const Tenzor< T, D > &rhs)
#define TSV_ELEMENTWISE_OPERATOR(TSV, OP, APP)
double Min(double a, double b)
double Max(double a, double b)
Element_t & operator()(unsigned int i, unsigned int j)
Element_t operator[](unsigned int i) const
bool operator==(const Tenzor< T, D > &that) const
Element_t & operator()(const std::pair< int, int > i)
Tenzor(const T &x00, const T &x10, const T &x01, const T &x11)
Message & getMessage(Message &m)
Tenzor< T, D > & operator/=(const Tenzor< T1, D > &rhs)
Element_t operator()(unsigned int i) const
Element_t operator()(unsigned int i, unsigned int j) const
Tenzor< T, D > & operator*=(const T &rhs)
Tenzor(const Tenzor< T, D > &rhs)
Tenzor< T, D > & operator+=(const T &rhs)
const Tenzor< T, D > & operator=(const Tenzor< T, D > &rhs)
Tenzor(const T &x00, const T &x10, const T &x20, const T &x01, const T &x11, const T &x21, const T &x02, const T &x12, const T &x22)
Tenzor(const AntiSymTenzor< T, D > &)
Element_t operator()(const std::pair< int, int > i) const
Tenzor< T, D > & operator-=(const T &rhs)
Element_t & operator()(unsigned int i)
Tenzor< T, D > & operator*=(const Tenzor< T1, D > &rhs)
Tenzor< T, D > & operator-=(const Tenzor< T1, D > &rhs)
Tenzor< T, D > & operator/=(const T &rhs)
bool operator!=(const Tenzor< T, D > &that) const
void diagonal(const T &rhs)
Message & putMessage(Message &m) const
Tenzor< T, D > & operator+=(const Tenzor< T1, D > &rhs)
Tenzor(const SymTenzor< T, D > &)
Element_t & operator[](unsigned int i)
static bool apply(const T1 *lhs, const T2 *rhs)
Message & setCopy(const bool c)
PETE_ComputeBinaryType< T1, T2, Op, Op::tag >::type type