Logo ROOT   6.14/05
Reference Guide
Functions
Matrix Template Functions

These function apply to matrices (and also Matrix expression) and can return a matrix expression of a particular defined type, like in the matrix multiplication or a vector, like in the matrix-vector product or a scalar like in the Similarity vector-matrix product.

Functions

template<class T , unsigned int D, unsigned int D2, class R1 , class R2 >
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 > ROOT::Math::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,j) returning a matrix expression. More...
 
template<class T , unsigned int D, unsigned int D2, class R >
Expr< UnaryOp< Fabs< T >, SMatrix< T, D, D2, R >, T >, T, D, D2, RROOT::Math::fabs (const SMatrix< T, D, D2, R > &rhs)
 abs of a matrix m2(i,j) = | m1(i,j) | returning a matrix epression More...
 
template<class T , unsigned int D1, unsigned int D2, class R >
VecExpr< VectorMatrixRowOp< SMatrix< T, D1, D2, R >, SVector< T, D2 >, D2 >, T, D1 > ROOT::Math::operator* (const SMatrix< T, D1, D2, R > &lhs, const SVector< T, D2 > &rhs)
 Matrix * Vector multiplication \( a(i) = \sum_{j} M(i,j) * b(j) \) returning a vector expression. More...
 
template<class T , unsigned int D1, unsigned int D, unsigned int D2, class R1 , class R2 >
Expr< MatrixMulOp< SMatrix< T, D1, D, R1 >, SMatrix< T, D, D2, R2 >, T, D >, T, D1, D2, typename MultPolicy< T, R1, R2 >::RepType > ROOT::Math::operator* (const SMatrix< T, D1, D, R1 > &lhs, const SMatrix< T, D, D2, R2 > &rhs)
 Matrix * Matrix multiplication , \( C(i,j) = \sum_{k} A(i,k) * B(k,j)\) returning a matrix expression. More...
 
template<class A , class T , unsigned int D, unsigned int D2, class R >
Expr< BinaryOpCopyR< MulOp< T >, SMatrix< T, D, D2, R >, Constant< A >, T >, T, D, D2, RROOT::Math::operator* (const SMatrix< T, D, D2, R > &lhs, const A &rhs)
 Multiplication (element wise) of a matrix and a scalar, B(i,j) = A(i,j) * s returning a matrix expression. More...
 
template<class A , class T , unsigned int D, unsigned int D2, class R >
Expr< BinaryOpCopyL< MulOp< T >, Constant< A >, SMatrix< T, D, D2, R >, T >, T, D, D2, RROOT::Math::operator* (const A &lhs, const SMatrix< T, D, D2, R > &rhs)
 Multiplication (element wise) of a matrix and a scalar, B(i,j) = s * A(i,j) returning a matrix expression. More...
 
template<class T , unsigned int D, unsigned int D2, class R1 , class R2 >
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 > ROOT::Math::operator+ (const SMatrix< T, D, D2, R1 > &lhs, const SMatrix< T, D, D2, R2 > &rhs)
 Addition of two matrices C = A+B returning a matrix expression. More...
 
template<class A , class T , unsigned int D, unsigned int D2, class R >
Expr< BinaryOpCopyR< AddOp< T >, SMatrix< T, D, D2, R >, Constant< A >, T >, T, D, D2, RROOT::Math::operator+ (const SMatrix< T, D, D2, R > &lhs, const A &rhs)
 Addition element by element of matrix and a scalar C(i,j) = A(i,j) + s returning a matrix expression. More...
 
template<class A , class T , unsigned int D, unsigned int D2, class R >
Expr< BinaryOpCopyL< AddOp< T >, Constant< A >, SMatrix< T, D, D2, R >, T >, T, D, D2, RROOT::Math::operator+ (const A &lhs, const SMatrix< T, D, D2, R > &rhs)
 Addition element by element of matrix and a scalar C(i,j) = s + A(i,j) returning a matrix expression. More...
 
