SVector: a generic fixed size Vector class.
The class is template on the scalar type and on the vector size D. See SVector Class Properties
Original author is Thorsten Glebe HERA-B Collaboration, MPI Heidelberg (Germany)
Public Types | |
— Typedefs — | |
typedef T | value_type |
contained scalar type | |
typedef T * | iterator |
STL iterator interface. | |
typedef const T * | const_iterator |
STL const_iterator interface. | |
Public Member Functions | |
— Constructors — | |
SVector () | |
Default constructor: vector filled with zero values. | |
template<class A > | |
SVector (const VecExpr< A, T, D > &rhs) | |
construct from a vector expression | |
SVector (const SVector< T, D > &rhs) | |
copy constructor | |
SVector (const T *a, unsigned int len) | |
fill from array with len must be equal to D! | |
SVector (const_iterator begin, const_iterator end) | |
fill from a SVector iterator of type T* (for ambiguities iterator cannot be generic ) | |
SVector (const T &a1) | |
construct a vector of size 1 from a single scalar value | |
SVector (const T &a1, const T &a2) | |
construct a vector of size 2 from 2 scalar values | |
SVector (const T &a1, const T &a2, const T &a3) | |
construct a vector of size 3 from 3 scalar values | |
SVector (const T &a1, const T &a2, const T &a3, const T &a4) | |
construct a vector of size 4 from 4 scalar values | |
SVector (const T &a1, const T &a2, const T &a3, const T &a4, const T &a5) | |
construct a vector of size 5 from 5 scalar values | |
SVector (const T &a1, const T &a2, const T &a3, const T &a4, const T &a5, const T &a6) | |
construct a vector of size 6 from 6 scalar values | |
SVector (const T &a1, const T &a2, const T &a3, const T &a4, const T &a5, const T &a6, const T &a7) | |
construct a vector of size 7 from 7 scalar values | |
SVector (const T &a1, const T &a2, const T &a3, const T &a4, const T &a5, const T &a6, const T &a7, const T &a8) | |
construct a vector of size 8 from 8 scalar values | |
SVector (const T &a1, const T &a2, const T &a3, const T &a4, const T &a5, const T &a6, const T &a7, const T &a8, const T &a9) | |
construct a vector of size 9 from 9 scalar values | |
SVector (const T &a1, const T &a2, const T &a3, const T &a4, const T &a5, const T &a6, const T &a7, const T &a8, const T &a9, const T &a10) | |
construct a vector of size 10 from 10 scalar values | |
SVector< T, D > & | operator= (const T &a1) |
assignment from a scalar (only for size 1 vector) | |
SVector< T, D > & | operator= (const SVector< T, D > &rhs) |
assignment from another vector | |
template<class A > | |
SVector< T, D > & | operator= (const VecExpr< A, T, D > &rhs) |
assignment from Vector Expression | |
— STL-like interface — | |
iterator | begin () |
STL iterator interface. | |
iterator | end () |
STL iterator interface. | |
const_iterator | begin () const |
STL const_iterator interface. | |
const_iterator | end () const |
STL const_iterator interface. | |
template<class InputIterator > | |
void | SetElements (InputIterator begin, InputIterator end) |
set vector elements copying the values iterator size must match vector size | |
template<class InputIterator > | |
void | SetElements (InputIterator begin, unsigned int size) |
set vector elements copying the values size must be <= vector size | |
— Operators — | |
bool | operator== (const T &rhs) const |
element wise comparison | |
bool | operator!= (const T &rhs) const |
element wise comparison | |
bool | operator== (const SVector< T, D > &rhs) const |
element wise comparison | |
bool | operator!= (const SVector< T, D > &rhs) const |
element wise comparison | |
template<class A > | |
bool | operator== (const VecExpr< A, T, D > &rhs) const |
element wise comparison | |
template<class A > | |
bool | operator!= (const VecExpr< A, T, D > &rhs) const |
element wise comparison | |
bool | operator> (const T &rhs) const |
element wise comparison | |
bool | operator< (const T &rhs) const |
element wise comparison | |
bool | operator> (const SVector< T, D > &rhs) const |
element wise comparison | |
bool | operator< (const SVector< T, D > &rhs) const |
element wise comparison | |
template<class A > | |
bool | operator> (const VecExpr< A, T, D > &rhs) const |
element wise comparison | |
template<class A > | |
bool | operator< (const VecExpr< A, T, D > &rhs) const |
element wise comparison | |
const T & | operator[] (unsigned int i) const |
read-only access of vector elements. Index starts from 0. | |
const T & | operator() (unsigned int i) const |
read-only access of vector elements. Index starts from 0. | |
const T & | At (unsigned int i) const |
read-only access of vector elements with check on index. Index starts from 0. | |
T & | operator[] (unsigned int i) |
read/write access of vector elements. Index starts from 0. | |
T & | operator() (unsigned int i) |
read/write access of vector elements. Index starts from 0. | |
T & | At (unsigned int i) |
read/write access of vector elements with check on index. Index starts from 0. | |
SVector< T, D > & | operator+= (const T &rhs) |
self addition with a scalar | |
SVector< T, D > & | operator-= (const T &rhs) |
self subtraction with a scalar | |
SVector< T, D > & | operator*= (const T &rhs) |
self multiplication with a scalar | |
SVector< T, D > & | operator/= (const T &rhs) |
self division with a scalar | |
SVector< T, D > & | operator+= (const SVector< T, D > &rhs) |
self addition with another vector | |
SVector< T, D > & | operator-= (const SVector< T, D > &rhs) |
self subtraction with another vector | |
template<class A > | |
SVector< T, D > & | operator+= (const VecExpr< A, T, D > &rhs) |
self addition with a vector expression | |
template<class A > | |
SVector< T, D > & | operator-= (const VecExpr< A, T, D > &rhs) |
self subtraction with a vector expression | |
— Expert functions — | |
SVector< T, D > & | Unit () |
transform vector into a vector of length 1 | |
template<unsigned int D2> | |
SVector< T, D > & | Place_at (const SVector< T, D2 > &rhs, unsigned int row) |
place a sub-vector starting from the given position | |
template<class A , unsigned int D2> | |
SVector< T, D > & | Place_at (const VecExpr< A, T, D2 > &rhs, unsigned int row) |
place a sub-vector expression starting from the given position | |
template<class SubVector > | |
SubVector | Sub (unsigned int row) const |
return a subvector of size N starting at the value row where N is the size of the returned vector (SubVector::kSize) Condition row+N <= D | |
bool | IsInUse (const T *p) const |
Function to check if a vector is sharing same memory location of the passed pointer This function is used by the expression templates to avoid the alias problem during expression evaluation. | |
std::ostream & | Print (std::ostream &os) const |
used by operator<<() | |
Private Attributes | |
— Data member — | |
T | fArray [D] |
SVector data. | |
— Access functions — | |
enum | { kSize = D } |
Enumeration defining the Vector size. More... | |
T | apply (unsigned int i) const |
access the parse tree. Index starts from zero | |
const T * | Array () const |
return read-only pointer to internal array | |
T * | Array () |
return non-const pointer to internal array | |
static unsigned int | Dim () |
return dimension \(D\) | |
#include <Math/SVector.h>
typedef const T* ROOT::Math::SVector< T, D >::const_iterator |
typedef T* ROOT::Math::SVector< T, D >::iterator |
typedef T ROOT::Math::SVector< T, D >::value_type |
anonymous enum |
ROOT::Math::SVector< T, D >::SVector |
Default constructor: vector filled with zero values.
Definition at line 53 of file SVector.icc.
ROOT::Math::SVector< T, D >::SVector | ( | const VecExpr< A, T, D > & | rhs | ) |
construct from a vector expression
Definition at line 60 of file SVector.icc.
ROOT::Math::SVector< T, D >::SVector | ( | const SVector< T, D > & | rhs | ) |
copy constructor
Definition at line 65 of file SVector.icc.
ROOT::Math::SVector< T, D >::SVector | ( | const T * | a, |
unsigned int | len | ||
) |
fill from array with len must be equal to D!
Definition at line 94 of file SVector.icc.
ROOT::Math::SVector< T, D >::SVector | ( | const_iterator | begin, |
const_iterator | end | ||
) |
fill from a SVector iterator of type T* (for ambiguities iterator cannot be generic )
Definition at line 102 of file SVector.icc.
|
explicit |
construct a vector of size 1 from a single scalar value
Definition at line 112 of file SVector.icc.
ROOT::Math::SVector< T, D >::SVector | ( | const T & | a1, |
const T & | a2 | ||
) |
construct a vector of size 2 from 2 scalar values
Definition at line 118 of file SVector.icc.
ROOT::Math::SVector< T, D >::SVector | ( | const T & | a1, |
const T & | a2, | ||
const T & | a3 | ||
) |
construct a vector of size 3 from 3 scalar values
Definition at line 124 of file SVector.icc.
ROOT::Math::SVector< T, D >::SVector | ( | const T & | a1, |
const T & | a2, | ||
const T & | a3, | ||
const T & | a4 | ||
) |
construct a vector of size 4 from 4 scalar values
Definition at line 130 of file SVector.icc.
ROOT::Math::SVector< T, D >::SVector | ( | const T & | a1, |
const T & | a2, | ||
const T & | a3, | ||
const T & | a4, | ||
const T & | a5 | ||
) |
construct a vector of size 5 from 5 scalar values
Definition at line 136 of file SVector.icc.
ROOT::Math::SVector< T, D >::SVector | ( | const T & | a1, |
const T & | a2, | ||
const T & | a3, | ||
const T & | a4, | ||
const T & | a5, | ||
const T & | a6 | ||
) |
construct a vector of size 6 from 6 scalar values
Definition at line 144 of file SVector.icc.
ROOT::Math::SVector< T, D >::SVector | ( | const T & | a1, |
const T & | a2, | ||
const T & | a3, | ||
const T & | a4, | ||
const T & | a5, | ||
const T & | a6, | ||
const T & | a7 | ||
) |
construct a vector of size 7 from 7 scalar values
Definition at line 152 of file SVector.icc.
ROOT::Math::SVector< T, D >::SVector | ( | const T & | a1, |
const T & | a2, | ||
const T & | a3, | ||
const T & | a4, | ||
const T & | a5, | ||
const T & | a6, | ||
const T & | a7, | ||
const T & | a8 | ||
) |
construct a vector of size 8 from 8 scalar values
Definition at line 160 of file SVector.icc.
ROOT::Math::SVector< T, D >::SVector | ( | const T & | a1, |
const T & | a2, | ||
const T & | a3, | ||
const T & | a4, | ||
const T & | a5, | ||
const T & | a6, | ||
const T & | a7, | ||
const T & | a8, | ||
const T & | a9 | ||
) |
construct a vector of size 9 from 9 scalar values
Definition at line 168 of file SVector.icc.
ROOT::Math::SVector< T, D >::SVector | ( | const T & | a1, |
const T & | a2, | ||
const T & | a3, | ||
const T & | a4, | ||
const T & | a5, | ||
const T & | a6, | ||
const T & | a7, | ||
const T & | a8, | ||
const T & | a9, | ||
const T & | a10 | ||
) |
construct a vector of size 10 from 10 scalar values
Definition at line 178 of file SVector.icc.
|
inline |
access the parse tree. Index starts from zero
Definition at line 537 of file SVector.icc.
|
inline |
return non-const pointer to internal array
Definition at line 543 of file SVector.icc.
|
inline |
return read-only pointer to internal array
Definition at line 540 of file SVector.icc.
|
inline |
read/write access of vector elements with check on index. Index starts from 0.
Definition at line 602 of file SVector.icc.
|
inline |
read-only access of vector elements with check on index. Index starts from 0.
Definition at line 596 of file SVector.icc.
|
inline |
STL iterator interface.
Definition at line 550 of file SVector.icc.
|
inline |
STL const_iterator interface.
Definition at line 553 of file SVector.icc.
|
inlinestatic |
|
inline |
STL iterator interface.
Definition at line 556 of file SVector.icc.
|
inline |
STL const_iterator interface.
Definition at line 559 of file SVector.icc.
bool ROOT::Math::SVector< T, D >::IsInUse | ( | const T * | p | ) | const |
Function to check if a vector is sharing same memory location of the passed pointer This function is used by the expression templates to avoid the alias problem during expression evaluation.
When the vector is in use, for example in operations like V = M * V, where M is a mtrix, a temporary object storing the intermediate result is automatically created when evaluating the expression.
Definition at line 628 of file SVector.icc.
|
inline |
element wise comparison
Definition at line 266 of file SVector.icc.
|
inline |
element wise comparison
Definition at line 261 of file SVector.icc.
|
inline |
element wise comparison
Definition at line 272 of file SVector.icc.
|
inline |
read/write access of vector elements. Index starts from 0.
Definition at line 591 of file SVector.icc.
|
inline |
read-only access of vector elements. Index starts from 0.
Definition at line 585 of file SVector.icc.
SVector< T, D > & ROOT::Math::SVector< T, D >::operator*= | ( | const T & | rhs | ) |
self multiplication with a scalar
Definition at line 428 of file SVector.icc.
SVector< T, D > & ROOT::Math::SVector< T, D >::operator+= | ( | const SVector< T, D > & | rhs | ) |
self addition with another vector
Definition at line 379 of file SVector.icc.
SVector< T, D > & ROOT::Math::SVector< T, D >::operator+= | ( | const T & | rhs | ) |
self addition with a scalar
Definition at line 371 of file SVector.icc.
SVector< T, D > & ROOT::Math::SVector< T, D >::operator+= | ( | const VecExpr< A, T, D > & | rhs | ) |
self addition with a vector expression
Definition at line 389 of file SVector.icc.
SVector< T, D > & ROOT::Math::SVector< T, D >::operator-= | ( | const SVector< T, D > & | rhs | ) |
self subtraction with another vector
Definition at line 408 of file SVector.icc.
SVector< T, D > & ROOT::Math::SVector< T, D >::operator-= | ( | const T & | rhs | ) |
self subtraction with a scalar
Definition at line 400 of file SVector.icc.
SVector< T, D > & ROOT::Math::SVector< T, D >::operator-= | ( | const VecExpr< A, T, D > & | rhs | ) |
self subtraction with a vector expression
Definition at line 417 of file SVector.icc.
SVector< T, D > & ROOT::Math::SVector< T, D >::operator/= | ( | const T & | rhs | ) |
self division with a scalar
Definition at line 465 of file SVector.icc.
bool ROOT::Math::SVector< T, D >::operator< | ( | const SVector< T, D > & | rhs | ) | const |
element wise comparison
Definition at line 320 of file SVector.icc.
bool ROOT::Math::SVector< T, D >::operator< | ( | const T & | rhs | ) | const |
element wise comparison
Definition at line 311 of file SVector.icc.
bool ROOT::Math::SVector< T, D >::operator< | ( | const VecExpr< A, T, D > & | rhs | ) | const |
element wise comparison
Definition at line 330 of file SVector.icc.
SVector< T, D > & ROOT::Math::SVector< T, D >::operator= | ( | const SVector< T, D > & | rhs | ) |
assignment from another vector
Definition at line 199 of file SVector.icc.
SVector< T, D > & ROOT::Math::SVector< T, D >::operator= | ( | const T & | a1 | ) |
assignment from a scalar (only for size 1 vector)
Definition at line 191 of file SVector.icc.
SVector< T, D > & ROOT::Math::SVector< T, D >::operator= | ( | const VecExpr< A, T, D > & | rhs | ) |
assignment from Vector Expression
Definition at line 207 of file SVector.icc.
bool ROOT::Math::SVector< T, D >::operator== | ( | const SVector< T, D > & | rhs | ) | const |
element wise comparison
Definition at line 239 of file SVector.icc.
bool ROOT::Math::SVector< T, D >::operator== | ( | const T & | rhs | ) | const |
element wise comparison
Definition at line 230 of file SVector.icc.
bool ROOT::Math::SVector< T, D >::operator== | ( | const VecExpr< A, T, D > & | rhs | ) | const |
element wise comparison
Definition at line 249 of file SVector.icc.
bool ROOT::Math::SVector< T, D >::operator> | ( | const SVector< T, D > & | rhs | ) | const |
element wise comparison
Definition at line 289 of file SVector.icc.
bool ROOT::Math::SVector< T, D >::operator> | ( | const T & | rhs | ) | const |
element wise comparison
Definition at line 280 of file SVector.icc.
bool ROOT::Math::SVector< T, D >::operator> | ( | const VecExpr< A, T, D > & | rhs | ) | const |
element wise comparison
Definition at line 299 of file SVector.icc.
|
inline |
read/write access of vector elements. Index starts from 0.
Definition at line 588 of file SVector.icc.
|
inline |
read-only access of vector elements. Index starts from 0.
Definition at line 582 of file SVector.icc.
SVector< T, D > & ROOT::Math::SVector< T, D >::Place_at | ( | const SVector< T, D2 > & | rhs, |
unsigned int | row | ||
) |
place a sub-vector starting from the given position
Definition at line 490 of file SVector.icc.
SVector< T, D > & ROOT::Math::SVector< T, D >::Place_at | ( | const VecExpr< A, T, D2 > & | rhs, |
unsigned int | row | ||
) |
place a sub-vector expression starting from the given position
Definition at line 507 of file SVector.icc.
std::ostream & ROOT::Math::SVector< T, D >::Print | ( | std::ostream & | os | ) | const |
used by operator<<()
Definition at line 521 of file SVector.icc.
void ROOT::Math::SVector< T, D >::SetElements | ( | InputIterator | begin, |
InputIterator | end | ||
) |
set vector elements copying the values iterator size must match vector size
Definition at line 563 of file SVector.icc.
void ROOT::Math::SVector< T, D >::SetElements | ( | InputIterator | begin, |
unsigned int | size | ||
) |
set vector elements copying the values size must be <= vector size
Definition at line 571 of file SVector.icc.
SubVector ROOT::Math::SVector< T, D >::Sub | ( | unsigned int | row | ) | const |
return a subvector of size N starting at the value row where N is the size of the returned vector (SubVector::kSize) Condition row+N <= D
Definition at line 612 of file SVector.icc.
SVector< T, D > & ROOT::Math::SVector< T, D >::Unit |
transform vector into a vector of length 1
Definition at line 477 of file SVector.icc.
|
private |