Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/G4ErrorSymMatrix.icc was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 // ------------------------------------------------------------
0028 //      GEANT 4 class inline implementation
0029 // ------------------------------------------------------------
0030 
0031 inline G4ErrorSymMatrix::G4ErrorSymMatrix()
0032   : m(0)
0033   , nrow(0)
0034   , size(0)
0035 {}
0036 
0037 inline G4int G4ErrorSymMatrix::num_row() const { return nrow; }
0038 
0039 inline G4int G4ErrorSymMatrix::num_col() const { return nrow; }
0040 
0041 inline G4int G4ErrorSymMatrix::num_size() const { return size; }
0042 
0043 inline G4double& G4ErrorSymMatrix::fast(G4int row, G4int col)
0044 {
0045   return *(m.begin() + (row * (row - 1)) / 2 + (col - 1));
0046 }
0047 
0048 inline const G4double& G4ErrorSymMatrix::fast(G4int row, G4int col) const
0049 {
0050   return *(m.begin() + (row * (row - 1)) / 2 + (col - 1));
0051 }
0052 
0053 inline G4double& G4ErrorSymMatrix::operator()(G4int row, G4int col)
0054 {
0055   return (row >= col ? fast(row, col) : fast(col, row));
0056 }
0057 
0058 inline const G4double& G4ErrorSymMatrix::operator()(G4int row, G4int col) const
0059 {
0060   return (row >= col ? fast(row, col) : fast(col, row));
0061 }
0062 
0063 inline void G4ErrorSymMatrix::assign(const G4ErrorSymMatrix& mat)
0064 {
0065   (*this) = mat;
0066 }
0067 
0068 inline G4ErrorSymMatrix G4ErrorSymMatrix::T() const
0069 {
0070   return G4ErrorSymMatrix(*this);
0071 }
0072 
0073 inline G4ErrorSymMatrix::G4ErrorSymMatrix_row G4ErrorSymMatrix::operator[](
0074   G4int r)
0075 {
0076   G4ErrorSymMatrix_row b(*this, r);
0077   return b;
0078 }
0079 
0080 inline G4ErrorSymMatrix::G4ErrorSymMatrix_row_const G4ErrorSymMatrix::
0081 operator[](G4int r) const
0082 {
0083   const G4ErrorSymMatrix_row_const b(*this, r);
0084   return b;
0085 }
0086 
0087 inline G4double& G4ErrorSymMatrix::G4ErrorSymMatrix_row::operator[](G4int c)
0088 {
0089   if(_r >= c)
0090   {
0091     return *(_a.m.begin() + (_r + 1) * _r / 2 + c);
0092   }
0093   else
0094   {
0095     return *(_a.m.begin() + (c + 1) * c / 2 + _r);
0096   }
0097 }
0098 
0099 inline const G4double& G4ErrorSymMatrix::G4ErrorSymMatrix_row_const::operator[](
0100   G4int c) const
0101 {
0102   if(_r >= c)
0103   {
0104     return *(_a.m.begin() + (_r + 1) * _r / 2 + c);
0105   }
0106   else
0107   {
0108     return *(_a.m.begin() + (c + 1) * c / 2 + _r);
0109   }
0110 }
0111 
0112 inline G4ErrorSymMatrix::G4ErrorSymMatrix_row::G4ErrorSymMatrix_row(
0113   G4ErrorSymMatrix& a, G4int r)
0114   : _a(a)
0115   , _r(r)
0116 {}
0117 
0118 inline G4ErrorSymMatrix::G4ErrorSymMatrix_row_const::G4ErrorSymMatrix_row_const(
0119   const G4ErrorSymMatrix& a, G4int r)
0120   : _a(a)
0121   , _r(r)
0122 {}
0123 
0124 inline G4ErrorSymMatrix G4ErrorSymMatrix::inverse(G4int& ifail) const
0125 {
0126   G4ErrorSymMatrix mTmp(*this);
0127   mTmp.invert(ifail);
0128   return mTmp;
0129 }