Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 // ------------------------------------------- 27 // ------------------------------------------------------------ 28 // GEANT 4 class inline implementation 28 // GEANT 4 class inline implementation 29 // ------------------------------------------- 29 // ------------------------------------------------------------ 30 30 31 inline G4ErrorSymMatrix::G4ErrorSymMatrix() << 32 : m(0) << 33 , nrow(0) << 34 , size(0) << 35 {} << 36 31 37 inline G4int G4ErrorSymMatrix::num_row() const << 32 inline G4ErrorSymMatrix::G4ErrorSymMatrix() >> 33 : m(0), nrow(0), size(0) >> 34 { >> 35 } >> 36 >> 37 inline G4int G4ErrorSymMatrix::num_row() const >> 38 { >> 39 return nrow; >> 40 } 38 41 39 inline G4int G4ErrorSymMatrix::num_col() const << 42 inline G4int G4ErrorSymMatrix::num_col() const >> 43 { >> 44 return nrow; >> 45 } 40 46 41 inline G4int G4ErrorSymMatrix::num_size() cons << 47 inline G4int G4ErrorSymMatrix::num_size() const >> 48 { >> 49 return size; >> 50 } 42 51 43 inline G4double& G4ErrorSymMatrix::fast(G4int << 52 inline G4double & G4ErrorSymMatrix::fast(G4int row,G4int col) 44 { 53 { 45 return *(m.begin() + (row * (row - 1)) / 2 + << 54 return *(m.begin()+(row*(row-1))/2+(col-1)); 46 } 55 } 47 56 48 inline const G4double& G4ErrorSymMatrix::fast( << 57 inline const G4double & G4ErrorSymMatrix::fast(G4int row,G4int col) const 49 { 58 { 50 return *(m.begin() + (row * (row - 1)) / 2 + << 59 return *(m.begin()+(row*(row-1))/2+(col-1)); 51 } 60 } 52 61 53 inline G4double& G4ErrorSymMatrix::operator()( << 62 inline G4double & >> 63 G4ErrorSymMatrix::operator()(G4int row, G4int col) 54 { 64 { 55 return (row >= col ? fast(row, col) : fast(c << 65 return (row>=col? fast(row,col) : fast(col,row)); 56 } 66 } 57 67 58 inline const G4double& G4ErrorSymMatrix::opera << 68 inline const G4double & >> 69 G4ErrorSymMatrix::operator()(G4int row, G4int col) const 59 { 70 { 60 return (row >= col ? fast(row, col) : fast(c << 71 return (row>=col? fast(row,col) : fast(col,row)); 61 } 72 } 62 73 63 inline void G4ErrorSymMatrix::assign(const G4E << 74 inline void G4ErrorSymMatrix::assign(const G4ErrorSymMatrix &mat) 64 { 75 { 65 (*this) = mat; << 76 (*this)=mat; 66 } 77 } 67 78 68 inline G4ErrorSymMatrix G4ErrorSymMatrix::T() 79 inline G4ErrorSymMatrix G4ErrorSymMatrix::T() const 69 { 80 { 70 return G4ErrorSymMatrix(*this); 81 return G4ErrorSymMatrix(*this); 71 } 82 } 72 83 73 inline G4ErrorSymMatrix::G4ErrorSymMatrix_row << 84 inline G4ErrorSymMatrix::G4ErrorSymMatrix_row 74 G4int r) << 85 G4ErrorSymMatrix::operator[] (G4int r) 75 { 86 { 76 G4ErrorSymMatrix_row b(*this, r); << 87 G4ErrorSymMatrix_row b(*this,r); 77 return b; 88 return b; 78 } 89 } 79 90 80 inline G4ErrorSymMatrix::G4ErrorSymMatrix_row_ << 91 inline G4ErrorSymMatrix::G4ErrorSymMatrix_row_const 81 operator[](G4int r) const << 92 G4ErrorSymMatrix::operator[] (G4int r) const 82 { 93 { 83 const G4ErrorSymMatrix_row_const b(*this, r) << 94 const G4ErrorSymMatrix_row_const b(*this,r); 84 return b; 95 return b; 85 } 96 } 86 97 87 inline G4double& G4ErrorSymMatrix::G4ErrorSymM << 98 inline G4double &G4ErrorSymMatrix::G4ErrorSymMatrix_row::operator[](G4int c) 88 { 99 { 89 if(_r >= c) << 100 if (_r >= c ) 90 { << 101 { 91 return *(_a.m.begin() + (_r + 1) * _r / 2 << 102 return *(_a.m.begin() + (_r+1)*_r/2 + c); 92 } << 103 } 93 else << 104 else 94 { << 105 { 95 return *(_a.m.begin() + (c + 1) * c / 2 + << 106 return *(_a.m.begin() + (c+1)*c/2 + _r); 96 } << 107 } 97 } << 108 } 98 << 109 99 inline const G4double& G4ErrorSymMatrix::G4Err << 110 inline const G4double & 100 G4int c) const << 111 G4ErrorSymMatrix::G4ErrorSymMatrix_row_const::operator[](G4int c) const 101 { << 112 { 102 if(_r >= c) << 113 if (_r >= c ) 103 { << 114 { 104 return *(_a.m.begin() + (_r + 1) * _r / 2 << 115 return *(_a.m.begin() + (_r+1)*_r/2 + c); 105 } << 116 } 106 else << 117 else 107 { << 118 { 108 return *(_a.m.begin() + (c + 1) * c / 2 + << 119 return *(_a.m.begin() + (c+1)*c/2 + _r); 109 } << 120 } 110 } << 121 } 111 << 122 112 inline G4ErrorSymMatrix::G4ErrorSymMatrix_row: << 123 inline G4ErrorSymMatrix:: 113 G4ErrorSymMatrix& a, G4int r) << 124 G4ErrorSymMatrix_row::G4ErrorSymMatrix_row(G4ErrorSymMatrix &a, G4int r) 114 : _a(a) << 125 : _a(a), _r(r) 115 , _r(r) << 116 {} 126 {} 117 127 118 inline G4ErrorSymMatrix::G4ErrorSymMatrix_row_ << 128 inline G4ErrorSymMatrix:: 119 const G4ErrorSymMatrix& a, G4int r) << 129 G4ErrorSymMatrix_row_const::G4ErrorSymMatrix_row_const 120 : _a(a) << 130 (const G4ErrorSymMatrix&a,G4int r) 121 , _r(r) << 131 : _a(a), _r(r) 122 {} 132 {} 123 133 124 inline G4ErrorSymMatrix G4ErrorSymMatrix::inve << 134 inline G4ErrorSymMatrix G4ErrorSymMatrix::inverse(G4int &ifail) const 125 { 135 { 126 G4ErrorSymMatrix mTmp(*this); 136 G4ErrorSymMatrix mTmp(*this); 127 mTmp.invert(ifail); 137 mTmp.invert(ifail); 128 return mTmp; 138 return mTmp; 129 } 139 } 130 140