ROOT  6.06/09
Reference Guide
Functions
Vector Template Functions

These functions apply to SVector types (and also to Vector expressions) and can return a vector expression or a scalar, like in the Dot product, or a matrix, like in the Tensor product. More...

+ Collaboration diagram for Vector Template Functions:

Functions

template<class T , unsigned int D>
VecExpr< BinaryOp< AddOp< T >, SVector< T, D >, SVector< T, D >, T >, T, D > ROOT::Math::operator+ (const SVector< T, D > &lhs, const SVector< T, D > &rhs)
 Addition of two vectors v3 = v1+v2 returning a vector expression. More...
 
template<class A , class T , unsigned int D>
VecExpr< BinaryOpCopyR< AddOp< T >, SVector< T, D >, Constant< A >, T >, T, D > ROOT::Math::operator+ (const SVector< T, D > &lhs, const A &rhs)
 Addition of a scalar to a each vector element: v2(i) = v1(i) + a returning a vector expression. More...
 
template<class A , class T , unsigned int D>
VecExpr< BinaryOpCopyL< AddOp< T >, Constant< A >, SVector< T, D >, T >, T, D > ROOT::Math::operator+ (const A &lhs, const SVector< T, D > &rhs)
 Addition of a scalar to each vector element v2(i) = a + v1(i) returning a vector expression. More...
 
template<class T , unsigned int D>
VecExpr< BinaryOp< MinOp< T >, SVector< T, D >, SVector< T, D >, T >, T, D > ROOT::Math::operator- (const SVector< T, D > &lhs, const SVector< T, D > &rhs)
 Vector Subtraction: v3 = v1 - v2 returning a vector expression. More...
 
template<class A , class T , unsigned int D>
VecExpr< BinaryOpCopyR< MinOp< T >, SVector< T, D >, Constant< A >, T >, T, D > ROOT::Math::operator- (const SVector< T, D > &lhs, const A &rhs)
 Subtraction of a scalar from each vector element: v2(i) = v1(i) - a returning a vector expression. More...
 
template<class A , class T , unsigned int D>
VecExpr< BinaryOpCopyL< MinOp< T >, Constant< A >, SVector< T, D >, T >, T, D > ROOT::Math::operator- (const A &lhs, const SVector< T, D > &rhs)
 Subtraction scalar vector (for each vector element) v2(i) = a - v1(i) returning a vector expression. More...
 
template<class T , unsigned int D>
VecExpr< BinaryOp< MulOp< T >, SVector< T, D >, SVector< T, D >, T >, T, D > ROOT::Math::operator* (const SVector< T, D > &lhs, const SVector< T, D > &rhs)
 Element by element vector product v3(i) = v1(i)*v2(i) returning a vector expression. More...
 
template<class T , unsigned int D>
VecExpr< BinaryOp< DivOp< T >, SVector< T, D >, SVector< T, D >, T >, T, D > ROOT::Math::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 expression. More...
 
template<class A , class T , unsigned int D>
VecExpr< BinaryOpCopyR< DivOp< T >, SVector< T, D >, Constant< A >, T >, T, D > ROOT::Math::operator/ (const SVector< T, D > &lhs, const A &rhs)
 Division of the vector element by a scalar value: v2(i) = v1(i)/a returning a vector expression. More...
 
template<class A , class T , unsigned int D>
VecExpr< BinaryOpCopyL< DivOp< T >, Constant< A >, SVector< T, D >, T >, T, D > ROOT::Math::operator/ (const A &lhs, const SVector< T, D > &rhs)
 Division of a scalar value by the vector element: v2(i) = a/v1(i) returning a vector expression. More...
 
template<class T , unsigned int D>
ROOT::Math::Dot (const SVector< T, D > &lhs, const SVector< T, D > &rhs)
 Vector dot product. More...
 
template<class T , unsigned int D>
ROOT::Math::Mag2 (const SVector< T, D > &rhs)
 Vector magnitude square Template to compute \(|\vec{v}|^2 = \sum_iv_i^2 \). More...
 
template<class T , unsigned int D>
ROOT::Math::Mag (const SVector< T, D > &rhs)
 Vector magnitude (Euclidian norm) Compute : \( |\vec{v}| = \sqrt{\sum_iv_i^2} \). More...
 
template<class T >
ROOT::Math::Lmag2 (const SVector< T, 4 > &rhs)
 Lmag2: Square of Minkowski Lorentz-Vector norm (only for 4D Vectors) Template to compute \( |\vec{v}|^2 = v_0^2 - v_1^2 - v_2^2 -v_3^2 \). More...
 
