CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 20 of file invertPosDefMatrix.h.

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

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

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 }
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 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 }
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.

References visualization-live-secondInstance_cfg::m.

35  {
36  m(0, 0) = 1. / m(0, 0);
37  return true;
38 }
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.

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

46  {
48  return true;
49 }
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 40 of file invertPosDefMatrix.h.

References visualization-live-secondInstance_cfg::m.

40  {
41  m(0, 0) = 1.f / m(0, 0);
42  return true;
43 }
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.

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

51  {
53  return true;
54 }
void fastInvertPDM2(PDM2 &mm)