Go to the documentation of this file.00001 #ifndef DataFormat_Math_ProjectMatrix_H
00002 #define DataFormat_Math_ProjectMatrix_H
00003
00004 #include "Math/SMatrix.h"
00005
00006
00007
00008 template<typename T, unsigned int N, unsigned int D>
00009 struct ProjectMatrix{
00010 typedef ROOT::Math::SMatrix<T,D,D,ROOT::Math::MatRepSym<T,D> > SMatDD;
00011 typedef ROOT::Math::SMatrix<T,N,N > SMatNN;
00012 typedef ROOT::Math::SMatrix<T,N,D > SMatND;
00013
00014
00015
00016
00017 SMatND project(SMatDD const & s) {
00018 SMatND r;
00019 for (unsigned int i=0; i<D; i++)
00020 for (unsigned int j=0; j<D; j++)
00021 r(index[i],j) = s(i,j);
00022 return r;
00023 }
00024
00025
00026 SMatNN project(SMatND const & k) {
00027 SMatNN s;
00028 for (unsigned int i=0; i<N; i++)
00029 for (unsigned int j=0; j<D; j++)
00030 s(i,index[j]) = k(i,j);
00031 return s;
00032 }
00033
00034
00035 void projectAndSubtractFrom(SMatNN & __restrict__ s, SMatND const & __restrict__ k) {
00036 for (unsigned int i=0; i<N; i++)
00037 for (unsigned int j=0; j<D; j++)
00038 s(i,index[j]) -= k(i,j);
00039 }
00040
00041
00042 unsigned int index[D];
00043
00044 };
00045
00046
00047 #endif