4 #ifndef ROOT_Math_Expression 5 #define ROOT_Math_Expression 63 template <
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) <<
", ";
134 template <
class T,
unsigned int D,
unsigned int D2>
class MatRepStd;
136 template <
class ExprType,
class T,
unsigned int D,
unsigned int D2 = 1,
150 inline T
apply(
unsigned int i)
const {
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 <<
" ";
209 template <
class A,
class T,
unsigned int D>
210 inline std::ostream& operator<<(std::ostream& os, const VecExpr<A,T,D>& rhs) {
211 return rhs.print(os);
214 template <
class A,
class T,
unsigned int D1,
unsigned int D2,
class R1>
215 inline std::ostream& operator<<(std::ostream& os, const Expr<A,T,D1,D2,R1>& rhs) {
216 return rhs.print(os);
233 template <
class Operator,
class LHS,
class RHS,
class T>
237 BinaryOp( Operator ,
const LHS& lhs,
const RHS& rhs) :
238 lhs_(lhs),
rhs_(rhs) {}
244 inline T
apply(
unsigned int i)
const {
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);
276 template <
class Operator,
class LHS,
class RHS,
class T>
281 lhs_(lhs),
rhs_(rhs) {}
287 inline T
apply(
unsigned int i)
const {
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);
317 template <
class Operator,
class LHS,
class RHS,
class T>
322 lhs_(lhs),
rhs_(rhs) {}
328 inline T
apply(
unsigned int i)
const {
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);
360 template <
class Operator,
class RHS,
class T>
371 inline T
apply(
unsigned int i)
const {
372 return Operator::apply(
rhs_.apply(i));
375 return Operator::apply(
rhs_(i,j));
379 return rhs_.IsInUse(p);
Constant expression class A class representing constant expressions (literals) in the parse tree...
Namespace for new ROOT classes and functions.
T apply(unsigned int i) const
BinaryOpCopyR(Operator, const LHS &lhs, const RHS &rhs)
Binary Operation class with value storage for the left argument.
bool IsInUse(const T *p) const
bool IsInUse(const T *p) const
Expr(const ExprType &rhs)
T apply(unsigned int i) const
Expression wrapper class for Matrix objects.
Binary Operation class with value storage for the right argument.
std::ostream & print(std::ostream &os) const
used by operator<<() simplify to use apply(i,j)
bool IsInUse(const T *p) const
function to determine if any use operand is being used (has same memory adress)
bool IsInUse(const T *p) const
BinaryOperation class A class representing binary operators in the parse tree.
UnaryOperation class A class representing unary operators in the parse tree.
VecExpr(const ExprType &rhs)
T apply(unsigned int i) const
BinaryOp(Operator, const LHS &lhs, const RHS &rhs)
T apply(unsigned int i) const
T operator()(unsigned int i) const
BinaryOpCopyL(Operator, const LHS &lhs, const RHS &rhs)
Namespace for new Math classes and functions.
Expression wrapper class for Vector objects.
bool IsInUse(const T *p) const
function to determine if any use operand is being used (has same memory adress)
T apply(unsigned int) const
UnaryOp(Operator, const RHS &rhs)
T apply(unsigned int i) const
std::ostream & print(std::ostream &os) const
used by operator<<()
bool IsInUse(const T *p) const
T apply(unsigned int i) const