template<class T , unsigned int D, unsigned int D2, class R >
Expr< UnaryOp< Minus< T >, SMatrix< T, D, D2, R >, T >, T, D, D2, RROOT::Math::operator- (const SMatrix< T, D, D2, R > &rhs)
 Unary - operator B = - A returning a matrix expression. More...
 
template<class T , unsigned int D, unsigned int D2, class R1 , class R2 >
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 > ROOT::Math::operator- (const SMatrix< T, D, D2, R1 > &lhs, const SMatrix< T, D, D2, R2 > &rhs)
 Subtraction of two matrices C = A-B returning a matrix expression. More...
 
template<class A , class T , unsigned int D, unsigned int D2, class R >
Expr< BinaryOpCopyR< MinOp< T >, SMatrix< T, D, D2, R >, Constant< A >, T >, T, D, D2, RROOT::Math::operator- (const SMatrix< T, D, D2, R > &lhs, const A &rhs)
 Subtraction of a scalar and a matrix (element wise) B(i,j) = A(i,j) - s returning a matrix expression. More...
 
template<class A , class T , unsigned int D, unsigned int D2, class R >
Expr< BinaryOpCopyL< MinOp< T >, Constant< A >, SMatrix< T, D, D2, R >, T >, T, D, D2, RROOT::Math::operator- (const A &lhs, const SMatrix< T, D, D2, R > &rhs)
 Subtraction of a scalar and a matrix (element wise) B(i,j) = s - A(i,j) returning a matrix expression. More...
 
template<class A , class T , unsigned int D, unsigned int D2, class R >
Expr< BinaryOpCopyR< DivOp< T >, SMatrix< T, D, D2, R >, Constant< A >, T >, T, D, D2, RROOT::Math::operator/ (const SMatrix< T, D, D2, R > &lhs, const A &rhs)
 Division (element wise) of a matrix and a scalar, B(i,j) = A(i,j) / s returning a matrix expression. More...
 
template<class A , class T , unsigned int D, unsigned int D2, class R >
Expr< BinaryOpCopyL< DivOp< T >, Constant< A >, SMatrix< T, D, D2, R >, T >, T, D, D2, RROOT::Math::operator/ (const A &lhs, const SMatrix< T, D, D2, R > &rhs)
 Division (element wise) of a matrix and a scalar, B(i,j) = s / A(i,j) returning a matrix expression. More...
 
template<class T , unsigned int D, class R >
ROOT::Math::Similarity (const SMatrix< T, D, D, R > &lhs, const SVector< T, D > &rhs)
 Similarity Vector - Matrix Product: v^T * A * v returning a scalar value of type T \( s = \sum_{i,j} v(i) * A(i,j) * v(j)\). More...
 
template<class T , unsigned int D1, unsigned int D2, class R >
SMatrix< T, D1, D1, MatRepSym< T, D1 > > ROOT::Math::Similarity (const SMatrix< T, D1, D2, R > &lhs, const SMatrix< T, D2, D2, MatRepSym< T, D2 > > &rhs)
 Similarity Matrix Product : B = U * A * U^T for A symmetric returning a symmetric matrix expression: \( B(i,j) = \sum_{k,l} U(i,k) * A(k,l) * U(j,l) \). More...
 
template<class T , unsigned int D1, unsigned int D2, class R >
SMatrix< T, D2, D2, MatRepSym< T, D2 > > ROOT::Math::SimilarityT (const SMatrix< T, D1, D2, R > &lhs, const SMatrix< T, D1, D1, MatRepSym< T, D1 > > &rhs)
 Transpose Similarity Matrix Product : B = U^T * A * U for A symmetric returning a symmetric matrix expression: \( B(i,j) = \sum_{k,l} U(k,i) * A(k,l) * U(l,j) \). More...
 
template<class T , unsigned int D, unsigned int D2, class R >
Expr< UnaryOp< Sqr< T >, SMatrix< T, D, D2, R >, T >, T, D, D2, RROOT::Math::sqr (const SMatrix< T, D, D2, R > &rhs)
 square of a matrix B(i,j) = A(i,j)*A(i,j) returning a matrix expression More...
 
