Hall-D Software  alpha
DMatrix1x5.h
Go to the documentation of this file.
1 class DMatrix1x5{
2  public:
4  for (unsigned int i=0;i<5;i++){
5  mA[i]=0.;
6  }
7  }
8  DMatrix1x5(double c1,double c2,double c3,double c4,double c5){
9  mA[0]=c1;
10  mA[1]=c2;
11  mA[2]=c3;
12  mA[3]=c4;
13  mA[4]=c5;
14  }
16
17
18  double &operator() (int col){
19  return mA[col];
20  }
21  double operator() (int col) const{
22  return mA[col];
23  }
24
25  // Matrix multiplication: (1x5) x (5x1)
26  double operator*(const DMatrix5x1 &m2){
27  return (mA[0]*m2(0)+mA[1]*m2(1)+mA[2]*m2(2)+mA[3]*m2(3)+mA[4]*m2(4));
28  }
29
30  // Matrix multiplication: (1x5) x (5x5)
32  return
33  DMatrix1x5(mA[0]*m2(0,0)+mA[1]*m2(1,0)+mA[2]*m2(2,0)+mA[3]*m2(3,0)+mA[4]*m2(4,0),
34  mA[0]*m2(0,1)+mA[1]*m2(1,1)+mA[2]*m2(2,1)+mA[3]*m2(3,1)+mA[4]*m2(4,1),
35  mA[0]*m2(0,2)+mA[1]*m2(1,2)+mA[2]*m2(2,2)+mA[3]*m2(3,2)+mA[4]*m2(4,2),
36  mA[0]*m2(0,3)+mA[1]*m2(1,3)+mA[2]*m2(2,3)+mA[3]*m2(3,3)+mA[4]*m2(4,3),
37  mA[0]*m2(0,4)+mA[1]*m2(1,4)+mA[2]*m2(2,4)+mA[3]*m2(3,4)+mA[4]*m2(4,4));
38  }
39
40
41
42
43  void Print(){
44  cout << "DMatrix1x5:" <<endl;
45  cout << " | 0 | 1 | 2 | 3 | 4 |" <<endl;
46  cout << "----------------------------------------------------------------------" <<endl;
47  cout << " 0 |" ;
48  for (unsigned int j=0;j<5;j++){
49  cout <<setw(11)<<setprecision(4)<< mA[j]<<" ";
50  }
51  cout << endl;
52  }
53
54
55  private:
56  double mA[5];
57
58 };
59
60
double operator*(const DMatrix5x1 &m2)
Definition: DMatrix1x5.h:26
Double_t c1[2][NMODULES]
Definition: tw_corr.C:68
Double_t c2[2][NMODULES]
Definition: tw_corr.C:69
double & operator()(int col)
Definition: DMatrix1x5.h:18
void Print()
Definition: DMatrix1x5.h:43
DMatrix1x5 operator*(const DMatrix5x5 &m2)
Definition: DMatrix1x5.h:31
TCanvas * c4
double mA[5]
Definition: DMatrix1x5.h:56
TCanvas * c3
DMatrix1x5()
Definition: DMatrix1x5.h:3
DMatrix1x5(double c1, double c2, double c3, double c4, double c5)
Definition: DMatrix1x5.h:8