4#ifndef ROOT_Math_Expression
5#define ROOT_Math_Expression
63template <
class ExprType,
class T,
unsigned int D >
77 inline T apply(
unsigned int i)
const {
88 static const unsigned int rows = D;
105 return rhs_.IsInUse(p);
110 std::ostream&
print(std::ostream& os)
const {
111 os.setf(std::ios::right,std::ios::adjustfield);
115 os <<
apply(i) <<
", ";
134template <
class T,
unsigned int D,
unsigned int D2>
class MatRepStd;
136template <
class ExprType,
class T,
unsigned int D,
unsigned int D2 = 1,
151 return rhs_.apply(i);
162 return rhs_.IsInUse(p);
169 static const unsigned int rows = D;
171 static const unsigned int cols = D2;
184 std::ostream&
print(std::ostream& os)
const {
185 os.setf(std::ios::right,std::ios::adjustfield);
187 for (
unsigned int i=0; i < D; ++i) {
188 unsigned int d2 = D2;
189 for (
unsigned int j=0; j < D2; ++j) {
190 os << std::setw(12) << this->
operator() (i,j);
191 if ((!((j+1)%12)) && (j < d2-1))
192 os << std::endl <<
" ...";
195 os << std::endl <<
" ";
209template <
class A,
class T,
unsigned int D>
211 return rhs.
print(os);
214template <
class A,
class T,
unsigned int D1,
unsigned int D2,
class R1>
216 return rhs.
print(os);
233template <
class Operator,
class LHS,
class RHS,
class T>
237 BinaryOp( Operator ,
const LHS& lhs,
const RHS& rhs) :
245 return Operator::apply(
lhs_.apply(i),
rhs_.apply(i));
248 return Operator::apply(
lhs_(i,j),
rhs_(i,j) );
252 return lhs_.IsInUse(p) ||
rhs_.IsInUse(p);
276template <
class Operator,
class LHS,
class RHS,
class T>
288 return Operator::apply(
lhs_.apply(i),
rhs_.apply(i));
291 return Operator::apply(
lhs_(i,j),
rhs_(i,j) );
296 return rhs_.IsInUse(p);
317template <
class Operator,
class LHS,
class RHS,
class T>
329 return Operator::apply(
lhs_.apply(i),
rhs_.apply(i));
332 return Operator::apply(
lhs_(i,j),
rhs_(i,j) );
337 return lhs_.IsInUse(p);
360template <
class Operator,
class RHS,
class T>
372 return Operator::apply(
rhs_.apply(i));
375 return Operator::apply(
rhs_(i,j));
379 return rhs_.IsInUse(p);
Binary Operation class with value storage for the left argument.
T operator()(unsigned int i, unsigned int j) const
T apply(unsigned int i) const
BinaryOpCopyL(Operator, const LHS &lhs, const RHS &rhs)
bool IsInUse(const T *p) const
Binary Operation class with value storage for the right argument.
bool IsInUse(const T *p) const
BinaryOpCopyR(Operator, const LHS &lhs, const RHS &rhs)
T operator()(unsigned int i, unsigned int j) const
T apply(unsigned int i) const
BinaryOperation class A class representing binary operators in the parse tree.
BinaryOp(Operator, const LHS &lhs, const RHS &rhs)
T apply(unsigned int i) const
bool IsInUse(const T *p) const
T operator()(unsigned int i, unsigned int j) const
Constant expression class A class representing constant expressions (literals) in the parse tree.
T apply(unsigned int) const
T operator()(unsigned int, unsigned int) const
T apply(unsigned int i) const
std::ostream & print(std::ostream &os) const
used by operator<<() simplify to use apply(i,j)
Expr(const ExprType &rhs)
T operator()(unsigned int i, unsigned j) const
bool IsInUse(const T *p) const
function to determine if any use operand is being used (has same memory adress)
Expression wrapper class for Matrix objects.
UnaryOperation class A class representing unary operators in the parse tree.
T apply(unsigned int i) const
UnaryOp(Operator, const RHS &rhs)
bool IsInUse(const T *p) const
T operator()(unsigned int i, unsigned int j) const
Expression wrapper class for Vector objects.
T apply(unsigned int i) const
VecExpr(const ExprType &rhs)
bool IsInUse(const T *p) const
function to determine if any use operand is being used (has same memory adress)
T operator()(unsigned int i) const
std::ostream & print(std::ostream &os) const
used by operator<<()
Namespace for new Math classes and functions.
std::ostream & operator<<(std::ostream &os, const AxisAngle &a)
Stream Output and Input.
#define R1(v, w, x, y, z, i)