template<class T , unsigned int D, unsigned int D2, class R >
Expr< UnaryOp< Sqrt< T >, SMatrix< T, D, D2, R >, T >, T, D, D2, RROOT::Math::sqrt (const SMatrix< T, D, D2, R > &rhs)
 square root of a matrix (element by element) m2(i,j) = sqrt ( m1(i,j) ) returning a matrix expression More...
 
template<class T , unsigned int D, unsigned int D2, class R1 , class R2 >
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 > ROOT::Math::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. More...
 
template<class T , unsigned int D1, unsigned int D2, class R >
Expr< TransposeOp< SMatrix< T, D1, D2, R >, T, D1, D2 >, T, D2, D1, typename TranspPolicy< T, D1, D2, R >::RepType > ROOT::Math::Transpose (const SMatrix< T, D1, D2, R > &rhs)
 Matrix Transpose B(i,j) = A(j,i) returning a matrix expression. More...
 

Function Documentation

◆ Div()

template<class T , unsigned int D, unsigned int D2, class R1 , class R2 >
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> ROOT::Math::Div ( const SMatrix< T, D, D2, R1 > &  lhs,
const SMatrix< T, D, D2, R2 > &  rhs 
)
inline

Division (element wise) of two matrices of the same dimensions: C(i,j) = A(i,j) / B(i,j) returning a matrix expression.

Definition at line 895 of file BinaryOperators.h.

◆ fabs()

template<class T , unsigned int D, unsigned int D2, class R >
Expr<UnaryOp<Fabs<T>, SMatrix<T,D,D2,R>, T>, T, D, D2, R> ROOT::Math::fabs ( const SMatrix< T, D, D2, R > &  rhs)
inline

abs of a matrix m2(i,j) = | m1(i,j) | returning a matrix epression

Definition at line 178 of file UnaryOperators.h.

◆ operator*() [1/4]

template<class T , unsigned int D1, unsigned int D2, class R >
VecExpr<VectorMatrixRowOp<SMatrix<T,D1,D2,R>,SVector<T,D2>, D2>, T, D1> ROOT::Math::operator* ( const SMatrix< T, D1, D2, R > &  lhs,
const SVector< T, D2 > &  rhs 
)
inline

Matrix * Vector multiplication \( a(i) = \sum_{j} M(i,j) * b(j) \) returning a vector expression.

Definition at line 211 of file MatrixFunctions.h.

◆ operator*() [2/4]

template<class T , unsigned int D1, unsigned int D, unsigned int D2, class R1 , class R2 >
Expr<MatrixMulOp<SMatrix<T,D1,D,R1>, SMatrix<T,D,D2,R2>,T,D>, T, D1, D2, typename MultPolicy<T,R1,R2>::RepType> ROOT::Math::operator* ( const SMatrix< T, D1, D, R1 > &  lhs,
const SMatrix< T, D, D2, R2 > &  rhs 
)
inline

Matrix * Matrix multiplication , \( C(i,j) = \sum_{k} A(i,k) * B(k,j)\) returning a matrix expression.

Definition at line 386 of file MatrixFunctions.h.

◆ operator*() [3/4]

template<class A , class T , unsigned int D, unsigned int D2, class R >
Expr<BinaryOpCopyR<MulOp<T>, SMatrix<T,D,D2,R>, Constant<A>, T>, T, D, D2, R> ROOT::Math::operator* ( const SMatrix< T, D, D2, R > &  lhs,
const A &  rhs 
)
inline

Multiplication (element wise) of a matrix and a scalar, B(i,j) = A(i,j) * s returning a matrix expression.

Definition at line 706 of file BinaryOperators.h.

◆ operator*() [4/4]

template<class A , class T , unsigned int D, unsigned int D2, class R >
Expr<BinaryOpCopyL<MulOp<T>, Constant<A>, SMatrix<T,D,D2,R>, T>, T, D, D2, R> ROOT::Math::operator* ( const A &  lhs,
const SMatrix< T, D, D2, R > &  rhs 
)
inline

Multiplication (element wise) of a matrix and a scalar, B(i,j) = s * A(i,j) returning a matrix expression.

