CLHEP  2.4.7.2
C++ Class Library for High Energy Physics
GenMatrix.icc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // ---------------------------------------------------------------------------
3 //
4 // This file is a part of the CLHEP - a Class Library for High Energy Physics.
5 //
6 // This software written by Nobu Katayama and Mike Smyth, Cornell University.
7 //
8 
9 namespace CLHEP {
10 
11 // swap
12 //
13 inline void HepGenMatrix::swap(int &i,int &j) {int t=i;i=j;j=t;}
14 #ifdef DISABLE_ALLOC
15 inline void HepGenMatrix::swap(std::vector<double >& i, std::vector<double >& j) {
16  std::vector<double > t=i;i=j;j=t;
17 }
18 #else
19 inline void HepGenMatrix::swap(std::vector<double,Alloc<double,25> >& i, std::vector<double,Alloc<double,25> >& j) {
20  std::vector<double,Alloc<double,25> > t=i;i=j;j=t;
21 }
22 #endif
23 
24 //
25 // operator [] (I cannot make it virtual because return types are different.)
26 // Therefore I will have to use the virtual operator (,).
27 //
28 inline double &HepGenMatrix::HepGenMatrix_row::operator[](int c) {
29  return _a(_r+1,c+1);
30 }
31 
32 inline const double &HepGenMatrix::HepGenMatrix_row_const::
33 operator[](int c) const {
34  return _a(_r+1,c+1);
35 }
36 
37 inline HepGenMatrix::HepGenMatrix_row HepGenMatrix::operator[](int r) {
38  HepGenMatrix_row b(*this,r);
39  return b;
40 }
41 
42 inline const HepGenMatrix::HepGenMatrix_row_const HepGenMatrix::
43 operator[](int r) const{
44  HepGenMatrix_row_const b(*this,r);
45  return b;
46 }
47 
48 inline HepGenMatrix::HepGenMatrix_row::HepGenMatrix_row(HepGenMatrix&a,int r)
49 : _a(a) {
50  _r = r;
51 }
52 
53 inline HepGenMatrix::HepGenMatrix_row_const::
54 HepGenMatrix_row_const (const HepGenMatrix&a, int r)
55  : _a(a) {
56  _r = r;
57 }
58 
59 
60 } // namespace CLHEP
61 
62 
63 // -----------------------------------------------------------------
64 
65 
void swap(HepMatrix &hm1, HepMatrix &hm2)
Definition: Matrix.icc:69