template<class T >
ROOT::Math::Lmag (const SVector< T, 4 > &rhs)
 Lmag: Minkowski Lorentz-Vector norm (only for 4-dim vectors) Length of a vector Lorentz-Vector: \( |\vec{v}| = \sqrt{v_0^2 - v_1^2 - v_2^2 -v_3^2} \). More...
 
template<class T >
SVector< T, 3 > ROOT::Math::Cross (const SVector< T, 3 > &lhs, const SVector< T, 3 > &rhs)
 Vector Cross Product (only for 3-dim vectors) \( \vec{c} = \vec{a}\times\vec{b} \). More...
 
template<class T , unsigned int D>
SVector< T, D > ROOT::Math::Unit (const SVector< T, D > &rhs)
 Unit. More...
 
template<class T , unsigned int D1, unsigned int D2>
Expr< TensorMulOp< SVector< T, D1 >, SVector< T, D2 > >, T, D1, D2 > ROOT::Math::TensorProd (const SVector< T, D1 > &lhs, const SVector< T, D2 > &rhs)
 Tensor Vector Product : M(i,j) = v(i) * v(j) returning a matrix expression. More...
 
template<class T , unsigned int D>
VecExpr< UnaryOp< Minus< T >, SVector< T, D >, T >, T, D > ROOT::Math::operator- (const SVector< T, D > &rhs)
 Unary - operator v2 = -v1 . More...
 
template<class T , unsigned int D>
VecExpr< UnaryOp< Fabs< T >, SVector< T, D >, T >, T, D > ROOT::Math::fabs (const SVector< T, D > &rhs)
 abs of a vector : v2(i) = | v1(i) | returning a vector expression More...
 
template<class T , unsigned int D>
VecExpr< UnaryOp< Sqr< T >, SVector< T, D >, T >, T, D > ROOT::Math::sqr (const SVector< T, D > &rhs)
 square of a vector v2(i) = v1(i)*v1(i) . More...
 
template<class T , unsigned int D>
VecExpr< UnaryOp< Sqrt< T >, SVector< T, D >, T >, T, D > ROOT::Math::sqrt (const SVector< T, D > &rhs)
 square root of a vector (element by element) v2(i) = sqrt( v1(i) ) returning a vector expression More...
 

Detailed Description

These functions apply to SVector types (and also to Vector expressions) and can return a vector expression or a scalar, like in the Dot product, or a matrix, like in the Tensor product.

Function Documentation

template<class T >
SVector<T,3> ROOT::Math::Cross ( const SVector< T, 3 > &  lhs,
const SVector< T, 3 > &  rhs 
)
inline

Vector Cross Product (only for 3-dim vectors) \( \vec{c} = \vec{a}\times\vec{b} \).

Author
T. Glebe

Definition at line 324 of file Functions.h.

Referenced by ROOT::Math::Plane3D::BuildFrom3Points(), and test8().

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

Vector dot product.

Template to compute \(\vec{a}\cdot\vec{b} = \sum_i a_i\cdot b_i \).

Author
T. Glebe

Definition at line 166 of file Functions.h.

Referenced by ROOT::Math::Similarity(), test10(), test17(), test8(), test_smatrix_kalman(), test_smatrix_sym_kalman(), testDot_S(), and testDot_T().

template<class T , unsigned int D>
VecExpr<UnaryOp<Fabs<T>, SVector<T,D>, T>, T, D> ROOT::Math::fabs ( const SVector< T, D > &  rhs)
inline

abs of a vector : v2(i) = | v1(i) | returning a vector expression

Definition at line 151 of file UnaryOperators.h.

template<class T >
T ROOT::Math::Lmag ( const SVector< T, 4 > &  rhs)
inline

Lmag: Minkowski Lorentz-Vector norm (only for 4-dim vectors) Length of a vector Lorentz-Vector: \( |\vec{v}| = \sqrt{v_0^2 - v_1^2 - v_2^2 -v_3^2} \).

Author
T. Glebe

Definition at line 301 of file Functions.h.

template<class T >
T ROOT::Math::Lmag2 ( const SVector< T, 4 > &  rhs)
inline

Lmag2: Square of Minkowski Lorentz-Vector norm (only for 4D Vectors) Template to compute \( |\vec{v}|^2 = v_0^2 - v_1^2 - v_2^2 -v_3^2 \).

Author
T. Glebe

Definition at line 277 of file Functions.h.

Referenced by ROOT::Math::Lmag().

template<class T , unsigned int D>
T ROOT::Math::Mag ( const SVector< T, D > &  rhs)
inline
template<class T , unsigned int D>
T ROOT::Math::Mag2 ( const SVector< T, D > &  rhs)
inline

Vector magnitude square Template to compute \(|\vec{v}|^2 = \sum_iv_i^2 \).

