File indexing completed on 2025-01-18 09:54:37
0001
0002
0003
0004
0005
0006
0007 #include <cmath>
0008 #include <stdlib.h>
0009
0010 namespace CLHEP {
0011
0012
0013 inline void swap(HepVector &v1,HepVector &v2) {
0014 HepGenMatrix::swap(v1.m,v2.m);
0015 HepGenMatrix::swap(v1.nrow,v2.nrow);
0016 }
0017
0018 inline HepVector::HepVector()
0019 : m(0), nrow(0)
0020 {}
0021
0022 inline double HepVector::normsq() const {return dot((*this),(*this));}
0023 inline double HepVector::norm() const {return sqrt(normsq());}
0024
0025 inline double & HepVector::operator()(int row)
0026 {
0027 #ifdef MATRIX_BOUND_CHECK
0028 if(row<1 || row>nrow)
0029 error("Range error in HepVector::operator()");
0030 #endif
0031
0032 return *(m.begin()+row-1);
0033 }
0034 inline const double & HepVector::operator()(int row) const
0035 {
0036 #ifdef MATRIX_BOUND_CHECK
0037 if(row<1 || row>nrow)
0038 error("Range error in HepVector::operator()");
0039 #endif
0040
0041 return *(m.begin()+row-1);
0042 }
0043 inline double & HepVector::operator[](int row)
0044 {
0045 #ifdef MATRIX_BOUND_CHECK
0046 if(row<0 || row>=nrow)
0047 error("Range error in HepVector::operator[]");
0048 #endif
0049
0050 return *(m.begin()+row);
0051 }
0052 inline const double & HepVector::operator[](int row) const
0053 {
0054 #ifdef MATRIX_BOUND_CHECK
0055 if(row<0 || row>=nrow)
0056 error("Range error in HepVector::operator[]");
0057 #endif
0058
0059 return *(m.begin()+row);
0060 }
0061
0062 }
0063