Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:43

0001 #include "DataFormats/Math/interface/ProjectMatrix.h"
0002 #include <functional>
0003 
0004 int main() {
0005   typedef double T;
0006   typedef ROOT::Math::SMatrix<T, 5, 5, ROOT::Math::MatRepSym<T, 5> > SMat55;
0007   typedef ROOT::Math::SMatrix<T, 2, 2, ROOT::Math::MatRepSym<T, 2> > SMatDD;
0008   typedef ROOT::Math::SMatrix<T, 5, 5> SMatNN;
0009   typedef ROOT::Math::SMatrix<T, 5, 2> SMatND;
0010   typedef ROOT::Math::SMatrix<T, 2, 5> SMatDN;
0011 
0012   double v[3] = {1., -0.5, 2.};
0013   SMatDD S(v, 3);
0014 
0015   std::cout << S << std::endl;
0016   std::cout << std::endl;
0017 
0018   {
0019     SMatDN H;
0020     H(0, 3) = 1;
0021     H(1, 4) = 1;
0022     SMatND K = ROOT::Math::Transpose(H) * S;
0023 
0024     SMatNN V = K * H;
0025 
0026     std::cout << H << std::endl;
0027     std::cout << K << std::endl;
0028     std::cout << V << std::endl;
0029     std::cout << std::endl;
0030   }
0031   {
0032     ProjectMatrix<double, 5, 2> H;
0033     H.index[0] = 3;
0034     H.index[1] = 4;
0035     SMatND K = H.project(S);
0036 
0037     SMatNN V = H.project(K);
0038 
0039     std::cout << H.matrix() << std::endl;
0040     std::cout << K << std::endl;
0041     std::cout << V << std::endl;
0042     std::cout << std::endl;
0043   }
0044 
0045   {
0046     SMatDN HH;
0047     HH(0, 3) = 1;
0048     HH(1, 4) = 1;
0049     ProjectMatrix<double, 5, 2> H;
0050     H.fromH(HH);
0051     SMatND K = H.project(S);
0052 
0053     SMatNN V = H.project(K);
0054 
0055     std::cout << H.matrix() << std::endl;
0056     std::cout << K << std::endl;
0057     std::cout << V << std::endl;
0058     std::cout << std::endl;
0059   }
0060 
0061   return 0;
0062 }