Definition at line 724 of file BinaryOperators.h.

◆ operator+() [1/3]

template<class T , unsigned int D, unsigned int D2, class R1 , class R2 >
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 > ROOT::Math::operator+ ( const SMatrix< T, D, D2, R1 > &  lhs,
const SMatrix< T, D, D2, R2 > &  rhs 
)
inline

Addition of two matrices C = A+B returning a matrix expression.

Definition at line 174 of file BinaryOperators.h.

◆ operator+() [2/3]

template<class A , class T , unsigned int D, unsigned int D2, class R >
Expr<BinaryOpCopyR<AddOp<T>, SMatrix<T,D,D2,R>, Constant<A>, T>, T, D, D2, R> ROOT::Math::operator+ ( const SMatrix< T, D, D2, R > &  lhs,
const A &  rhs 
)
inline

Addition element by element of matrix and a scalar C(i,j) = A(i,j) + s returning a matrix expression.

Definition at line 228 of file BinaryOperators.h.

◆ operator+() [3/3]

template<class A , class T , unsigned int D, unsigned int D2, class R >
Expr<BinaryOpCopyL<AddOp<T>, Constant<A>, SMatrix<T,D,D2,R>, T>, T, D, D2, R> ROOT::Math::operator+ ( const A &  lhs,
const SMatrix< T, D, D2, R > &  rhs 
)
inline

Addition element by element of matrix and a scalar C(i,j) = s + A(i,j) returning a matrix expression.

Definition at line 245 of file BinaryOperators.h.

◆ operator-() [1/4]

template<class T , unsigned int D, unsigned int D2, class R >
Expr<UnaryOp<Minus<T>, SMatrix<T,D,D2,R>, T>, T, D, D2,R> ROOT::Math::operator- ( const SMatrix< T, D, D2, R > &  rhs)
inline

Unary - operator B = - A returning a matrix expression.

Definition at line 103 of file UnaryOperators.h.

◆ operator-() [2/4]

template<class T , unsigned int D, unsigned int D2, class R1 , class R2 >
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> ROOT::Math::operator- ( const SMatrix< T, D, D2, R1 > &  lhs,
const SMatrix< T, D, D2, R2 > &  rhs 
)
inline

Subtraction of two matrices C = A-B returning a matrix expression.

Definition at line 418 of file BinaryOperators.h.

◆ operator-() [3/4]

template<class A , class T , unsigned int D, unsigned int D2, class R >
Expr<BinaryOpCopyR<MinOp<T>, SMatrix<T,D,D2,R>, Constant<A>, T>, T, D, D2, R> ROOT::Math::operator- ( const SMatrix< T, D, D2, R > &  lhs,
const A &  rhs 
)
inline

Subtraction of a scalar and a matrix (element wise) B(i,j) = A(i,j) - s returning a matrix expression.

Definition at line 472 of file BinaryOperators.h.

◆ operator-() [4/4]

template<class A , class T , unsigned int D, unsigned int D2, class R >
Expr<BinaryOpCopyL<MinOp<T>, Constant<A>, SMatrix<T,D,D2,R>, T>, T, D, D2, R> ROOT::Math::operator- ( const A &  lhs,
const SMatrix< T, D, D2, R > &  rhs 
)
inline

Subtraction of a scalar and a matrix (element wise) B(i,j) = s - A(i,j) returning a matrix expression.

Definition at line 490 of file BinaryOperators.h.

◆ operator/() [1/2]

template<class A , class T , unsigned int D, unsigned int D2, class R >
Expr<BinaryOpCopyR<DivOp<T>, SMatrix<T,D,D2,R>, Constant<A>, T>, T, D, D2, R> ROOT::Math::operator/ ( const SMatrix< T, D, D2, R > &  lhs,
const A &  rhs 
)
inline

Division (element wise) of a matrix and a scalar, B(i,j) = A(i,j) / s returning a matrix expression.

Definition at line 949 of file BinaryOperators.h.

◆ operator/() [2/2]

