/usr/include/CLHEP/Matrix/DiagMatrix.icc is in libclhep-dev 2.1.4.1-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | // -*- C++ -*-
// ---------------------------------------------------------------------------
//
// This file is a part of the CLHEP - a Class Library for High Energy Physics.
//
// This software written by Nobu Katayama and Mike Smyth, Cornell University.
//
#include <stdexcept>
namespace CLHEP {
inline HepDiagMatrix::HepDiagMatrix()
: m(0), nrow(0)
{}
inline int HepDiagMatrix::num_row() const { return nrow;}
inline int HepDiagMatrix::num_col() const { return nrow;}
inline int HepDiagMatrix::num_size() const { return nrow;}
inline double & HepDiagMatrix::fast(int row,int col)
{
#ifdef MATRIX_BOUND_CHECK
if (row<1 || row>nrow || col<1 || col>nrow)
error("Range error in HepDiagMatrix::fast()");
#endif
if (row != col)
error("Index error in HepDiagMatrix::fast(i,j): i != j");
return *(m.begin()+(col-1));
}
inline const double & HepDiagMatrix::fast(int row,int col) const
{
#ifdef MATRIX_BOUND_CHECK
if (row<1 || row>nrow || col<1 || col>nrow)
error("Range error in HepDiagMatrix::fast()");
#endif
if (row == col) {
return *(m.begin()+(col-1));
} else {
#if defined(__sun) || !defined(__GNUG__)
//
// Sun CC 4.0.1 has this bug.
//
zero = 0;
#endif
return zero;
}
}
inline double & HepDiagMatrix::operator()(int row, int col)
{
return fast(col,row);
}
inline const double & HepDiagMatrix::operator()(int row, int col) const
{
return fast(col,row);
}
inline void HepDiagMatrix::assign(const HepDiagMatrix &hm2) {(*this)=hm2;}
inline HepDiagMatrix HepDiagMatrix::T() const {return HepDiagMatrix(*this);}
inline HepDiagMatrix::HepDiagMatrix_row HepDiagMatrix::operator[] (int r)
#ifdef HEP_GNU_OPTIMIZED_RETURN
return b(*this,r);
{
#else
{
HepDiagMatrix_row b(*this,r);
#endif
return b;
}
inline HepDiagMatrix::HepDiagMatrix_row_const HepDiagMatrix::operator[] (int r) const
#ifdef HEP_GNU_OPTIMIZED_RETURN
return b(*this,r);
{
#else
{
const HepDiagMatrix_row_const b(*this,r);
#endif
return b;
}
inline double &HepDiagMatrix::HepDiagMatrix_row::operator[](int c)
{
return _a.fast(_r+1, c+1);
}
inline const double&
HepDiagMatrix::HepDiagMatrix_row_const::operator[](int c) const
{
return _a.fast(_r+1,c+1);
}
inline HepDiagMatrix::HepDiagMatrix_row::HepDiagMatrix_row
(HepDiagMatrix& a, int r)
: _a(a), _r(r)
{}
inline HepDiagMatrix::HepDiagMatrix_row_const::HepDiagMatrix_row_const
(const HepDiagMatrix& a, int r)
: _a(a), _r(r)
{}
inline HepDiagMatrix HepDiagMatrix::inverse(int &ierr) const
#ifdef HEP_GNU_OPTIMIZED_RETURN
return mTmp(*this);
{
#else
{
HepDiagMatrix mTmp(*this);
#endif
mTmp.invert(ierr);
return mTmp;
}
inline HepDiagMatrix HepDiagMatrix::inverse() const {
int ierr;
HepDiagMatrix mt=inverse(ierr);
if (ierr) throw std::runtime_error("Error in HepDiagMatrix inversion");
return mt;
}
inline void HepDiagMatrix::invert() {
int ierr;
invert(ierr);
if (ierr) throw std::runtime_error("Error in HepDiagMatrix inversion");
}
} // namespace CLHEP
|