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

◆ SMATRIX_USE_CONSTEXPR

#define SMATRIX_USE_CONSTEXPR

Definition at line 4 of file invertPosDefMatrix.h.

Function Documentation

◆ fastInvertPDM2()

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

Definition at line 20 of file invertPosDefMatrix.h.

20  {
21  auto m = mm.Array();
22 
23  constexpr typename std::remove_reference<decltype(m[0])>::type one = 1.;
24  auto c0 = one / m[0];
25  auto c1 = m[1] * m[1] * c0;
26  auto c2 = one / (m[2] - c1);
27 
28  auto li21 = c1 * c0 * c2;
29  m[0] = li21 + c0;
30  m[1] = -m[1] * c0 * c2;
31  m[2] = c2;
32 }

References fftjetpileupestimator_calo_uncalib_cfi::c0, alignmentValidation::c1, math::cholesky::li21, visualization-live-secondInstance_cfg::m, and SiPixelPI::one.

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

◆ invertPosDefMatrix() [1/2]

template<typename T , unsigned int N>
bool invertPosDefMatrix ( ROOT::Math::SMatrix< T, N, N, ROOT::Math::MatRepSym< T, N > > &  m)
inline

◆ invertPosDefMatrix() [2/2]

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 57 of file invertPosDefMatrix.h.

58  {
59  ROOT::Math::CholeskyDecomp<T, N> decomp(mIn);
60  if (!decomp) {
61  mOut = mIn;
62  return mOut.Invert();
63  } else
64  decomp.Invert(mOut);
65  return true;
66 }

◆ invertPosDefMatrix< double, 1 >()

template<>
bool invertPosDefMatrix< double, 1 > ( ROOT::Math::SMatrix< double, 1, 1, ROOT::Math::MatRepSym< double, 1 > > &  m)
inline

Definition at line 35 of file invertPosDefMatrix.h.

35  {
36  m(0, 0) = 1. / m(0, 0);
37  return true;
38 }

References visualization-live-secondInstance_cfg::m.

◆ invertPosDefMatrix< double, 2 >()

template<>
bool invertPosDefMatrix< double, 2 > ( ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepSym< double, 2 > > &  m)
inline

Definition at line 46 of file invertPosDefMatrix.h.

46  {
48  return true;
49 }

References fastInvertPDM2(), and visualization-live-secondInstance_cfg::m.

◆ invertPosDefMatrix< float, 1 >()

template<>
bool invertPosDefMatrix< float, 1 > ( ROOT::Math::SMatrix< float, 1, 1, ROOT::Math::MatRepSym< float, 1 > > &  m)
inline

Definition at line 40 of file invertPosDefMatrix.h.

40  {
41  m(0, 0) = 1.f / m(0, 0);
42  return true;
43 }

References visualization-live-secondInstance_cfg::m.

◆ invertPosDefMatrix< float, 2 >()

template<>
bool invertPosDefMatrix< float, 2 > ( ROOT::Math::SMatrix< float, 2, 2, ROOT::Math::MatRepSym< float, 2 > > &  m)
inline

Definition at line 51 of file invertPosDefMatrix.h.

51  {
53  return true;
54 }

References fastInvertPDM2(), and visualization-live-secondInstance_cfg::m.

SiPixelPI::one
Definition: SiPixelPayloadInspectorHelper.h:39
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:78
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
alignmentValidation.c1
c1
do drawing
Definition: alignmentValidation.py:1025
fastInvertPDM2
void fastInvertPDM2(PDM2 &mm)
Definition: invertPosDefMatrix.h:20
math::cholesky::li21
auto li21
Definition: choleskyInversion.h:35
fftjetpileupestimator_calo_uncalib_cfi.c0
c0
Definition: fftjetpileupestimator_calo_uncalib_cfi.py:8