CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ProjectMatrix.h
Go to the documentation of this file.
1 #ifndef DataFormat_Math_ProjectMatrix_H
2 #define DataFormat_Math_ProjectMatrix_H
3 
4 #include "Math/SMatrix.h"
5 
6 
7 
8 template<typename T, unsigned int N, unsigned int D>
9 struct ProjectMatrix{
10  typedef ROOT::Math::SMatrix<T,D,D,ROOT::Math::MatRepSym<T,D> > SMatDD;
11  typedef ROOT::Math::SMatrix<T,N,N > SMatNN;
12  typedef ROOT::Math::SMatrix<T,N,D > SMatND;
13 
14  // no constructor
15 
16  // H*S
17  SMatND project(SMatDD const & s) {
18  SMatND r;
19  for (unsigned int i=0; i<D; i++)
20  for (unsigned int j=0; j<D; j++)
21  r(index[i],j) = s(i,j);
22  return r;
23  }
24 
25  // K*H
26  SMatNN project(SMatND const & k) {
27  SMatNN s;
28  for (unsigned int i=0; i<N; i++)
29  for (unsigned int j=0; j<D; j++)
30  s(i,index[j]) = k(i,j);
31  return s;
32  }
33 
34  // S-K*H
35  void projectAndSubtractFrom(SMatNN & __restrict__ s, SMatND const & __restrict__ k) {
36  for (unsigned int i=0; i<N; i++)
37  for (unsigned int j=0; j<D; j++)
38  s(i,index[j]) -= k(i,j);
39  }
40 
41  // only H(i,index(i))=1.
42  unsigned int index[D];
43 
44 };
45 
46 
47 #endif
int i
Definition: DBlmapReader.cc:9
SMatND project(SMatDD const &s)
Definition: ProjectMatrix.h:17
ROOT::Math::SMatrix< T, N, N > SMatNN
Definition: ProjectMatrix.h:11
int j
Definition: DBlmapReader.cc:9
SMatNN project(SMatND const &k)
Definition: ProjectMatrix.h:26
void projectAndSubtractFrom(SMatNN &__restrict__ s, SMatND const &__restrict__ k)
Definition: ProjectMatrix.h:35
int k[5][pyjets_maxn]
#define N
Definition: blowfish.cc:9
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:150
ROOT::Math::SMatrix< T, D, D, ROOT::Math::MatRepSym< T, D > > SMatDD
Definition: ProjectMatrix.h:10
unsigned int index[D]
Definition: ProjectMatrix.h:42
ROOT::Math::SMatrix< T, N, D > SMatND
Definition: ProjectMatrix.h:12