FEDRA emulsion software from the OPERA Collaboration
VtNegMatrix.hh
Go to the documentation of this file.
1 #ifndef __VTNEGMATRIX_HH
2 #define __VTNEGMATRIX_HH
3 // *****************************************************************************
4 //
5 // source:
6 //
7 // type: source code
8 //
9 // created: 21. Aug 2000
10 //
11 // author: Thorsten Glebe
12 // HERA-B Collaboration
13 // Max-Planck-Institut fuer Kernphysik
14 // Saupfercheckweg 1
15 // 69117 Heidelberg
16 // Germany
17 // E-mail: T.Glebe@mpi-hd.mpg.de
18 //
19 // Description: A class for negative matrices (to be used internally only)
20 //
21 // changes:
22 // 21 Aug 2000 (TG) creation
23 //
24 // *****************************************************************************
25 
26 #include <iosfwd>
27 #include <assert.h>
28 #include "VtMatrix.hh"
29 
30 #ifdef WIN32
31 # include "Rtypes.h"
32 #endif
33 
34 namespace MATRIX {
35  class VtVector;
36 
41  //============================================================================
42  // Class VtNegMatrix: simple negative Matrix class
43  //============================================================================
44  class VtNegMatrix : public VtMatrix {
45  public:
48  VtNegMatrix(const unsigned int row, const unsigned int col);
50  VtNegMatrix(const VtNegMatrix& rhs);
52  VtNegMatrix(const VtMatrix& rhs);
55 
56  double operator()(unsigned int row, unsigned int col) const;
57  double& operator()(const unsigned int row, const unsigned int col);
58 
59  inline double nget(unsigned int row, unsigned int col) const {
60  return -*(m + row*m_ncol + col);
61  }
62  inline double& nget(unsigned int row, unsigned int col) {
63  return *(m + row*m_ncol + col);
64  }
65 
68  const VtNegMatrix T(void) const;
69 
71  const VtNegMatrix& operator+=(const double rhs);
73  const VtNegMatrix& operator-=(const double rhs);
75  const VtNegMatrix& operator*=(const double rhs);
77  const VtNegMatrix& operator/=(const double rhs);
79  const VtNegMatrix& operator+=(const VtMatrix& rhs);
81  const VtNegMatrix& operator+=(const VtNegMatrix& rhs);
83  const VtNegMatrix& operator-=(const VtMatrix& rhs);
85  const VtNegMatrix& operator-=(const VtNegMatrix& rhs);
86 
88  const VtMatrix operator+ (const VtMatrix& rhs) const;
90  const VtMatrix operator+ (const VtNegMatrix& rhs) const;
92  const VtMatrix operator- (const VtMatrix& rhs) const;
93  //not needed: const VtMatrix operator- (const VtNegMatrix& rhs) const;
95  const VtMatrix operator- (void) const;
96 
98  const VtMatrix operator* (const VtMatrix& rhs) const;
100  const VtVector operator* (const VtVector& rhs) const;
101  // not needed: const VtMatrix operator*(const VtNegMatrix& rhs) const;
102 
103 #ifdef WIN32
104  ClassDef(VtNegMatrix,0)
105 #endif
106  }; // class VtNegMatrix
107 
108 
109  //==============================================================================
110  // operator <<
111  //==============================================================================
112  inline std::ostream& operator<< ( std::ostream& os, const VtNegMatrix& t ) {
113  t.print(os);
114  return os;
115  }
116 
117 
118 } // namespace MATRIX
119 #endif
TTree * t
Definition: check_shower.C:4
Definition: VtMatrix.hh:49
double * m
Definition: VtMatrix.hh:171
unsigned int m_ncol
Definition: VtMatrix.hh:174
Definition: VtNegMatrix.hh:44
const VtMatrix operator-(void) const
Definition: VtNegMatrix.C:170
double nget(unsigned int row, unsigned int col) const
Definition: VtNegMatrix.hh:59
const VtNegMatrix & operator-=(const double rhs)
$\textbf{A} = (a_{\mu\nu} - \alpha)$
Definition: VtNegMatrix.C:83
const VtNegMatrix & operator/=(const double rhs)
$\textbf{A} = (a_{\mu\nu} / \alpha)$
Definition: VtNegMatrix.C:117
~VtNegMatrix()
Definition: VtNegMatrix.hh:54
const VtNegMatrix T(void) const
return transposed matrix
Definition: VtNegMatrix.C:231
double & nget(unsigned int row, unsigned int col)
Definition: VtNegMatrix.hh:62
const VtNegMatrix & operator*=(const double rhs)
$\textbf{A} = (a_{\mu\nu} \cdot\alpha)$
Definition: VtNegMatrix.C:109
const VtNegMatrix & operator+=(const double rhs)
$\textbf{A} = (a_{\mu\nu} + \alpha)$
Definition: VtNegMatrix.C:57
VtNegMatrix(const unsigned int row, const unsigned int col)
Definition: VtNegMatrix.C:35
double operator()(unsigned int row, unsigned int col) const
Definition: VtNegMatrix.C:44
const VtMatrix operator+(const VtMatrix &rhs) const
Definition: VtNegMatrix.C:125
const VtMatrix operator*(const VtMatrix &rhs) const
Definition: VtNegMatrix.C:182
Definition: VtVector.hh:45
Definition: CMatrix.C:43
std::ostream & operator<<(std::ostream &os, const VtMatrix &t)
Definition: VtMatrix.hh:189