Author
T. Glebe

Definition at line 231 of file Functions.h.

Referenced by TEveProjection::BisectBreakPoint(), ROOT::Math::Mag(), and test10().

template<class T , unsigned int D>
VecExpr<BinaryOp<MulOp<T>, SVector<T,D>, SVector<T,D>, T>, T, D> ROOT::Math::operator* ( const SVector< T, D > &  lhs,
const SVector< T, D > &  rhs 
)
inline

Element by element vector product v3(i) = v1(i)*v2(i) returning a vector expression.

Note this is NOT the Dot, Cross or Tensor product.

Definition at line 549 of file BinaryOperators.h.

template<class T , unsigned int D>
VecExpr<BinaryOp<AddOp<T>, SVector<T,D>, SVector<T,D>, T>, T, D> ROOT::Math::operator+ ( const SVector< T, D > &  lhs,
const SVector< T, D > &  rhs 
)
inline

Addition of two vectors v3 = v1+v2 returning a vector expression.

Definition at line 63 of file BinaryOperators.h.

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

Addition of a scalar to a each vector element: v2(i) = v1(i) + a returning a vector expression.

Definition at line 117 of file BinaryOperators.h.

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

Addition of a scalar to each vector element v2(i) = a + v1(i) returning a vector expression.

Definition at line 134 of file BinaryOperators.h.

template<class T , unsigned int D>
VecExpr<UnaryOp<Minus<T>, SVector<T,D>, T>, T, D> ROOT::Math::operator- ( const SVector< T, D > &  rhs)
inline

Unary - operator v2 = -v1 .

returning a vector expression

Definition at line 76 of file UnaryOperators.h.

template<class T , unsigned int D>
VecExpr<BinaryOp<MinOp<T>, SVector<T,D>, SVector<T,D>, T>, T, D> ROOT::Math::operator- ( const SVector< T, D > &  lhs,
const SVector< T, D > &  rhs 
)
inline

Vector Subtraction: v3 = v1 - v2 returning a vector expression.

Definition at line 307 of file BinaryOperators.h.

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

Subtraction of a scalar from each vector element: v2(i) = v1(i) - a returning a vector expression.

Definition at line 361 of file BinaryOperators.h.

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

Subtraction scalar vector (for each vector element) v2(i) = a - v1(i) returning a vector expression.

Definition at line 378 of file BinaryOperators.h.

template<class T , unsigned int D>
VecExpr<BinaryOp<DivOp<T>, SVector<T,D>, SVector<T,D>, T>, T, D> ROOT::Math::operator/ ( const SVector< T, D > &  lhs,
const SVector< T, D > &  rhs 
)
inline

Element by element division of vectors of the same dimension: v3(i) = v1(i)/v2(i) returning a vector expression.

Definition at line 785 of file BinaryOperators.h.

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

Division of the vector element by a scalar value: v2(i) = v1(i)/a returning a vector expression.

Definition at line 838 of file BinaryOperators.h.

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

Division of a scalar value by the vector element: v2(i) = a/v1(i) returning a vector expression.

Definition at line 855 of file BinaryOperators.h.

template<class T , unsigned int D>
VecExpr<UnaryOp<Sqr<T>, SVector<T,D>, T>, T, D> ROOT::Math::sqr ( const SVector< T, D > &  rhs)
inline

square of a vector v2(i) = v1(i)*v1(i) .

returning a vector expression

Definition at line 226 of file UnaryOperators.h.

template<class T , unsigned int D>
VecExpr<UnaryOp<Sqrt<T>, SVector<T,D>, T>, T, D> ROOT::Math::sqrt ( const SVector< T, D > &  rhs)
inline

square root of a vector (element by element) v2(i) = sqrt( v1(i) ) returning a vector expression

Definition at line 301 of file UnaryOperators.h.

template<class T , unsigned int D1, unsigned int D2>
Expr<TensorMulOp<SVector<T,D1>, SVector<T,D2> >, T, D1, D2 > ROOT::Math::TensorProd ( const SVector< T, D1 > &  lhs,
const SVector< T, D2 > &  rhs 
)
inline

Tensor Vector Product : M(i,j) = v(i) * v(j) returning a matrix expression.

Definition at line 891 of file MatrixFunctions.h.

Referenced by test17().

template<class T , unsigned int D>
SVector<T,D> ROOT::Math::Unit ( const SVector< T, D > &  rhs)
inline

Unit.

Return a vector of unit length: \( \vec{e}_v = \vec{v}/|\vec{v}| \).

Author
T. Glebe

Definition at line 383 of file Functions.h.

Referenced by test8(), ROOT::Math::Transform3D::Transform3D(), and ROOT::Math::Unit().