Logo ROOT   6.12/07
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.

Functions

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>
ROOT::Math::Dot (const SVector< T, D > &lhs, const SVector< T, D > &rhs)
 Vector dot product. 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 >
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 >
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 , 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 , 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>
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< 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< 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< 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< 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>
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...
 
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>
SVector< T, D > ROOT::Math::Unit (const SVector< T, D > &rhs)
 Unit. More...
 

Function Documentation

◆ Cross()

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 322 of file Functions.h.

◆ Dot()

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 164 of file Functions.h.

◆ fabs()

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 149 of file UnaryOperators.h.

◆ Lmag()

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 299 of file Functions.h.

◆ Lmag2()

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 275 of file Functions.h.

◆ Mag()

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

Vector magnitude (Euclidian norm) Compute : \( |\vec{v}| = \sqrt{\sum_iv_i^2} \).

Author
T. Glebe

Definition at line 252 of file Functions.h.

◆ Mag2()

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 229 of file Functions.h.

◆ operator*()

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 548 of file BinaryOperators.h.

◆ operator+() [1/3]

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 62 of file BinaryOperators.h.

◆ operator+() [2/3]

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 116 of file BinaryOperators.h.

◆ operator+() [3/3]

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 133 of file BinaryOperators.h.

◆ operator-() [1/4]

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 74 of file UnaryOperators.h.

◆ operator-() [2/4]

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 306 of file BinaryOperators.h.

◆ operator-() [3/4]

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 360 of file BinaryOperators.h.

◆ operator-() [4/4]

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 377 of file BinaryOperators.h.

◆ operator/() [1/3]

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 784 of file BinaryOperators.h.

◆ operator/() [2/3]

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 837 of file BinaryOperators.h.

◆ operator/() [3/3]

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 854 of file BinaryOperators.h.

◆ sqr()

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 224 of file UnaryOperators.h.

◆ sqrt()

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 299 of file UnaryOperators.h.

◆ TensorProd()

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 883 of file MatrixFunctions.h.

◆ Unit()

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 381 of file Functions.h.