11 #ifndef ANTI_SYM_TENZOR_H
12 #define ANTI_SYM_TENZOR_H
36 template<
class T,
unsigned D>
62 "Number of arguments does not match AntiSymTenzor dimension!!");
63 X[0]= x10;
X[1]= x20;
X[2]= x21;
75 for (
int i=1; i<D; ++i) {
76 for (
int j=0; j<i; ++j)
77 (*
this)[((i-1)*i/2)+j] = (t(i,j)-t(j,i))*0.5;
149 int size(
void)
const {
return sizeof(*this); }
188 return -
X[((j-1)*j/2) + i];
190 return X[((i-1)*i/2) + j];
196 return (*
this)(i, j);
204 int lo = i < j ? i : j;
205 int hi = i > j ? i : j;
213 return (*
this)(i, j);
244 return !(*
this == that);
275 template<
class T,
unsigned int D>
299 class DontInitialize {};
316 PInsist(rhs==0,
"Cannot assign non-zero value to a 1D AntiSymTenzor!");
350 int size(
void)
const {
return sizeof(*this); }
356 : elem_m(elem), where_m(where) {}
358 : elem_m(model.elem_m), where_m(model.where_m) {}
361 PAssert_EQ(where_m != 0 || a.elem_m == -a.elem_m,
true);
362 elem_m = where_m < 0 ? -a.elem_m : a.elem_m;
368 elem_m = where_m < 0 ? -e :
e;
374 return (where_m < 0 ? -elem_m : elem_m);
393 return (*
this)(i, j);
404 return (*
this)(i, j);
425 return !(*
this == that);
468 template <
class T,
unsigned D>
473 template <
class T,
unsigned D>
510 template <
class T,
unsigned D>
512 PInsist(D<4,
"AntiSymTenzor cofactors() function not implemented for D>3!");
521 result(0,0) = rhs(1,1)*rhs(2,2) - rhs(1,2)*rhs(2,1);
522 result(1,0) = rhs(0,2)*rhs(2,1) - rhs(0,1)*rhs(2,2);
523 result(2,0) = rhs(0,1)*rhs(1,2) - rhs(1,1)*rhs(0,2);
524 result(0,1) = rhs(2,0)*rhs(1,2) - rhs(1,0)*rhs(2,2);
525 result(1,1) = rhs(0,0)*rhs(2,2) - rhs(0,2)*rhs(2,0);
526 result(2,1) = rhs(1,0)*rhs(0,2) - rhs(0,0)*rhs(1,2);
527 result(0,2) = rhs(1,0)*rhs(2,1) - rhs(2,0)*rhs(1,1);
528 result(1,2) = rhs(0,1)*rhs(2,0) - rhs(0,0)*rhs(2,1);
529 result(2,2) = rhs(0,0)*rhs(1,1) - rhs(1,0)*rhs(0,1);
538 result(0,0) = rhs(1,1);
539 result(1,0) = -rhs(0,1);
540 result(0,1) = -rhs(1,0);
541 result(1,1) = rhs(0,0);
562 template<
class T,
unsigned D>
570 template<
class T,
unsigned D>
597 template < class T1, class T2,
unsigned D >
599 dot(const AntiSymTenzor<T1,D> &lhs, const AntiSymTenzor<T2,D> &rhs)
605 template <
class T1,
class T2,
unsigned D >
613 template <
class T1,
class T2,
unsigned D >
621 template <
class T1,
class T2,
unsigned D >
629 template <
class T1,
class T2,
unsigned D >
637 template <
class T1,
class T2,
unsigned D >
644 template <
class T1,
class T2,
unsigned D >
655 template <
class T1,
class T2,
unsigned D >
663 template <
class T1,
class T2,
unsigned D >
671 template <
class T1,
class T2,
unsigned D >
679 template <
class T1,
class T2,
unsigned D >
687 template <
class T1,
class T2,
unsigned D >
697 template<
class T,
unsigned D>
698 inline std::ostream& operator<<(std::ostream& out, const AntiSymTenzor<T,D>& rhs) {
700 for (
int i=0; i<D; i++) {
702 for (
int j=0; j<D-1; j++) {
703 out << rhs(i,j) <<
" , ";
705 out << rhs(i,D-1) <<
")";
709 out <<
"( " << rhs(0,0) <<
" )";
716 #endif // ANTI_SYM_TENZOR_H
Matrix< T > operator+(const Matrix< T > &, const Matrix< T > &)
Matrix addition.
Element_t operator()(unsigned int i) const
AssignProxy(Element_t &elem, int where)
AntiSymTenzor(const T &x00)
Element_t operator()(unsigned int i) const
constexpr double e
The value of .
Element_t operator()(std::pair< int, int > a) const
Element_t operator[](unsigned int i) const
AntiSymTenzor(const AntiSymTenzor< T, 1 > &)
PETEBinaryReturn< T1, T2, OpMultipply >::type dotdot(const AntiSymTenzor< T1, D > &lhs, const AntiSymTenzor< T2, D > &rhs)
bool operator==(const AntiSymTenzor< T, 1 > &that) const
T det(const AntiSymTenzor< T, 3 > &t)
AntiSymTenzor(const T &x10, const T &x20, const T &x21)
const AssignProxy & operator=(const AssignProxy &a)
AntiSymTenzor< T, D > transpose(const AntiSymTenzor< T, D > &rhs)
AssignProxy operator()(std::pair< int, int > a)
AssignProxy operator()(unsigned int i, unsigned int j)
AntiSymTenzor< T, 1 > & operator/=(const T &)
AntiSymTenzor< T, 1 > & operator+=(const AntiSymTenzor< T1, 1 > &)
Message & putMessage(Message &m) const
AssignProxy operator()(std::pair< int, int > a)
AntiSymTenzor< T, D > & operator-=(const AntiSymTenzor< T1, D > &rhs)
AssignProxy(Element_t &elem, int where)
Element_t operator()(unsigned int i, unsigned int j) const
const AssignProxy & operator=(const AssignProxy &a)
Element_t operator()(unsigned int i, unsigned int j) const
AntiSymTenzor< T, 1 > & operator/=(const AntiSymTenzor< T1, 1 > &)
double dot(const Vector3D &lhs, const Vector3D &rhs)
Vector dot product.
Tenzor< T, D > cofactors(const AntiSymTenzor< T, D > &rhs)
const AssignProxy & operator=(const Element_t &e)
Element_t operator()(std::pair< int, int > a) const
AntiSymTenzor< T, D > & operator+=(const AntiSymTenzor< T1, D > &rhs)
Element_t & operator[](unsigned int i)
const AntiSymTenzor< T, D > & operator=(const AntiSymTenzor< T, D > &rhs)
AntiSymTenzor(const AntiSymTenzor< T, D > &rhs)
double Max(double a, double b)
const AntiSymTenzor< T, 1 > & operator=(const AntiSymTenzor< T, 1 > &)
const AntiSymTenzor< T, 1 > & operator=(const T &rhs)
const AntiSymTenzor< T, 1 > & operator=(const AntiSymTenzor< T1, 1 > &)
AssignProxy(const AssignProxy &model)
PETE_TTTree< OpWhere, typename Cond_t::PETE_Expr_t, typename True_t::PETE_Expr_t, PETE_Scalar< Vektor< T, Dim > > > where(const PETE_Expr< Cond_t > &c, const PETE_Expr< True_t > &t, const Vektor< T, Dim > &f)
Element_t & operator()(unsigned int i)
bool operator!=(const AntiSymTenzor< T, 1 > &that) const
AntiSymTenzor< T, D > & operator/=(const AntiSymTenzor< T1, D > &rhs)
bool operator==(const AntiSymTenzor< T, D > &that) const
Message & putMessage(Message &m) const
Message & get(const T &cval)
Message & put(const T &val)
AntiSymTenzor(DontInitialize)
double Min(double a, double b)
PETE_ComputeBinaryType< PETE_Type2Index< T1 >::val, PETE_Type2Index< T2 >::val, Op::tag >::type type
Message & getMessage(Message &m)
AntiSymTenzor< T, 1 > & operator*=(const T &)
BOOST_UBLAS_INLINE V trace(ublas::matrix< V > &e)
Computes the trace of a square matrix.
const AssignProxy & operator=(const Element_t &e)
AntiSymTenzor(const Tenzor< T, 1 > &t)
AntiSymTenzor< T, D > & operator*=(const T &rhs)
AntiSymTenzor< T, D > & operator*=(const AntiSymTenzor< T1, D > &rhs)
AntiSymTenzor< T, 1 > & operator*=(const AntiSymTenzor< T1, 1 > &)
AssignProxy operator()(unsigned int i, unsigned int j)
AntiSymTenzor< T, D > & operator/=(const T &rhs)
AssignProxy(const AssignProxy &model)
Message & getMessage(Message &m)
Matrix< T > operator-(const Matrix< T > &, const Matrix< T > &)
Matrix subtraction.
#define TSV_ELEMENTWISE_OPERATOR(TSV, OP, APP)
bool operator!=(const AntiSymTenzor< T, D > &that) const
Element_t operator[](unsigned int i) const
AntiSymTenzor< T, 1 > & operator-=(const AntiSymTenzor< T1, 1 > &)
Message & setCopy(const bool c)
AntiSymTenzor(const Tenzor< T, D > &t)
AntiSymTenzor(DontInitialize)