template<class A , class T , unsigned int D, unsigned int D2, class R >
Expr<BinaryOpCopyL<DivOp<T>, Constant<A>, SMatrix<T,D,D2,R>, T>, T, D, D2, R> ROOT::Math::operator/ ( const A &  lhs,
const SMatrix< T, D, D2, R > &  rhs 
)
inline

Division (element wise) of a matrix and a scalar, B(i,j) = s / A(i,j) returning a matrix expression.

Definition at line 967 of file BinaryOperators.h.

◆ Similarity() [1/2]

template<class T , unsigned int D, class R >
T ROOT::Math::Similarity ( const SMatrix< T, D, D, R > &  lhs,
const SVector< T, D > &  rhs 
)
inline

Similarity Vector - Matrix Product: v^T * A * v returning a scalar value of type T \( s = \sum_{i,j} v(i) * A(i,j) * v(j)\).

Definition at line 663 of file MatrixFunctions.h.

◆ Similarity() [2/2]

template<class T , unsigned int D1, unsigned int D2, class R >
SMatrix<T,D1,D1,MatRepSym<T,D1> > ROOT::Math::Similarity ( const SMatrix< T, D1, D2, R > &  lhs,
const SMatrix< T, D2, D2, MatRepSym< T, D2 > > &  rhs 
)
inline

Similarity Matrix Product : B = U * A * U^T for A symmetric returning a symmetric matrix expression: \( B(i,j) = \sum_{k,l} U(i,k) * A(k,l) * U(j,l) \).

Definition at line 736 of file MatrixFunctions.h.

◆ SimilarityT()

template<class T , unsigned int D1, unsigned int D2, class R >
SMatrix<T,D2,D2,MatRepSym<T,D2> > ROOT::Math::SimilarityT ( const SMatrix< T, D1, D2, R > &  lhs,
const SMatrix< T, D1, D1, MatRepSym< T, D1 > > &  rhs 
)
inline

Transpose Similarity Matrix Product : B = U^T * A * U for A symmetric returning a symmetric matrix expression: \( B(i,j) = \sum_{k,l} U(k,i) * A(k,l) * U(l,j) \).

Definition at line 786 of file MatrixFunctions.h.

◆ sqr()

template<class T , unsigned int D, unsigned int D2, class R >
Expr<UnaryOp<Sqr<T>, SMatrix<T,D,D2,R>, T>, T, D, D2, R> ROOT::Math::sqr ( const SMatrix< T, D, D2, R > &  rhs)
inline

square of a matrix B(i,j) = A(i,j)*A(i,j) returning a matrix expression

Definition at line 253 of file UnaryOperators.h.

◆ sqrt()

template<class T , unsigned int D, unsigned int D2, class R >
Expr<UnaryOp<Sqrt<T>, SMatrix<T,D,D2,R>, T>, T, D, D2, R> ROOT::Math::sqrt ( const SMatrix< T, D, D2, R > &  rhs)
inline

square root of a matrix (element by element) m2(i,j) = sqrt ( m1(i,j) ) returning a matrix expression

Definition at line 327 of file UnaryOperators.h.

◆ Times()

template<class T , unsigned int D, unsigned int D2, class R1 , class R2 >
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> ROOT::Math::Times ( const SMatrix< T, D, D2, R1 > &  lhs,
const SMatrix< T, D, D2, R2 > &  rhs 
)
inline

Element by element matrix multiplication C(i,j) = A(i,j)*B(i,j) returning a matrix expression.

This is not a matrix-matrix multiplication and works only for matrices of the same dimensions.

Definition at line 652 of file BinaryOperators.h.

◆ Transpose()

template<class T , unsigned int D1, unsigned int D2, class R >
Expr<TransposeOp<SMatrix<T,D1,D2,R>,T,D1,D2>, T, D2, D1, typename TranspPolicy<T,D1,D2,R>::RepType> ROOT::Math::Transpose ( const SMatrix< T, D1, D2, R > &  rhs)
inline

Matrix Transpose B(i,j) = A(j,i) returning a matrix expression.

Definition at line 538 of file MatrixFunctions.h.