Warning, file /include/CLHEP/Matrix/Matrix.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184 #ifndef _Matrix_H_
0185 #define _Matrix_H_
0186
0187 #include <vector>
0188
0189 #include "CLHEP/Matrix/defs.h"
0190 #include "CLHEP/Matrix/GenMatrix.h"
0191
0192 namespace CLHEP {
0193
0194 class HepRandom;
0195
0196 class HepSymMatrix;
0197 class HepDiagMatrix;
0198 class HepVector;
0199 class HepRotation;
0200
0201
0202
0203
0204
0205 class HepMatrix : public HepGenMatrix {
0206 public:
0207 inline HepMatrix();
0208
0209
0210
0211 HepMatrix(int p, int q);
0212
0213 HepMatrix(int p, int q, int i);
0214
0215
0216
0217
0218 HepMatrix(int p, int q, HepRandom &r);
0219
0220
0221 HepMatrix(const HepMatrix &hm1);
0222
0223
0224 HepMatrix(const HepSymMatrix &);
0225 HepMatrix(const HepDiagMatrix &);
0226 HepMatrix(const HepVector &);
0227
0228
0229 virtual ~HepMatrix();
0230
0231
0232 virtual int num_row() const;
0233
0234
0235 virtual int num_col() const;
0236
0237
0238 virtual const double & operator()(int row, int col) const;
0239 virtual double & operator()(int row, int col);
0240
0241
0242
0243 HepMatrix & operator *= (double t);
0244
0245
0246 HepMatrix & operator /= (double t);
0247
0248
0249 HepMatrix & operator += ( const HepMatrix &);
0250 HepMatrix & operator += ( const HepSymMatrix &);
0251 HepMatrix & operator += ( const HepDiagMatrix &);
0252 HepMatrix & operator += ( const HepVector &);
0253 HepMatrix & operator -= ( const HepMatrix &);
0254 HepMatrix & operator -= ( const HepSymMatrix &);
0255 HepMatrix & operator -= ( const HepDiagMatrix &);
0256 HepMatrix & operator -= ( const HepVector &);
0257
0258
0259
0260 HepMatrix & operator = ( const HepMatrix &);
0261 HepMatrix & operator = ( const HepSymMatrix &);
0262 HepMatrix & operator = ( const HepDiagMatrix &);
0263 HepMatrix & operator = ( const HepVector &);
0264 HepMatrix & operator = ( const HepRotation &);
0265
0266
0267 HepMatrix operator- () const;
0268
0269
0270 HepMatrix apply(double (*f)(double, int, int)) const;
0271
0272
0273 HepMatrix T() const;
0274
0275
0276 HepMatrix sub(int min_row, int max_row, int min_col, int max_col) const;
0277
0278
0279 void sub(int row, int col, const HepMatrix &hm1);
0280
0281
0282
0283 friend inline void swap(HepMatrix &hm1, HepMatrix &hm2);
0284
0285
0286 inline HepMatrix inverse(int& ierr) const;
0287
0288
0289
0290 virtual void invert(int& ierr);
0291
0292
0293
0294
0295
0296 inline void invert();
0297
0298
0299 inline HepMatrix inverse() const;
0300
0301
0302
0303 double determinant() const;
0304
0305
0306 double trace() const;
0307
0308
0309 class HepMatrix_row {
0310 public:
0311 inline HepMatrix_row(HepMatrix&,int);
0312 double & operator[](int);
0313 private:
0314 HepMatrix& _a;
0315 int _r;
0316 };
0317 class HepMatrix_row_const {
0318 public:
0319 inline HepMatrix_row_const (const HepMatrix&,int);
0320 const double & operator[](int) const;
0321 private:
0322 const HepMatrix& _a;
0323 int _r;
0324 };
0325
0326
0327 inline HepMatrix_row operator[] (int);
0328 inline const HepMatrix_row_const operator[] (int) const;
0329
0330
0331
0332
0333
0334 protected:
0335 virtual int num_size() const;
0336 virtual void invertHaywood4(int& ierr);
0337 virtual void invertHaywood5(int& ierr);
0338 virtual void invertHaywood6(int& ierr);
0339
0340 private:
0341 friend class HepMatrix_row;
0342 friend class HepMatrix_row_const;
0343 friend class HepVector;
0344 friend class HepSymMatrix;
0345 friend class HepDiagMatrix;
0346
0347
0348 friend HepMatrix operator+(const HepMatrix &hm1, const HepMatrix &hm2);
0349 friend HepMatrix operator-(const HepMatrix &hm1, const HepMatrix &hm2);
0350 friend HepMatrix operator*(const HepMatrix &hm1, const HepMatrix &hm2);
0351 friend HepMatrix operator*(const HepMatrix &hm1, const HepSymMatrix &hm2);
0352 friend HepMatrix operator*(const HepMatrix &hm1, const HepDiagMatrix &hm2);
0353 friend HepMatrix operator*(const HepSymMatrix &hm1, const HepMatrix &hm2);
0354 friend HepMatrix operator*(const HepDiagMatrix &hm1, const HepMatrix &hm2);
0355 friend HepMatrix operator*(const HepVector &hm1, const HepMatrix &hm2);
0356 friend HepVector operator*(const HepMatrix &hm1, const HepVector &hm2);
0357 friend HepMatrix operator*(const HepSymMatrix &hm1, const HepSymMatrix &hm2);
0358
0359
0360 friend HepVector solve(const HepMatrix &, const HepVector &);
0361
0362 friend HepVector qr_solve(HepMatrix *, const HepVector &);
0363 friend HepMatrix qr_solve(HepMatrix *, const HepMatrix &b);
0364 friend void tridiagonal(HepSymMatrix *a,HepMatrix *hsm);
0365 friend void row_house(HepMatrix *,const HepMatrix &, double,
0366 int, int, int, int);
0367 friend void row_house(HepMatrix *,const HepVector &, double,
0368 int, int);
0369 friend void back_solve(const HepMatrix &R, HepVector *b);
0370 friend void back_solve(const HepMatrix &R, HepMatrix *b);
0371 friend void col_givens(HepMatrix *A, double c,
0372 double s, int k1, int k2,
0373 int rowmin, int rowmax);
0374
0375 friend void row_givens(HepMatrix *A, double c,
0376 double s, int k1, int k2,
0377 int colmin, int colmax);
0378 friend void col_house(HepMatrix *,const HepMatrix &, double,
0379 int, int, int, int);
0380 friend HepVector house(const HepMatrix &a,int row,int col);
0381 friend void house_with_update(HepMatrix *a,int row,int col);
0382 friend void house_with_update(HepMatrix *a,HepMatrix *v,int row,int col);
0383 friend void house_with_update2(HepSymMatrix *a,HepMatrix *v,
0384 int row,int col);
0385
0386 int dfact_matrix(double &det, int *ir);
0387
0388
0389
0390
0391 int dfinv_matrix(int *ir);
0392
0393
0394 #ifdef DISABLE_ALLOC
0395 std::vector<double > m;
0396 #else
0397 std::vector<double,Alloc<double,25> > m;
0398 #endif
0399 int nrow, ncol;
0400 int size_;
0401 };
0402
0403
0404
0405
0406 HepMatrix operator*(const HepMatrix &, const HepMatrix &);
0407 HepMatrix operator*(double t, const HepMatrix &);
0408 HepMatrix operator*(const HepMatrix &, double );
0409
0410
0411
0412 HepMatrix operator/(const HepMatrix &, double );
0413
0414
0415 HepMatrix operator+(const HepMatrix &hm1, const HepMatrix &hm2);
0416
0417
0418
0419 HepMatrix operator-(const HepMatrix &hm1, const HepMatrix &hm2);
0420
0421
0422
0423 HepMatrix dsum(const HepMatrix&, const HepMatrix&);
0424
0425
0426
0427
0428 HepVector solve(const HepMatrix &, const HepVector &);
0429
0430
0431 std::ostream& operator<<(std::ostream &s, const HepMatrix &q);
0432
0433
0434
0435
0436
0437
0438 HepVector qr_solve(const HepMatrix &A, const HepVector &b);
0439 HepVector qr_solve(HepMatrix *A, const HepVector &b);
0440 HepMatrix qr_solve(const HepMatrix &A, const HepMatrix &b);
0441 HepMatrix qr_solve(HepMatrix *A, const HepMatrix &b);
0442
0443
0444
0445 HepMatrix qr_inverse(const HepMatrix &A);
0446 HepMatrix qr_inverse(HepMatrix *A);
0447
0448
0449
0450
0451
0452 void qr_decomp(HepMatrix *A, HepMatrix *hsm);
0453 HepMatrix qr_decomp(HepMatrix *A);
0454
0455
0456 void back_solve(const HepMatrix &R, HepVector *b);
0457 void back_solve(const HepMatrix &R, HepMatrix *b);
0458
0459
0460
0461
0462 void col_house(HepMatrix *a, const HepMatrix &v, double vnormsq,
0463 int row, int col, int row_start, int col_start);
0464 void col_house(HepMatrix *a, const HepMatrix &v, int row, int col,
0465 int row_start, int col_start);
0466
0467
0468 void col_givens(HepMatrix *A, double c, double s,
0469 int k1, int k2, int row_min=1, int row_max=0);
0470
0471
0472 void row_givens(HepMatrix *A, double c, double s,
0473 int k1, int k2, int col_min=1, int col_max=0);
0474
0475
0476 void givens(double a, double b, double *c, double *s);
0477
0478
0479 HepVector house(const HepMatrix &a, int row=1, int col=1);
0480
0481
0482 void house_with_update(HepMatrix *a, int row=1, int col=1);
0483 void house_with_update(HepMatrix *a, HepMatrix *v, int row=1, int col=1);
0484
0485
0486 void row_house(HepMatrix *a, const HepVector &v, double vnormsq,
0487 int row=1, int col=1);
0488 void row_house(HepMatrix *a, const HepMatrix &v, double vnormsq,
0489 int row, int col, int row_start, int col_start);
0490 void row_house(HepMatrix *a, const HepMatrix &v, int row, int col,
0491 int row_start, int col_start);
0492
0493
0494 }
0495
0496 #ifdef ENABLE_BACKWARDS_COMPATIBILITY
0497
0498 using namespace CLHEP;
0499 #endif
0500
0501 #ifndef HEP_DEBUG_INLINE
0502 #include "CLHEP/Matrix/Matrix.icc"
0503 #endif
0504
0505 #endif