ROOT 6.14/05 Reference Guide |
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)
Definition at line 30 of file BinaryOperators.h.
Public Types | |
--- Typedefs --- | |
typedef T | value_type |
contained scalar type More... | |
typedef T * | iterator |
STL iterator interface. More... | |
typedef const T * | const_iterator |
STL const_iterator interface. More... | |
Public Member Functions | |
--- Constructors --- | |
SVector () | |
Default constructor: vector filled with zero values. More... | |
template<class A > | |
SVector (const VecExpr< A, T, D > &rhs) | |
contruct from a vector expression More... | |
SVector (const SVector< T, D > &rhs) | |
copy contructor More... | |
SVector (const T *a, unsigned int len) | |
fill from array with len must be equal to D! More... | |
SVector (const_iterator begin, const_iterator end) | |
fill from a SVector iterator of type T* (for ambiguities iterator cannot be generic ) More... | |
SVector (const T &a1) | |
construct a vector of size 1 from a single scalar value More... | |
SVector (const T &a1, const T &a2) | |
construct a vector of size 2 from 2 scalar values More... | |
SVector (const T &a1, const T &a2, const T &a3) | |
construct a vector of size 3 from 3 scalar values More... | |
SVector (const T &a1, const T &a2, const T &a3, const T &a4) | |
construct a vector of size 4 from 4 scalar values More... | |
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 More... | |
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 More... | |
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 More... | |
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 More... | |
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 More... | |
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 More... | |
SVector< T, D > & | operator= (const T &a1) |
assignment from a scalar (only for size 1 vector) More... | |
template<class A > | |
SVector< T, D > & | operator= (const VecExpr< A, T, D > &rhs) |
assignment from Vector Expression More... | |
--- STL-like interface --- | |
iterator | begin () |
STL iterator interface. More... | |
iterator | end () |
STL iterator interface. More... | |
const_iterator | begin () const |
STL const_iterator interface. More... | |
const_iterator | end () const |
STL const_iterator interface. More... | |
template<class InputIterator > | |
void | SetElements (InputIterator begin, InputIterator end) |
set vector elements copying the values iterator size must match vector size More... | |
template<class InputIterator > | |
void | SetElements (InputIterator begin, unsigned int size) |
set vector elements copying the values size must be <= vector size More... | |
--- Operators --- | |
bool | operator== (const T &rhs) const |
element wise comparison More... | |
bool | operator!= (const T &rhs) const |
element wise comparison More... | |
bool | operator== (const SVector< T, D > &rhs) const |
element wise comparison More... | |
bool | operator!= (const SVector< T, D > &rhs) const |
element wise comparison More... | |
template<class A > | |
bool | operator== (const VecExpr< A, T, D > &rhs) const |
element wise comparison More... | |
template<class A > | |
bool | operator!= (const VecExpr< A, T, D > &rhs) const |
element wise comparison More... | |
bool | operator> (const T &rhs) const |
element wise comparison More... | |
bool | operator< (const T &rhs) const |
element wise comparison More... | |
bool | operator> (const SVector< T, D > &rhs) const |
element wise comparison More... | |
bool | operator< (const SVector< T, D > &rhs) const |
element wise comparison More... | |
template<class A > | |
bool | operator> (const VecExpr< A, T, D > &rhs) const |
element wise comparison More... | |
template<class A > | |
bool | operator< (const VecExpr< A, T, D > &rhs) const |
element wise comparison More... | |
const T & | operator[] (unsigned int i) const |
read-only access of vector elements. Index starts from 0. More... | |
const T & | operator() (unsigned int i) const |
read-only access of vector elements. Index starts from 0. More... | |
const T & | At (unsigned int i) const |
read-only access of vector elements with check on index. Index starts from 0. More... | |
T & | operator[] (unsigned int i) |
read/write access of vector elements. Index starts from 0. More... | |
T & | operator() (unsigned int i) |
read/write access of vector elements. Index starts from 0. More... | |
T & | At (unsigned int i) |
read/write access of vector elements with check on index. Index starts from 0. More... | |
SVector< T, D > & | operator+= (const T &rhs) |
self addition with a scalar More... | |
SVector< T, D > & | operator-= (const T &rhs) |
self subtraction with a scalar More... | |
SVector< T, D > & | operator*= (const T &rhs) |
self multiplication with a scalar More... | |
SVector< T, D > & | operator/= (const T &rhs) |
self division with a scalar More... | |
SVector< T, D > & | operator+= (const SVector< T, D > &rhs) |
self addition with another vector More... | |
SVector< T, D > & | operator-= (const SVector< T, D > &rhs) |
self subtraction with another vector More... | |
template<class A > | |
SVector< T, D > & | operator+= (const VecExpr< A, T, D > &rhs) |
self addition with a vector expression More... | |
template<class A > | |
SVector< T, D > & | operator-= (const VecExpr< A, T, D > &rhs) |
self subtraction with a vector expression More... | |
--- Expert functions --- | |
SVector< T, D > & | Unit () |
transform vector into a vector of length 1 More... | |
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 More... | |
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 More... | |
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 More... | |
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. More... | |
std::ostream & | Print (std::ostream &os) const |
used by operator<<() More... | |
Private Attributes | |
--- Data member --- | |
T | fArray [D] |
SVector data. More... | |
--- 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 More... | |
const T * | Array () const |
return read-only pointer to internal array More... | |
T * | Array () |
return non-const pointer to internal array More... | |
static unsigned int | Dim () |
return dimension $D$ More... | |
#include <Math/BinaryOperators.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 | ) |
contruct from a vector expression
Definition at line 60 of file SVector.icc.
ROOT::Math::SVector< T, D >::SVector | ( | const SVector< T, D > & | rhs | ) |
copy contructor
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 97 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 105 of file SVector.icc.
|
explicit |
construct a vector of size 1 from a single scalar value
Definition at line 115 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 121 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 127 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 133 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 139 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 147 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 155 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 163 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 171 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 181 of file SVector.icc.
|
inline |
access the parse tree. Index starts from zero
Definition at line 533 of file SVector.icc.
|
inline |
return read-only pointer to internal array
Definition at line 536 of file SVector.icc.
|
inline |
return non-const pointer to internal array
Definition at line 539 of file SVector.icc.
|
inline |
read-only access of vector elements with check on index. Index starts from 0.
Definition at line 592 of file SVector.icc.
|
inline |
read/write access of vector elements with check on index. Index starts from 0.
Definition at line 598 of file SVector.icc.
|
inline |
STL iterator interface.
Definition at line 546 of file SVector.icc.
|
inline |
STL const_iterator interface.
Definition at line 549 of file SVector.icc.
|
inlinestatic |
|
inline |
STL iterator interface.
Definition at line 552 of file SVector.icc.
|
inline |
STL const_iterator interface.
Definition at line 555 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 624 of file SVector.icc.
|
inline |
element wise comparison
Definition at line 257 of file SVector.icc.
|
inline |
element wise comparison
Definition at line 262 of file SVector.icc.
|
inline |
element wise comparison
Definition at line 268 of file SVector.icc.
|
inline |
read-only access of vector elements. Index starts from 0.
Definition at line 581 of file SVector.icc.
|
inline |
read/write access of vector elements. Index starts from 0.
Definition at line 587 of file SVector.icc.
SVector< T, D > & ROOT::Math::SVector< T, D >::operator*= | ( | const T & | rhs | ) |
self multiplication with a scalar
Definition at line 424 of file SVector.icc.
SVector< T, D > & ROOT::Math::SVector< T, D >::operator+= | ( | const T & | rhs | ) |
self addition with a scalar
Definition at line 367 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 375 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 385 of file SVector.icc.
SVector< T, D > & ROOT::Math::SVector< T, D >::operator-= | ( | const T & | rhs | ) |
self subtraction with a scalar
Definition at line 396 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 404 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 413 of file SVector.icc.
SVector< T, D > & ROOT::Math::SVector< T, D >::operator/= | ( | const T & | rhs | ) |
self division with a scalar
Definition at line 461 of file SVector.icc.
bool ROOT::Math::SVector< T, D >::operator< | ( | const T & | rhs | ) | const |
element wise comparison
Definition at line 307 of file SVector.icc.
bool ROOT::Math::SVector< T, D >::operator< | ( | const SVector< T, D > & | rhs | ) | const |
element wise comparison
Definition at line 316 of file SVector.icc.
bool ROOT::Math::SVector< T, D >::operator< | ( | const VecExpr< A, T, D > & | rhs | ) | const |
element wise comparison
Definition at line 326 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 194 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 203 of file SVector.icc.
bool ROOT::Math::SVector< T, D >::operator== | ( | const T & | rhs | ) | const |
element wise comparison
Definition at line 226 of file SVector.icc.
bool ROOT::Math::SVector< T, D >::operator== | ( | const SVector< T, D > & | rhs | ) | const |
element wise comparison
Definition at line 235 of file SVector.icc.
bool ROOT::Math::SVector< T, D >::operator== | ( | const VecExpr< A, T, D > & | rhs | ) | const |
element wise comparison
Definition at line 245 of file SVector.icc.
bool ROOT::Math::SVector< T, D >::operator> | ( | const T & | rhs | ) | const |
element wise comparison
Definition at line 276 of file SVector.icc.
bool ROOT::Math::SVector< T, D >::operator> | ( | const SVector< T, D > & | rhs | ) | const |
element wise comparison
Definition at line 285 of file SVector.icc.
bool ROOT::Math::SVector< T, D >::operator> | ( | const VecExpr< A, T, D > & | rhs | ) | const |
element wise comparison
Definition at line 295 of file SVector.icc.
|
inline |
read-only access of vector elements. Index starts from 0.
Definition at line 578 of file SVector.icc.
|
inline |
read/write access of vector elements. Index starts from 0.
Definition at line 584 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 486 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 503 of file SVector.icc.
std::ostream & ROOT::Math::SVector< T, D >::Print | ( | std::ostream & | os | ) | const |
used by operator<<()
Definition at line 517 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 559 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 567 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 608 of file SVector.icc.
SVector< T, D > & ROOT::Math::SVector< T, D >::Unit | ( | ) |
transform vector into a vector of length 1
Definition at line 473 of file SVector.icc.
|
private |