CMS 3D CMS Logo

Functions
PulseChiSqSNNLS.cc File Reference
#include "RecoLocalCalo/EcalRecAlgos/interface/PulseChiSqSNNLS.h"
#include <cmath>
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include <iostream>

Go to the source code of this file.

Functions

void eigen_solve_submatrix (PulseMatrix &mat, PulseVector &invec, PulseVector &outvec, unsigned NP)
 

Function Documentation

◆ eigen_solve_submatrix()

void eigen_solve_submatrix ( PulseMatrix mat,
PulseVector invec,
PulseVector outvec,
unsigned  NP 
)

Definition at line 6 of file PulseChiSqSNNLS.cc.

References Exception, and groupFilesInBlocks::temp.

Referenced by PulseChiSqSNNLS::NNLS().

6  {
7  using namespace Eigen;
8  switch (NP) { // pulse matrix is always square.
9  case 10: {
10  Matrix<double, 10, 10> temp = mat.topLeftCorner<10, 10>();
11  outvec.head<10>() = temp.ldlt().solve(invec.head<10>());
12  } break;
13  case 9: {
14  Matrix<double, 9, 9> temp = mat.topLeftCorner<9, 9>();
15  outvec.head<9>() = temp.ldlt().solve(invec.head<9>());
16  } break;
17  case 8: {
18  Matrix<double, 8, 8> temp = mat.topLeftCorner<8, 8>();
19  outvec.head<8>() = temp.ldlt().solve(invec.head<8>());
20  } break;
21  case 7: {
22  Matrix<double, 7, 7> temp = mat.topLeftCorner<7, 7>();
23  outvec.head<7>() = temp.ldlt().solve(invec.head<7>());
24  } break;
25  case 6: {
26  Matrix<double, 6, 6> temp = mat.topLeftCorner<6, 6>();
27  outvec.head<6>() = temp.ldlt().solve(invec.head<6>());
28  } break;
29  case 5: {
30  Matrix<double, 5, 5> temp = mat.topLeftCorner<5, 5>();
31  outvec.head<5>() = temp.ldlt().solve(invec.head<5>());
32  } break;
33  case 4: {
34  Matrix<double, 4, 4> temp = mat.topLeftCorner<4, 4>();
35  outvec.head<4>() = temp.ldlt().solve(invec.head<4>());
36  } break;
37  case 3: {
38  Matrix<double, 3, 3> temp = mat.topLeftCorner<3, 3>();
39  outvec.head<3>() = temp.ldlt().solve(invec.head<3>());
40  } break;
41  case 2: {
42  Matrix<double, 2, 2> temp = mat.topLeftCorner<2, 2>();
43  outvec.head<2>() = temp.ldlt().solve(invec.head<2>());
44  } break;
45  case 1: {
46  Matrix<double, 1, 1> temp = mat.topLeftCorner<1, 1>();
47  outvec.head<1>() = temp.ldlt().solve(invec.head<1>());
48  } break;
49  default:
50  throw cms::Exception("MultFitWeirdState")
51  << "Weird number of pulses encountered in multifit, module is configured incorrectly!";
52  }
53 }