// @(#)root/smatrix:$Id: UnaryOperators.h 20882 2007-11-19 11:31:26Z rdm $ // Authors: T. Glebe, L. Moneta 2005 #ifndef ROOT_Math_UnaryOperators #define ROOT_Math_UnaryOperators //====================================================== // // ATTENTION: This file was automatically generated, // do not edit! // // author: Thorsten Glebe // HERA-B Collaboration // Max-Planck-Institut fuer Kernphysik // Saupfercheckweg 1 // 69117 Heidelberg // Germany // E-mail: T.Glebe@mpi-hd.mpg.de // //====================================================== #include namespace ROOT { namespace Math { template class SVector; template class SMatrix; /** Unary Minus Operation Class @ingroup Expression */ //============================================================================== // Minus //============================================================================== template class Minus { public: static inline T apply(const T& rhs) { return -(rhs); } }; //============================================================================== // operator- (Expr, unary) //============================================================================== template inline VecExpr, VecExpr, T>, T, D> operator-(const VecExpr& rhs) { typedef UnaryOp, VecExpr, T> MinusUnaryOp; return VecExpr(MinusUnaryOp(Minus(),rhs)); } /** Unary - operator v2 = -v1 . returning a vector expression @ingroup VectFunction */ //============================================================================== // operator- (SVector, unary) //============================================================================== template inline VecExpr, SVector, T>, T, D> operator-(const SVector& rhs) { typedef UnaryOp, SVector, T> MinusUnaryOp; return VecExpr(MinusUnaryOp(Minus(),rhs)); } //============================================================================== // operator- (MatrixExpr, unary) //============================================================================== template inline Expr, Expr, T>, T, D, D2,R> operator-(const Expr& rhs) { typedef UnaryOp, Expr, T> MinusUnaryOp; return Expr(MinusUnaryOp(Minus(),rhs)); } /** Unary - operator B = - A returning a matrix expression @ingroup MatrixFunctions */ //============================================================================== // operator- (SMatrix, unary) //============================================================================== template inline Expr, SMatrix, T>, T, D, D2,R> operator-(const SMatrix& rhs) { typedef UnaryOp, SMatrix, T> MinusUnaryOp; return Expr(MinusUnaryOp(Minus(),rhs)); } //============================================================================== // Fabs //============================================================================== /** Unary abs Operation Class @ingroup Expression */ template class Fabs { public: static inline T apply(const T& rhs) { return std::abs(rhs); } }; //============================================================================== // fabs (Expr, unary) //============================================================================== template inline VecExpr, VecExpr, T>, T, D> fabs(const VecExpr& rhs) { typedef UnaryOp, VecExpr, T> FabsUnaryOp; return VecExpr(FabsUnaryOp(Fabs(),rhs)); } /** abs of a vector : v2(i) = | v1(i) | returning a vector expression @ingroup VectFunction */ //============================================================================== // fabs (SVector, unary) //============================================================================== template inline VecExpr, SVector, T>, T, D> fabs(const SVector& rhs) { typedef UnaryOp, SVector, T> FabsUnaryOp; return VecExpr(FabsUnaryOp(Fabs(),rhs)); } //============================================================================== // fabs (MatrixExpr, unary) //============================================================================== template inline Expr, Expr, T>, T, D, D2, R> fabs(const Expr& rhs) { typedef UnaryOp, Expr, T> FabsUnaryOp; return Expr(FabsUnaryOp(Fabs(),rhs)); } /** abs of a matrix m2(i,j) = | m1(i,j) | returning a matrix epression @ingroup MatrixFunctions */ //============================================================================== // fabs (SMatrix, unary) //============================================================================== template inline Expr, SMatrix, T>, T, D, D2, R> fabs(const SMatrix& rhs) { typedef UnaryOp, SMatrix, T> FabsUnaryOp; return Expr(FabsUnaryOp(Fabs(),rhs)); } /** Unary Square Operation Class @ingroup Expression */ //============================================================================== // Sqr //============================================================================== template class Sqr { public: static inline T apply(const T& rhs) { return square(rhs); } }; //============================================================================== // sqr (Expr, unary) //============================================================================== template inline VecExpr, VecExpr, T>, T, D> sqr(const VecExpr& rhs) { typedef UnaryOp, VecExpr, T> SqrUnaryOp; return VecExpr(SqrUnaryOp(Sqr(),rhs)); } /** square of a vector v2(i) = v1(i)*v1(i) . returning a vector expression @ingroup VectFunction */ //============================================================================== // sqr (SVector, unary) //============================================================================== template inline VecExpr, SVector, T>, T, D> sqr(const SVector& rhs) { typedef UnaryOp, SVector, T> SqrUnaryOp; return VecExpr(SqrUnaryOp(Sqr(),rhs)); } //============================================================================== // sqr (MatrixExpr, unary) //============================================================================== template inline Expr, Expr, T>, T, D, D2, R> sqr(const Expr& rhs) { typedef UnaryOp, Expr, T> SqrUnaryOp; return Expr(SqrUnaryOp(Sqr(),rhs)); } /** square of a matrix B(i,j) = A(i,j)*A(i,j) returning a matrix expression @ingroup MatrixFunctions */ //============================================================================== // sqr (SMatrix, unary) //============================================================================== template inline Expr, SMatrix, T>, T, D, D2, R> sqr(const SMatrix& rhs) { typedef UnaryOp, SMatrix, T> SqrUnaryOp; return Expr(SqrUnaryOp(Sqr(),rhs)); } //============================================================================== // Sqrt //============================================================================== /** Unary Square Root Operation Class @ingroup Expression */ template class Sqrt { public: static inline T apply(const T& rhs) { return std::sqrt(rhs); } }; //============================================================================== // sqrt (VecExpr, unary) //============================================================================== template inline VecExpr, VecExpr, T>, T, D> sqrt(const VecExpr& rhs) { typedef UnaryOp, VecExpr, T> SqrtUnaryOp; return VecExpr(SqrtUnaryOp(Sqrt(),rhs)); } /** square root of a vector (element by element) v2(i) = sqrt( v1(i) ) returning a vector expression @ingroup VectFunction */ //============================================================================== // sqrt (SVector, unary) //============================================================================== template inline VecExpr, SVector, T>, T, D> sqrt(const SVector& rhs) { typedef UnaryOp, SVector, T> SqrtUnaryOp; return VecExpr(SqrtUnaryOp(Sqrt(),rhs)); } //============================================================================== // sqrt (MatrixExpr, unary) //============================================================================== template inline Expr, Expr, T>, T, D, D2, R> sqrt(const Expr& rhs) { typedef UnaryOp, Expr, T> SqrtUnaryOp; return Expr(SqrtUnaryOp(Sqrt(),rhs)); } /** square root of a matrix (element by element) m2(i,j) = sqrt ( m1(i,j) ) returning a matrix expression @ingroup MatrixFunctions */ //============================================================================== // sqrt (SMatrix, unary) //============================================================================== template inline Expr, SMatrix, T>, T, D, D2, R> sqrt(const SMatrix& rhs) { typedef UnaryOp, SMatrix, T> SqrtUnaryOp; return Expr(SqrtUnaryOp(Sqrt(),rhs)); } } // namespace Math } // namespace ROOT #endif /* ROOT_Math_UnaryOperators */