4#ifndef ROOT_Math_BinaryOperators
5#define ROOT_Math_BinaryOperators
30template <
class T,
unsigned int D>
class SVector;
31template <
class T,
unsigned int D1,
unsigned int D2,
class R>
class SMatrix;
45 static inline T apply(
const T& lhs,
const T& rhs) {
60template <
class T,
unsigned int D>
61inline VecExpr<BinaryOp<AddOp<T>, SVector<T,D>, SVector<T,D>,
T>,
T, D>
72template <
class A,
class T,
unsigned int D>
73inline VecExpr<BinaryOp<AddOp<T>, VecExpr<A,T,D>, SVector<T,D>,
T>,
T, D>
84template <
class A,
class T,
unsigned int D>
85inline VecExpr<BinaryOp<AddOp<T>, SVector<T,D>, VecExpr<A,T,D>,
T>,
T, D>
96template <
class A,
class B,
class T,
unsigned int D>
97inline VecExpr<BinaryOp<AddOp<T>, VecExpr<A,T,D>, VecExpr<B,T,D>,
T>,
T, D>
114template <
class A,
class T,
unsigned int D>
115inline VecExpr<BinaryOpCopyR<AddOp<T>, SVector<T,D>, Constant<A>,
T>,
T, D>
131template <
class A,
class T,
unsigned int D>
132inline VecExpr<BinaryOpCopyL<AddOp<T>, Constant<A>, SVector<T,D>,
T>,
T, D>
143template <
class A,
class B,
class T,
unsigned int D>
144inline VecExpr<BinaryOpCopyR<AddOp<T>, VecExpr<B,T,D>, Constant<A>,
T>,
T, D>
154template <
class A,
class B,
class T,
unsigned int D>
155inline VecExpr<BinaryOpCopyL<AddOp<T>, Constant<A>, VecExpr<B,T,D>,
T>,
T, D>
172template <
class T,
unsigned int D,
unsigned int D2,
class R1,
class R2>
173inline Expr<BinaryOp<AddOp<T>, SMatrix<T,D,D2,R1>, SMatrix<T,D,D2,R2>,
T>,
T, D, D2,
typename AddPolicy<T,D,D2,R1,R2>::RepType >
177 return Expr<AddOpBinOp,T,D,D2,typename AddPolicy<T,D,D2,R1,R2>::RepType>(AddOpBinOp(
AddOp<T>(),lhs,rhs));
184template <
class A,
class T,
unsigned int D,
unsigned int D2,
class R1,
class R2>
185inline Expr<BinaryOp<AddOp<T>, Expr<A,T,D,D2,R1>, SMatrix<T,D,D2,R2>,
T>,
T, D, D2,
typename AddPolicy<T,D,D2,R1,R2>::RepType>
187 typedef BinaryOp<AddOp<T>,
Expr<A,T,D,D2,R1>,
SMatrix<T,D,D2,R2>,
T> AddOpBinOp;
189 return Expr<AddOpBinOp,T,D,D2,typename AddPolicy<T,D,D2,R1,R2>::RepType>(AddOpBinOp(
AddOp<T>(),lhs,rhs));
196template <
class A,
class T,
unsigned int D,
unsigned int D2,
class R1,
class R2>
197inline Expr<BinaryOp<AddOp<T>, SMatrix<T,D,D2,R1>, Expr<A,T,D,D2,R2>,
T>,
T, D, D2,
typename AddPolicy<T,D,D2,R1,R2>::RepType>
199 typedef BinaryOp<AddOp<T>,
SMatrix<T,D,D2,R1>,
Expr<A,T,D,D2,R2>,
T> AddOpBinOp;
201 return Expr<AddOpBinOp,T,D,D2,typename AddPolicy<T,D,D2,R1,R2>::RepType>(AddOpBinOp(
AddOp<T>(),lhs,rhs));
208template <
class A,
class B,
class T,
unsigned int D,
unsigned int D2,
class R1,
class R2>
209inline Expr<BinaryOp<AddOp<T>, Expr<A,T,D,D2,R1>, Expr<B,T,D,D2,R2>,
T>,
T, D, D2,
typename AddPolicy<T,D,D2,R1,R2>::RepType >
211 typedef BinaryOp<AddOp<T>,
Expr<A,T,D,D2,R1>,
Expr<B,T,D,D2,R2>,
T> AddOpBinOp;
213 return Expr<AddOpBinOp,T,D,D2,typename AddPolicy<T,D,D2,R1,R2>::RepType>(AddOpBinOp(
AddOp<T>(),lhs,rhs));
226template <
class A,
class T,
unsigned int D,
unsigned int D2,
class R>
227inline Expr<BinaryOpCopyR<AddOp<T>, SMatrix<T,D,D2,R>, Constant<A>,
T>,
T, D, D2,
R>
243template <
class A,
class T,
unsigned int D,
unsigned int D2,
class R>
244inline Expr<BinaryOpCopyL<AddOp<T>, Constant<A>, SMatrix<T,D,D2,R>,
T>,
T, D, D2,
R>
256template <
class A,
class B,
class T,
unsigned int D,
unsigned int D2,
class R>
257inline Expr<BinaryOpCopyR<AddOp<T>, Expr<B,T,D,D2,R>, Constant<A>,
T>,
T, D, D2,
R>
268template <
class A,
class B,
class T,
unsigned int D,
unsigned int D2,
class R>
269inline Expr<BinaryOpCopyL<AddOp<T>, Constant<A>, Expr<B,T,D,D2,R>,
T>,
T, D, D2,
R>
289 static inline T apply(
const T& lhs,
const T& rhs) {
304template <
class T,
unsigned int D>
305inline VecExpr<BinaryOp<MinOp<T>, SVector<T,D>, SVector<T,D>,
T>,
T, D>
316template <
class A,
class T,
unsigned int D>
317inline VecExpr<BinaryOp<MinOp<T>, VecExpr<A,T,D>, SVector<T,D>,
T>,
T, D>
328template <
class A,
class T,
unsigned int D>
329inline VecExpr<BinaryOp<MinOp<T>, SVector<T,D>, VecExpr<A,T,D>,
T>,
T, D>
340template <
class A,
class B,
class T,
unsigned int D>
341inline VecExpr<BinaryOp<MinOp<T>, VecExpr<A,T,D>, VecExpr<B,T,D>,
T>,
T, D>
358template <
class A,
class T,
unsigned int D>
359inline VecExpr<BinaryOpCopyR<MinOp<T>, SVector<T,D>, Constant<A>,
T>,
T, D>
375template <
class A,
class T,
unsigned int D>
376inline VecExpr<BinaryOpCopyL<MinOp<T>, Constant<A>, SVector<T,D>,
T>,
T, D>
387template <
class A,
class B,
class T,
unsigned int D>
388inline VecExpr<BinaryOpCopyR<MinOp<T>, VecExpr<B,T,D>, Constant<A>,
T>,
T, D>
398template <
class A,
class B,
class T,
unsigned int D>
399inline VecExpr<BinaryOpCopyL<MinOp<T>, Constant<A>, VecExpr<B,T,D>,
T>,
T, D>
416template <
class T,
unsigned int D,
unsigned int D2,
class R1,
class R2>
417inline Expr<BinaryOp<MinOp<T>, SMatrix<T,D,D2,R1>, SMatrix<T,D,D2,R2>,
T>,
T, D, D2,
typename AddPolicy<T,D,D2,R1,R2>::RepType>
421 return Expr<MinOpBinOp,T,D,D2,typename AddPolicy<T,D,D2,R1,R2>::RepType>(MinOpBinOp(
MinOp<T>(),lhs,rhs));
428template <
class A,
class T,
unsigned int D,
unsigned int D2,
class R1,
class R2>
429inline Expr<BinaryOp<MinOp<T>, Expr<A,T,D,D2,R1>, SMatrix<T,D,D2,R2>,
T>,
T, D, D2,
typename AddPolicy<T,D,D2,R1,R2>::RepType>
431 typedef BinaryOp<MinOp<T>,
Expr<A,T,D,D2,R1>,
SMatrix<T,D,D2,R2>,
T> MinOpBinOp;
433 return Expr<MinOpBinOp,T,D,D2,typename AddPolicy<T,D,D2,R1,R2>::RepType>(MinOpBinOp(
MinOp<T>(),lhs,rhs));
440template <
class A,
class T,
unsigned int D,
unsigned int D2,
class R1,
class R2>
441inline Expr<BinaryOp<MinOp<T>, SMatrix<T,D,D2,R1>, Expr<A,T,D,D2,R2>,
T>,
T, D, D2,
typename AddPolicy<T,D,D2,R1,R2>::RepType>
443 typedef BinaryOp<MinOp<T>,
SMatrix<T,D,D2,R1>,
Expr<A,T,D,D2,R2>,
T> MinOpBinOp;
445 return Expr<MinOpBinOp,T,D,D2,typename AddPolicy<T,D,D2,R1,R2>::RepType>(MinOpBinOp(
MinOp<T>(),lhs,rhs));
452template <
class A,
class B,
class T,
unsigned int D,
unsigned int D2,
class R1,
class R2>
453inline Expr<BinaryOp<MinOp<T>, Expr<A,T,D,D2,R1>, Expr<B,T,D,D2,R2>,
T>,
T, D, D2,
typename AddPolicy<T,D,D2,R1,R2>::RepType>
455 typedef BinaryOp<MinOp<T>,
Expr<A,T,D,D2,R1>,
Expr<B,T,D,D2,R2>,
T> MinOpBinOp;
457 return Expr<MinOpBinOp,T,D,D2,typename AddPolicy<T,D,D2,R1,R2>::RepType>(MinOpBinOp(
MinOp<T>(),lhs,rhs));
470template <
class A,
class T,
unsigned int D,
unsigned int D2,
class R>
471inline Expr<BinaryOpCopyR<MinOp<T>, SMatrix<T,D,D2,R>, Constant<A>,
T>,
T, D, D2,
R>
488template <
class A,
class T,
unsigned int D,
unsigned int D2,
class R>
489inline Expr<BinaryOpCopyL<MinOp<T>, Constant<A>, SMatrix<T,D,D2,R>,
T>,
T, D, D2,
R>
499template <
class A,
class B,
class T,
unsigned int D,
unsigned int D2,
class R>
500inline Expr<BinaryOpCopyR<MinOp<T>, Expr<B,T,D,D2,R>, Constant<A>,
T>,
T, D, D2,
R>
510template <
class A,
class B,
class T,
unsigned int D,
unsigned int D2,
class R>
511inline Expr<BinaryOpCopyL<MinOp<T>, Constant<A>, Expr<B,T,D,D2,R>,
T>,
T, D, D2,
R>
531 static inline T apply(
const T& lhs,
const T& rhs) {
546template <
class T,
unsigned int D>
547inline VecExpr<BinaryOp<MulOp<T>, SVector<T,D>, SVector<T,D>,
T>,
T, D>
564template <
class A,
class T,
unsigned int D>
565inline VecExpr<BinaryOp<MulOp<T>, Expr<A,T,D>, SVector<T,D>,
T>,
T, D>
575template <
class A,
class T,
unsigned int D>
576inline VecExpr<BinaryOp<MulOp<T>, SVector<T,D>, VecExpr<A,T,D>,
T>,
T, D>
586template <
class A,
class B,
class T,
unsigned int D>
587inline VecExpr<BinaryOp<MulOp<T>, VecExpr<A,T,D>, VecExpr<B,T,D>,
T>,
T, D>
597template <
class A,
class T,
unsigned int D>
598inline VecExpr<BinaryOpCopyR<MulOp<T>, SVector<T,D>, Constant<A>,
T>,
T, D>
608template <
class A,
class T,
unsigned int D>
609inline VecExpr<BinaryOpCopyL<MulOp<T>, Constant<A>, SVector<T,D>,
T>,
T, D>
620template <
class A,
class B,
class T,
unsigned int D>
621inline VecExpr<BinaryOpCopyR<MulOp<T>, VecExpr<B,T,D>, Constant<A>,
T>,
T, D>
631template <
class A,
class B,
class T,
unsigned int D>
632inline VecExpr<BinaryOpCopyL<MulOp<T>, Constant<A>, VecExpr<B,T,D>,
T>,
T, D>
650template <
class T,
unsigned int D,
unsigned int D2,
class R1,
class R2>
651inline Expr<BinaryOp<MulOp<T>, SMatrix<T,D,D2,R1>, SMatrix<T,D,D2,R2>,
T>,
T, D, D2,
typename AddPolicy<T,D,D2,R1,R2>::RepType>
655 return Expr<MulOpBinOp,T,D,D2,typename AddPolicy<T,D,D2,R1,R2>::RepType>(MulOpBinOp(
MulOp<T>(),lhs,rhs));
662template <
class A,
class T,
unsigned int D,
unsigned int D2,
class R1,
class R2>
663inline Expr<BinaryOp<MulOp<T>, Expr<A,T,D,D2,R1>, SMatrix<T,D,D2,R2>,
T>,
T, D, D2,
typename AddPolicy<T,D,D2,R1,R2>::RepType>
665 typedef BinaryOp<MulOp<T>,
Expr<A,T,D,D2,R1>,
SMatrix<T,D,D2,R2>,
T> MulOpBinOp;
667 return Expr<MulOpBinOp,T,D,D2,typename AddPolicy<T,D,D2,R1,R2>::RepType>(MulOpBinOp(
MulOp<T>(),lhs,rhs));
674template <
class A,
class T,
unsigned int D,
unsigned int D2,
class R1,
class R2>
675inline Expr<BinaryOp<MulOp<T>, SMatrix<T,D,D2,R1>, Expr<A,T,D,D2,R2>,
T>,
T, D, D2,
typename AddPolicy<T,D,D2,R1,R2>::RepType>
677 typedef BinaryOp<MulOp<T>,
SMatrix<T,D,D2,R1>,
Expr<A,T,D,D2,R2>,
T> MulOpBinOp;
679 return Expr<MulOpBinOp,T,D,D2,typename AddPolicy<T,D,D2,R1,R2>::RepType>(MulOpBinOp(
MulOp<T>(),lhs,rhs));
686template <
class A,
class B,
class T,
unsigned int D,
unsigned int D2,
class R1,
class R2>
687inline Expr<BinaryOp<MulOp<T>, Expr<A,T,D,D2,R1>, Expr<B,T,D,D2,R2>,
T>,
T, D, D2,
typename AddPolicy<T,D,D2,R1,R2>::RepType>
689 typedef BinaryOp<MulOp<T>,
Expr<A,T,D,D2,R1>,
Expr<B,T,D,D2,R2>,
T> MulOpBinOp;
691 return Expr<MulOpBinOp,T,D,D2,typename AddPolicy<T,D,D2,R1,R2>::RepType>(MulOpBinOp(
MulOp<T>(),lhs,rhs));
704template <
class A,
class T,
unsigned int D,
unsigned int D2,
class R>
705inline Expr<BinaryOpCopyR<MulOp<T>, SMatrix<T,D,D2,R>, Constant<A>,
T>,
T, D, D2,
R>
722template <
class A,
class T,
unsigned int D,
unsigned int D2,
class R>
723inline Expr<BinaryOpCopyL<MulOp<T>, Constant<A>, SMatrix<T,D,D2,R>,
T>,
T, D, D2,
R>
735template <
class A,
class B,
class T,
unsigned int D,
unsigned int D2,
class R>
736inline Expr<BinaryOpCopyR<MulOp<T>, Expr<B,T,D,D2,R>, Constant<A>,
T>,
T, D, D2,
R>
747template <
class A,
class B,
class T,
unsigned int D,
unsigned int D2,
class R>
748inline Expr<BinaryOpCopyL<MulOp<T>, Constant<A>, Expr<B,T,D,D2,R>,
T>,
T, D, D2,
R>
768 static inline T apply(
const T& lhs,
const T& rhs) {
782template <
class T,
unsigned int D>
783inline VecExpr<BinaryOp<DivOp<T>, SVector<T,D>, SVector<T,D>,
T>,
T, D>
794template <
class A,
class T,
unsigned int D>
795inline VecExpr<BinaryOp<DivOp<T>, VecExpr<A,T,D>, SVector<T,D>,
T>,
T, D>
805template <
class A,
class T,
unsigned int D>
806inline VecExpr<BinaryOp<DivOp<T>, SVector<T,D>, VecExpr<A,T,D>,
T>,
T, D>
817template <
class A,
class B,
class T,
unsigned int D>
818inline VecExpr<BinaryOp<DivOp<T>, VecExpr<A,T,D>, VecExpr<B,T,D>,
T>,
T, D>
835template <
class A,
class T,
unsigned int D>
836inline VecExpr<BinaryOpCopyR<DivOp<T>, SVector<T,D>, Constant<A>,
T>,
T, D>
852template <
class A,
class T,
unsigned int D>
853inline VecExpr<BinaryOpCopyL<DivOp<T>, Constant<A>, SVector<T,D>,
T>,
T, D>
864template <
class A,
class B,
class T,
unsigned int D>
865inline VecExpr<BinaryOpCopyR<DivOp<T>, VecExpr<B,T,D>, Constant<A>,
T>,
T, D>
875template <
class A,
class B,
class T,
unsigned int D>
876inline VecExpr<BinaryOpCopyL<DivOp<T>, Constant<A>, VecExpr<B,T,D>,
T>,
T, D>
893template <
class T,
unsigned int D,
unsigned int D2,
class R1,
class R2>
894inline Expr<BinaryOp<DivOp<T>, SMatrix<T,D,D2,R1>, SMatrix<T,D,D2,R2>,
T>,
T, D, D2,
typename AddPolicy<T,D,D2,R1,R2>::RepType>
898 return Expr<DivOpBinOp,T,D,D2,typename AddPolicy<T,D,D2,R1,R2>::RepType>(DivOpBinOp(
DivOp<T>(),lhs,rhs));
905template <
class A,
class T,
unsigned int D,
unsigned int D2,
class R1,
class R2>
906inline Expr<BinaryOp<DivOp<T>, Expr<A,T,D,D2,R1>, SMatrix<T,D,D2,R2>,
T>,
T, D, D2,
typename AddPolicy<T,D,D2,R1,R2>::RepType>
908 typedef BinaryOp<DivOp<T>,
Expr<A,T,D,D2,R1>,
SMatrix<T,D,D2,R2>,
T> DivOpBinOp;
910 return Expr<DivOpBinOp,T,D,D2,typename AddPolicy<T,D,D2,R1,R2>::RepType>(DivOpBinOp(
DivOp<T>(),lhs,rhs));
917template <
class A,
class T,
unsigned int D,
unsigned int D2,
class R1,
class R2>
918inline Expr<BinaryOp<DivOp<T>, SMatrix<T,D,D2,R1>, Expr<A,T,D,D2,R2>,
T>,
T, D, D2,
typename AddPolicy<T,D,D2,R1,R2>::RepType>
920 typedef BinaryOp<DivOp<T>,
SMatrix<T,D,D2,R1>,
Expr<A,T,D,D2,R2>,
T> DivOpBinOp;
922 return Expr<DivOpBinOp,T,D,D2,typename AddPolicy<T,D,D2,R1,R2>::RepType>(DivOpBinOp(
DivOp<T>(),lhs,rhs));
929template <
class A,
class B,
class T,
unsigned int D,
unsigned int D2,
class R1,
class R2>
930inline Expr<BinaryOp<DivOp<T>, Expr<A,T,D,D2,R1>, Expr<B,T,D,D2,R2>,
T>,
T, D, D2,
typename AddPolicy<T,D,D2,R1,R2>::RepType>
932 typedef BinaryOp<DivOp<T>,
Expr<A,T,D,D2,R1>,
Expr<B,T,D,D2,R2>,
T> DivOpBinOp;
934 return Expr<DivOpBinOp,T,D,D2,typename AddPolicy<T,D,D2,R1,R2>::RepType>(DivOpBinOp(
DivOp<T>(),lhs,rhs));
947template <
class A,
class T,
unsigned int D,
unsigned int D2,
class R>
948inline Expr<BinaryOpCopyR<DivOp<T>, SMatrix<T,D,D2,R>, Constant<A>,
T>,
T, D, D2,
R>
965template <
class A,
class T,
unsigned int D,
unsigned int D2,
class R>
966inline Expr<BinaryOpCopyL<DivOp<T>, Constant<A>, SMatrix<T,D,D2,R>,
T>,
T, D, D2,
R>
978template <
class A,
class B,
class T,
unsigned int D,
unsigned int D2,
class R>
979inline Expr<BinaryOpCopyR<DivOp<T>, Expr<B,T,D,D2,R>, Constant<A>,
T>,
T, D, D2,
R>
990template <
class A,
class B,
class T,
unsigned int D,
unsigned int D2,
class R>
991inline Expr<BinaryOpCopyL<DivOp<T>, Constant<A>, Expr<B,T,D,D2,R>,
T>,
T, D, D2,
R>
Addition Operation Class.
static T apply(const T &lhs, const T &rhs)
Binary Operation class with value storage for the left argument.
Binary Operation class with value storage for the right argument.
BinaryOperation class A class representing binary operators in the parse tree.
Constant expression class A class representing constant expressions (literals) in the parse tree.
Division (element-wise) Operation Class.
static T apply(const T &lhs, const T &rhs)
Subtraction Operation Class.
static T apply(const T &lhs, const T &rhs)
Multiplication (element-wise) Operation Class.
static T apply(const T &lhs, const T &rhs)
SMatrix: a generic fixed size D1 x D2 Matrix class.
SVector: a generic fixed size Vector class.
Expression wrapper class for Vector objects.
Expr< BinaryOp< DivOp< T >, SMatrix< T, D, D2, R1 >, SMatrix< T, D, D2, R2 >, T >, T, D, D2, typename AddPolicy< T, D, D2, R1, R2 >::RepType > Div(const SMatrix< T, D, D2, R1 > &lhs, const SMatrix< T, D, D2, R2 > &rhs)
Division (element wise) of two matrices of the same dimensions: C(i,j) = A(i,j) / B(i,...
Expr< BinaryOp< MulOp< T >, SMatrix< T, D, D2, R1 >, SMatrix< T, D, D2, R2 >, T >, T, D, D2, typename AddPolicy< T, D, D2, R1, R2 >::RepType > Times(const SMatrix< T, D, D2, R1 > &lhs, const SMatrix< T, D, D2, R2 > &rhs)
Element by element matrix multiplication C(i,j) = A(i,j)*B(i,j) returning a matrix expression.
VecExpr< BinaryOp< DivOp< T >, SVector< T, D >, SVector< T, D >, T >, T, D > operator/(const SVector< T, D > &lhs, const SVector< T, D > &rhs)
Element by element division of vectors of the same dimension: v3(i) = v1(i)/v2(i) returning a vector ...
Namespace for new Math classes and functions.
DisplacementVector2D< CoordSystem1, U > operator+(DisplacementVector2D< CoordSystem1, U > v1, const DisplacementVector2D< CoordSystem2, U > &v2)
Addition of DisplacementVector2D vectors.
DisplacementVector2D< CoordSystem1, U > operator-(DisplacementVector2D< CoordSystem1, U > v1, DisplacementVector2D< CoordSystem2, U > const &v2)
Difference between two DisplacementVector2D vectors.
AxisAngle operator*(RotationX const &r1, AxisAngle const &r2)
Multiplication of an axial rotation by an AxisAngle.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
MatRepStd< typename R1::value_type, N1, N2 > RepType