CMS 3D CMS Logo

Macros | Functions
invertPosDefMatrix.h File Reference
#include "Math/SMatrix.h"
#include "Math/CholeskyDecomp.h"
#include <type_traits>

Go to the source code of this file.

Macros

#define SMATRIX_USE_CONSTEXPR
 

Functions

template<typename PDM2 >
void fastInvertPDM2 (PDM2 &mm)
 
template<typename T , unsigned int N>
bool invertPosDefMatrix (ROOT::Math::SMatrix< T, N, N, ROOT::Math::MatRepSym< T, N > > &m)
 
template<typename T , unsigned int N>
bool invertPosDefMatrix (ROOT::Math::SMatrix< T, N, N, ROOT::Math::MatRepSym< T, N > > const &mIn, ROOT::Math::SMatrix< T, N, N, ROOT::Math::MatRepSym< T, N > > &mOut)
 
template<>
bool invertPosDefMatrix< double, 1 > (ROOT::Math::SMatrix< double, 1, 1, ROOT::Math::MatRepSym< double, 1 > > &m)
 
template<>
bool invertPosDefMatrix< double, 2 > (ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepSym< double, 2 > > &m)
 
template<>
bool invertPosDefMatrix< float, 1 > (ROOT::Math::SMatrix< float, 1, 1, ROOT::Math::MatRepSym< float, 1 > > &m)
 
template<>
bool invertPosDefMatrix< float, 2 > (ROOT::Math::SMatrix< float, 2, 2, ROOT::Math::MatRepSym< float, 2 > > &m)
 

Macro Definition Documentation

#define SMATRIX_USE_CONSTEXPR

Definition at line 4 of file invertPosDefMatrix.h.

Function Documentation

template<typename PDM2 >
void fastInvertPDM2 ( PDM2 &  mm)

Definition at line 22 of file invertPosDefMatrix.h.

References fftjetpileupestimator_calo_uncalib_cfi::c0, alignmentValidation::c1, constexpr, and funct::m.

Referenced by invertPosDefMatrix< double, 2 >(), and invertPosDefMatrix< float, 2 >().

22  {
23  auto m = mm.Array();
24 
26  auto c0 = one/m[0];
27  auto c1 = m[1]*m[1]* c0;
28  auto c2 = one/(m[2] - c1);
29 
30  auto li21 = c1 * c0 * c2;
31  m[0] = li21 + c0;
32  m[1] = - m[1]*c0*c2;
33  m[2] = c2;
34 }
type
Definition: HCALResponse.h:21
#define constexpr
template<typename T , unsigned int N>
bool invertPosDefMatrix ( ROOT::Math::SMatrix< T, N, N, ROOT::Math::MatRepSym< T, N > > &  m)
inline
template<typename T , unsigned int N>
bool invertPosDefMatrix ( ROOT::Math::SMatrix< T, N, N, ROOT::Math::MatRepSym< T, N > > const &  mIn,
ROOT::Math::SMatrix< T, N, N, ROOT::Math::MatRepSym< T, N > > &  mOut 
)
inline

Definition at line 62 of file invertPosDefMatrix.h.

63  {
64 
65  ROOT::Math::CholeskyDecomp<T,N> decomp(mIn);
66  if (!decomp) {
67  mOut=mIn;
68  return mOut.Invert();
69  } else
70  decomp.Invert(mOut);
71  return true;
72 
73 }
template<>
bool invertPosDefMatrix< double, 1 > ( ROOT::Math::SMatrix< double, 1, 1, ROOT::Math::MatRepSym< double, 1 > > &  m)
inline

Definition at line 37 of file invertPosDefMatrix.h.

References funct::m.

37  {
38  m(0,0) = 1./m(0,0);
39  return true;
40 }
template<>
bool invertPosDefMatrix< double, 2 > ( ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepSym< double, 2 > > &  m)
inline

Definition at line 49 of file invertPosDefMatrix.h.

References fastInvertPDM2(), and funct::m.

49  {
50  fastInvertPDM2(m);
51  return true;
52 }
void fastInvertPDM2(PDM2 &mm)
template<>
bool invertPosDefMatrix< float, 1 > ( ROOT::Math::SMatrix< float, 1, 1, ROOT::Math::MatRepSym< float, 1 > > &  m)
inline

Definition at line 42 of file invertPosDefMatrix.h.

References funct::m.

42  {
43  m(0,0) = 1.f/m(0,0);
44  return true;
45 }
template<>
bool invertPosDefMatrix< float, 2 > ( ROOT::Math::SMatrix< float, 2, 2, ROOT::Math::MatRepSym< float, 2 > > &  m)
inline

Definition at line 54 of file invertPosDefMatrix.h.

References fastInvertPDM2(), and funct::m.

54  {
55  fastInvertPDM2(m);
56  return true;
57 }
void fastInvertPDM2(PDM2 &mm)