File indexing completed on 2025-01-30 10:03:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef _Vector_H_
0017 #define _Vector_H_
0018
0019 #include "CLHEP/Matrix/defs.h"
0020 #include "CLHEP/Matrix/GenMatrix.h"
0021
0022 namespace CLHEP {
0023
0024 class HepRandom;
0025
0026 class HepMatrix;
0027 class HepSymMatrix;
0028 class HepDiagMatrix;
0029 class Hep3Vector;
0030
0031
0032
0033
0034
0035 class HepVector : public HepGenMatrix {
0036 public:
0037 inline HepVector();
0038
0039
0040
0041 explicit HepVector(int p);
0042 HepVector(int p, int);
0043
0044
0045 HepVector(int p, HepRandom &r);
0046
0047 HepVector(const HepVector &v);
0048 HepVector(const HepMatrix &m);
0049
0050
0051
0052 virtual ~HepVector();
0053
0054
0055 inline const double & operator()(int row) const;
0056 inline double & operator()(int row);
0057
0058
0059
0060 inline const double & operator[](int row) const;
0061 inline double & operator[](int row);
0062
0063
0064
0065 virtual const double & operator()(int row, int col) const;
0066 virtual double & operator()(int row, int col);
0067
0068
0069
0070
0071 HepVector & operator*=(double t);
0072
0073
0074 HepVector & operator/=(double t);
0075
0076
0077 HepVector & operator+=( const HepMatrix &v2);
0078 HepVector & operator+=( const HepVector &v2);
0079 HepVector & operator-=( const HepMatrix &v2);
0080 HepVector & operator-=( const HepVector &v2);
0081
0082
0083 HepVector & operator=( const HepVector &hm2);
0084
0085
0086 HepVector& operator=(const HepMatrix &);
0087 HepVector& operator=(const Hep3Vector &);
0088
0089
0090 HepVector operator- () const;
0091
0092
0093 HepVector apply(double (*f)(double, int)) const;
0094
0095
0096 HepVector sub(int min_row, int max_row) const;
0097
0098 HepVector sub(int min_row, int max_row);
0099
0100
0101
0102 void sub(int row, const HepVector &v1);
0103
0104
0105 inline double normsq() const;
0106
0107
0108 inline double norm() const;
0109
0110
0111 virtual int num_row() const;
0112
0113
0114 virtual int num_col() const;
0115
0116
0117
0118 HepMatrix T() const;
0119
0120
0121
0122 friend inline void swap(HepVector &v1, HepVector &v2);
0123
0124
0125 protected:
0126 virtual int num_size() const;
0127
0128 private:
0129 virtual void invert(int&);
0130
0131
0132 friend class HepDiagMatrix;
0133 friend class HepSymMatrix;
0134 friend class HepMatrix;
0135
0136
0137 friend double dot(const HepVector &v1, const HepVector &v2);
0138
0139
0140 friend HepVector operator+(const HepVector &v1, const HepVector &v2);
0141 friend HepVector operator-(const HepVector &v1, const HepVector &v2);
0142 friend HepVector operator*(const HepSymMatrix &hm1, const HepVector &hm2);
0143 friend HepVector operator*(const HepDiagMatrix &hm1, const HepVector &hm2);
0144 friend HepMatrix operator*(const HepVector &hm1, const HepMatrix &hm2);
0145 friend HepVector operator*(const HepMatrix &hm1, const HepVector &hm2);
0146
0147 friend HepVector solve(const HepMatrix &a, const HepVector &v);
0148 friend void tridiagonal(HepSymMatrix *a,HepMatrix *hsm);
0149 friend void row_house(HepMatrix *,const HepMatrix &, double, int, int,
0150 int, int);
0151 friend void row_house(HepMatrix *,const HepVector &, double, int, int);
0152 friend void back_solve(const HepMatrix &R, HepVector *b);
0153 friend void col_house(HepMatrix *,const HepMatrix &,double, int, int,
0154 int, int);
0155 friend HepVector house(const HepSymMatrix &a,int row,int col);
0156 friend HepVector house(const HepMatrix &a,int row,int col);
0157 friend void house_with_update(HepMatrix *a,int row,int col);
0158 friend HepSymMatrix vT_times_v(const HepVector &v);
0159 friend HepVector qr_solve(HepMatrix *, const HepVector &);
0160
0161 #ifdef DISABLE_ALLOC
0162 std::vector<double > m;
0163 #else
0164 std::vector<double,Alloc<double,25> > m;
0165 #endif
0166 int nrow;
0167 };
0168
0169
0170
0171
0172
0173 std::ostream& operator<<(std::ostream &s, const HepVector &v);
0174
0175
0176 HepVector operator*(const HepMatrix &hm1, const HepVector &hm2);
0177 HepVector operator*(double t, const HepVector &v1);
0178 HepVector operator*(const HepVector &v1, double t);
0179
0180
0181
0182 HepVector operator/(const HepVector &v1, double t);
0183
0184
0185 HepVector operator+(const HepMatrix &hm1, const HepVector &v2);
0186 HepVector operator+(const HepVector &v1, const HepMatrix &hm2);
0187 HepVector operator+(const HepVector &v1, const HepVector &v2);
0188
0189
0190 HepVector operator-(const HepMatrix &hm1, const HepVector &v2);
0191 HepVector operator-(const HepVector &v1, const HepMatrix &hm2);
0192 HepVector operator-(const HepVector &v1, const HepVector &v2);
0193
0194
0195 HepVector dsum(const HepVector &s1, const HepVector &s2);
0196
0197
0198 }
0199
0200 #ifdef ENABLE_BACKWARDS_COMPATIBILITY
0201
0202 using namespace CLHEP;
0203 #endif
0204
0205 #include "CLHEP/Matrix/Vector.icc"
0206
0207 #endif