10 #include "CLHEP/Matrix/defs.h" 11 #include "CLHEP/Random/Random.h" 12 #include "CLHEP/Vector/ThreeVector.h" 13 #include "CLHEP/Matrix/Vector.h" 14 #include "CLHEP/Matrix/Matrix.h" 16 #ifdef HEP_DEBUG_INLINE 17 #include "CLHEP/Matrix/Vector.icc" 24 #define SIMPLE_UOP(OPER) \ 25 HepGenMatrix::mIter a=m.begin(); \ 26 HepGenMatrix::mIter e=m.begin()+num_size(); \ 27 for(;a<e; a++) (*a) OPER t; 29 #define SIMPLE_BOP(OPER) \ 31 mcIter b=hm2.m.begin(); \ 32 mcIter e=m.begin()+num_size(); \ 33 for(;a<e; a++, b++) (*a) OPER (*b); 35 #define SIMPLE_TOP(OPER) \ 36 HepGenMatrix::mcIter a=hm1.m.begin(); \ 37 HepGenMatrix::mcIter b=hm2.m.begin(); \ 38 HepGenMatrix::mIter t=mret.m.begin(); \ 39 HepGenMatrix::mcIter e=hm1.m.begin()+hm1.num_size(); \ 40 for( ;a<e; a++, b++, t++) (*t) = (*a) OPER (*b); 42 #define CHK_DIM_2(r1,r2,c1,c2,fun) \ 43 if (r1!=r2 || c1!=c2) { \ 44 HepGenMatrix::error("Range error in Vector function " #fun "(1)."); \ 47 #define CHK_DIM_1(c1,r2,fun) \ 49 HepGenMatrix::error("Range error in Vector function " #fun "(2)."); \ 70 mIter e = m.begin() + nrow;
71 for (
mIter i=m.begin(); i<e; i++) *i = 1.0;
76 error(
"Vector: initialization must be either 0 or 1.");
85 for(;a<
b;a++) *a = r();
107 : m(hm1.nrow), nrow(hm1.nrow)
110 error(
"Vector::Vector(Matrix) : Matrix is not Nx1");
123 #ifdef MATRIX_BOUND_CHECK 126 if( col!=1 || row<1 || row>nrow)
127 error(
"Range error in HepVector::operator(i,j)");
133 return *(m.begin()+(row-1));
136 #ifdef MATRIX_BOUND_CHECK 139 if( col!=1 || row<1 || row>nrow)
140 error(
"Range error in HepVector::operator(i,j)");
146 return *(m.begin()+(row-1));
152 #ifdef HEP_GNU_OPTIMIZED_RETURN 153 return vret(max_row-min_row+1);
160 error(
"HepVector::sub: Index out of range");
164 for(;a<e;) *(a++) = *(b++);
172 error(
"HepVector::sub: Index out of range");
176 for(;a<e;) *(a++) = *(b++);
183 error(
"HepVector::sub: Index out of range");
187 for(;a<e;) *(b++) = *(a++);
196 #ifdef HEP_GNU_OPTIMIZED_RETURN 214 #ifdef HEP_GNU_OPTIMIZED_RETURN 224 for(;a<e; a++, b++) (*b) = -(*a);
231 #ifdef HEP_GNU_OPTIMIZED_RETURN 244 #ifdef HEP_GNU_OPTIMIZED_RETURN 257 #ifdef HEP_GNU_OPTIMIZED_RETURN 274 #ifdef HEP_GNU_OPTIMIZED_RETURN 288 #ifdef HEP_GNU_OPTIMIZED_RETURN 301 #ifdef HEP_GNU_OPTIMIZED_RETURN 320 #ifdef HEP_GNU_OPTIMIZED_RETURN 332 #ifdef HEP_GNU_OPTIMIZED_RETURN 344 #ifdef HEP_GNU_OPTIMIZED_RETURN 356 #ifdef HEP_GNU_OPTIMIZED_RETURN 368 for(hm1p=hm1.m.begin();hm1p<hm1.m.begin()+hm1.
num_row()*hm1.
num_col();hm1p=hm2p)
374 temp+=(*(hm2p++))*(*(vp++));
381 #ifdef HEP_GNU_OPTIMIZED_RETURN 392 for(hm1p=hm1.m.begin();hm1p<hm1.m.begin()+hm1.
num_row();hm1p++)
393 for(hm2p=hm2.m.begin();hm2p<hm2.m.begin()+hm2.
num_col();hm2p++)
394 *(mrp++)=*hm1p*(*hm2p);
458 if(hm1.nrow != size_)
483 error(
"Vector::operator=(Matrix) : Matrix is not Nx1");
519 if(os.flags() & std::ios::fixed)
520 width = os.precision()+3;
522 width = os.precision()+7;
523 for(
int irow = 1; irow<= q.
num_row(); irow++)
526 os << q(irow) << std::endl;
532 #ifdef HEP_GNU_OPTIMIZED_RETURN 551 for(;a<e;) d += (*(a++)) * (*(b++));
557 #ifdef HEP_GNU_OPTIMIZED_RETURN 566 for(
int ir=1;ir<=
num_row();ir++) {
567 *(b++) = (*
f)(*(a++), ir);
572 void HepVector::invert(
int &) {
573 error(
"HepVector::invert: You cannot invert a Vector");
577 #ifdef HEP_GNU_OPTIMIZED_RETURN 584 static int max_array = 20;
585 static int *ir =
new int [max_array+1];
596 ir =
new int [max_array+1];
600 int i = mt.dfact_matrix(det, ir);
602 for (i=1;i<=
n;i++) vret(i) = 0;
608 for (
int hmm=1;hmm<=nxch;hmm++) {
617 vret(1) = mt(1,1) * vret(1);
621 for (
int j=1;j<i;j++) {
622 s21 += mt(i,j) * vret(j);
624 vret(i) = -mt(i,i)*s21;
629 for (
int j=1;j<=i;j++) {
630 s22 += mt(nmi,n-j+1) * vret(n-j+1);
HepVector & operator=(const HepVector &hm2)
virtual int num_row() const
HepMatrix & operator=(const HepMatrix &)
const double & operator()(int row) const
HepLorentzVector operator/(const HepLorentzVector &, double a)
std::vector< double, Alloc< double, 25 > >::const_iterator mcIter
friend double dot(const HepVector &v1, const HepVector &v2)
HepVector apply(double(*f)(double, int)) const
virtual int num_size() const
#define CHK_DIM_2(r1, r2, c1, c2, fun)
HepDiagMatrix dsum(const HepDiagMatrix &s1, const HepDiagMatrix &s2)
virtual int num_col() const
HepVector sub(int min_row, int max_row) const
friend HepVector operator+(const HepVector &v1, const HepVector &v2)
HepVector operator-() const
HepVector & operator-=(const HepMatrix &v2)
#define CHK_DIM_1(c1, r2, fun)
std::vector< double, Alloc< double, 25 > >::iterator mIter
virtual int num_col() const
HepVector & operator/=(double t)
HepVector & operator+=(const HepMatrix &v2)
friend HepVector operator*(const HepSymMatrix &hm1, const HepVector &hm2)
static void error(const char *s)
virtual int num_row() const
HepMatrix & operator-=(const HepMatrix &)
HepMatrix & operator+=(const HepMatrix &)
std::ostream & operator<<(std::ostream &os, const HepAxisAngle &aa)
friend HepVector solve(const HepMatrix &a, const HepVector &v)
HepVector & operator*=(double t)