00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 #ifndef _Vector_H_
00049 #define _Vector_H_
00050
00051 #ifdef GNUPRAGMA
00052 #pragma interface
00053 #endif
00054
00055 #include "CLHEP/Matrix/GenMatrix.h"
00056 #ifdef HEP_USE_RANDOM
00057 class HepRandom;
00058 #endif
00059
00060 class HepMatrix;
00061 class HepSymMatrix;
00062 class HepDiagMatrix;
00063 #ifdef HEP_USE_VECTOR_MODULE
00064 class Hep3Vector;
00065 #endif
00066
00071 class HepVector : public HepGenMatrix {
00072 public:
00073 inline HepVector();
00074
00075
00076
00077 explicit HepVector(int p);
00078 HepVector(int p, int);
00079
00080
00081 #ifdef HEP_USE_RANDOM
00082 HepVector(int p, HepRandom &r);
00083 #endif
00084
00085 HepVector(const HepVector &v);
00086 HepVector(const HepMatrix &m);
00087
00088
00089
00090 virtual ~HepVector();
00091
00092
00093 inline const double & operator()(int row) const;
00094 inline double & operator()(int row);
00095
00096
00097
00098 inline const double & operator[](int row) const;
00099 inline double & operator[](int row);
00100
00101
00102
00103 inline virtual const double & operator()(int row, int col) const;
00104 inline virtual double & operator()(int row, int col);
00105
00106
00107
00108
00109 HepVector & operator*=(double t);
00110
00111
00112 HepVector & operator/=(double t);
00113
00114
00115 HepVector & operator+=( const HepMatrix &v2);
00116 HepVector & operator+=( const HepVector &v2);
00117 HepVector & operator-=( const HepMatrix &v2);
00118 HepVector & operator-=( const HepVector &v2);
00119
00120
00121 HepVector & operator=( const HepVector &m2);
00122
00123
00124 HepVector& operator=(const HepMatrix &);
00125 #ifdef HEP_USE_VECTOR_MODULE
00126 HepVector& operator=(const Hep3Vector &);
00127 #endif
00128
00129
00130 HepVector operator- () const;
00131
00132
00133 HepVector apply(double (*f)(double, int)) const;
00134
00135
00136 HepVector sub(int min_row, int max_row) const;
00137
00138 #ifdef HEP_CC_NEED_SUB_WITHOUT_CONST
00139 HepVector sub(int min_row, int max_row);
00140
00141
00142 #endif
00143
00144 void sub(int row, const HepVector &v1);
00145
00146
00147 inline double normsq() const;
00148
00149
00150 inline double norm() const;
00151
00152
00153 inline virtual int num_row() const;
00154
00155
00156 inline virtual int num_col() const;
00157
00158
00159
00160 HepMatrix T() const;
00161
00162
00163
00164 friend inline void swap(HepVector &v1, HepVector &v2);
00165
00166
00167 protected:
00168 virtual inline int num_size() const;
00169
00170 private:
00171 virtual void invert(int&);
00172
00173
00174 friend class HepDiagMatrix;
00175 friend class HepSymMatrix;
00176 friend class HepMatrix;
00177
00178
00179 friend double dot(const HepVector &v1, const HepVector &v2);
00180
00181
00182 friend HepVector operator+(const HepVector &v1, const HepVector &v2);
00183 friend HepVector operator-(const HepVector &v1, const HepVector &v2);
00184 friend HepVector operator*(const HepSymMatrix &m1, const HepVector &m2);
00185 friend HepVector operator*(const HepDiagMatrix &m1, const HepVector &m2);
00186 friend HepMatrix operator*(const HepVector &m1, const HepMatrix &m2);
00187 friend HepVector operator*(const HepMatrix &m1, const HepVector &m2);
00188
00189 friend HepVector solve(const HepMatrix &a, const HepVector &v);
00190 friend void tridiagonal(HepSymMatrix *a,HepMatrix *hsm);
00191 friend void row_house(HepMatrix *,const HepMatrix &, double, int, int,
00192 int, int);
00193 friend void row_house(HepMatrix *,const HepVector &, double, int, int);
00194 friend void back_solve(const HepMatrix &R, HepVector *b);
00195 friend void col_house(HepMatrix *,const HepMatrix &,double, int, int,
00196 int, int);
00197 friend HepVector house(const HepSymMatrix &a,int row,int col);
00198 friend HepVector house(const HepMatrix &a,int row,int col);
00199 friend void house_with_update(HepMatrix *a,int row,int col);
00200 friend HepSymMatrix vT_times_v(const HepVector &v);
00201 friend HepVector qr_solve(HepMatrix *, const HepVector &);
00202
00203 double *m;
00204 int nrow;
00205 };
00206
00207
00208
00209
00210
00211 HepStd::ostream& operator<<(HepStd::ostream &s, const HepVector &v);
00212
00213
00214 HepVector operator*(const HepMatrix &m1, const HepVector &m2);
00215 HepVector operator*(double t, const HepVector &v1);
00216 HepVector operator*(const HepVector &v1, double t);
00217
00218
00219
00220 HepVector operator/(const HepVector &v1, double t);
00221
00222
00223 HepVector operator+(const HepMatrix &m1, const HepVector &v2);
00224 HepVector operator+(const HepVector &v1, const HepMatrix &m2);
00225 HepVector operator+(const HepVector &v1, const HepVector &v2);
00226
00227
00228 HepVector operator-(const HepMatrix &m1, const HepVector &v2);
00229 HepVector operator-(const HepVector &v1, const HepMatrix &m2);
00230 HepVector operator-(const HepVector &v1, const HepVector &v2);
00231
00232
00233 HepVector dsum(const HepVector &s1, const HepVector &s2);
00234
00235
00236 #ifdef HEP_SHORT_NAMES
00237 typedef HepVector Vector;
00238 #endif
00239
00240 #include "CLHEP/Matrix/Vector.icc"
00241
00242 #endif