#include <VectorN.hh>
Definition at line 23 of file VectorN.hh.
Public Member Functions | |
Vector () | |
Vector (const Vector< N > &other) | |
const double & | get (const size_t index) const |
const double & | operator[] (const size_t index) const |
Direct access to vector elements by index. | |
double & | operator[] (const size_t index) |
Direct access to vector elements by index. | |
Vector< N > & | set (const size_t index, const double value) |
Set indexed value. | |
size_t | size () const |
Vector dimensionality. | |
bool | isZero (double tolerance=1E-5) const |
Check for nullness, allowing for numerical precision. | |
double | mod2 () const |
Calculate the modulus-squared of a vector. . | |
double | mod () const |
Calculate the modulus of a vector. . | |
Vector< N > | operator- () const |
Invert the vector. | |
bool | operator== (const Vector< N > &a) const |
bool | operator!= (const Vector< N > &a) const |
bool | operator< (const Vector< N > &a) const |
bool | operator<= (const Vector< N > &a) const |
bool | operator> (const Vector< N > &a) const |
bool | operator>= (const Vector< N > &a) const |
Protected Member Functions | |
double & | get (const size_t index) |
Protected Attributes | |
Eigen::Vector< double, N > | _vec |
Vector. | |
Friends | |
template<size_t M> | |
Vector< M > | multiply (const Matrix< M > &a, const Vector< M > &b) |
Vector | ( | ) | [inline] |
const double& get | ( | const size_t | index | ) | const [inline] |
Definition at line 33 of file VectorN.hh.
Referenced by Rivet::fuzzyEquals(), Matrix< 4 >::setColumn(), Matrix< 4 >::setRow(), and Vector3::Vector3().
00033 { 00034 if (index >= N) { 00035 throw std::runtime_error("Tried to access an invalid vector index."); 00036 } else { 00037 return _vec(index); 00038 } 00039 }
const double& operator[] | ( | const size_t | index | ) | const [inline] |
double& operator[] | ( | const size_t | index | ) | [inline] |
Vector<N>& set | ( | const size_t | index, | |
const double | value | |||
) | [inline] |
Set indexed value.
Definition at line 52 of file VectorN.hh.
Referenced by Rivet::diagonalize(), Matrix< 4 >::getColumn(), and Matrix< 4 >::getRow().
00052 { 00053 if (index >= N) { 00054 throw std::runtime_error("Tried to access an invalid vector index."); 00055 } else { 00056 _vec[index] = value; 00057 } 00058 return *this; 00059 }
size_t size | ( | ) | const [inline] |
Vector dimensionality.
Definition at line 62 of file VectorN.hh.
Referenced by Vector< 4 >::mod2(), and Rivet::toString().
bool isZero | ( | double | tolerance = 1E-5 |
) | const [inline] |
Check for nullness, allowing for numerical precision.
Definition at line 67 of file VectorN.hh.
Referenced by LorentzTransform::boost(), and Rivet::isZero().
00067 { 00068 for (size_t i=0; i < N; ++i) { 00069 if (! Rivet::isZero(_vec[i], tolerance) ) return false; 00070 } 00071 return true; 00072 }
double mod2 | ( | ) | const [inline] |
Calculate the modulus-squared of a vector. .
Definition at line 76 of file VectorN.hh.
Referenced by Vector< 4 >::mod(), Rivet::mod2(), Vector< 4 >::mod2(), Rivet::mod2Cmp(), and LorentzTransform::setBoost().
00076 { 00077 double mod2 = 0.0; 00078 for (size_t i = 0; i < size(); ++i) { 00079 const double element = get(i); 00080 mod2 += element*element; 00081 } 00082 return mod2; 00083 }
double mod | ( | ) | const [inline] |
Calculate the modulus of a vector. .
Definition at line 87 of file VectorN.hh.
Referenced by Sphericity::_calcSphericity(), D0_1996_S3214044::_fourJetAnalysis(), D0_1996_S3214044::_threeJetAnalysis(), OPAL_1998_S3780481::analyze(), DELPHI_1995_S3137023::analyze(), ALEPH_1996_S3486095::analyze(), LorentzTransform::beta(), LorentzTransform::boost(), Rivet::calc_ALPHA34(), Rivet::calc_BZ(), Rivet::calc_KSW(), Rivet::calc_NR(), Rivet::mod(), FoxWolframMoments::project(), and LorentzTransform::setBoost().
00087 { 00088 const double norm = mod2(); 00089 assert(norm >= 0); 00090 return sqrt(norm); 00091 }
Vector<N> operator- | ( | ) | const [inline] |
Invert the vector.
Reimplemented in Vector3, and FourVector.
Definition at line 94 of file VectorN.hh.
00094 { 00095 Vector<N> rtn; 00096 rtn._vec = -_vec; 00097 return rtn; 00098 }
bool operator== | ( | const Vector< N > & | a | ) | const [inline] |
bool operator!= | ( | const Vector< N > & | a | ) | const [inline] |
bool operator< | ( | const Vector< N > & | a | ) | const [inline] |
bool operator<= | ( | const Vector< N > & | a | ) | const [inline] |
bool operator> | ( | const Vector< N > & | a | ) | const [inline] |
bool operator>= | ( | const Vector< N > & | a | ) | const [inline] |
double& get | ( | const size_t | index | ) | [inline, protected] |
Definition at line 126 of file VectorN.hh.
00126 { 00127 if (index >= N) { 00128 throw std::runtime_error("Tried to access an invalid vector index."); 00129 } else { 00130 return _vec(index); 00131 } 00132 }
Eigen::Vector<double,N> _vec [protected] |
Definition at line 135 of file VectorN.hh.
Referenced by Rivet::add(), Vector3::cross(), Vector3::dot(), Vector< 4 >::get(), Vector< 4 >::isZero(), Matrix3::Matrix3(), Rivet::multiply(), Vector< 4 >::operator!=(), FourVector::operator*=(), Vector3::operator*=(), Vector< 4 >::operator-(), FourVector::operator-(), Vector3::operator-(), Vector3::operator-=(), FourVector::operator/=(), Vector3::operator/=(), Vector< 4 >::operator<(), Vector< 4 >::operator<=(), Vector< 4 >::operator==(), Vector< 4 >::operator>(), Vector< 4 >::operator>=(), Vector< 4 >::set(), Matrix3::setAsRotation(), Rivet::subtract(), and Vector< 4 >::Vector().