1 #ifndef DataFormat_Math_invertPosDefMatrix_H
2 #define DataFormat_Math_invertPosDefMatrix_H
4 #define SMATRIX_USE_CONSTEXPR
5 #include "Math/SMatrix.h"
6 #include "Math/CholeskyDecomp.h"
10 template<
typename T,
unsigned int N>
13 ROOT::Math::CholeskyDecomp<T,N> decomp(
m);
22 template<
typename T,
unsigned int N>
24 ROOT::Math::SMatrix<
T,
N,
N,ROOT::Math::MatRepSym<T,N> > & mOut) {
26 ROOT::Math::CholeskyDecomp<T,N> decomp(mIn);
47 double m00()
const {
return mm[0][0];}
48 double m01()
const {
return mm[0][1];}
49 double m11()
const {
return mm[1][0];}
50 double m10()
const {
return mm[1][1];}
52 double & m00() {
return mm[0][0];}
53 double & m01() {
return mm[0][1];}
54 double & m11() {
return mm[1][0];}
55 double & m10() {
return mm[1][1];}
59 inline M2(
double i00,
double i01,
double i10,
double i11) {
60 m00()=i00; m01()=i01; m11()=i11; m10()=i10; }
62 Vec & r0() {
return mm[0]; }
63 Vec &
r1() {
return mm[1]; }
65 Vec
const & r0()
const {
return mm[0]; }
66 Vec
const &
r1()
const {
return mm[1]; }
74 Vec det2{det[1],det[0]};
88 inline bool invertPosDefMatrix<double,2>(ROOT::Math::SMatrix<double,2,2,ROOT::Math::MatRepSym<double,2> > &
m) {
89 mathSSE::M2 mm(
m.Array()[0],
m.Array()[1],
m.Array()[1],
m.Array()[2]);
91 bool ok = mm.invert();
93 m.Array()[0] = mm.m00();
94 m.Array()[1] = mm.m01();
95 m.Array()[2] = mm.m11();
101 inline bool invertPosDefMatrix<double,2>(ROOT::Math::SMatrix<double,2,2,ROOT::Math::MatRepSym<double,2> >
const & mIn,
102 ROOT::Math::SMatrix<double,2,2,ROOT::Math::MatRepSym<double,2> > & mOut) {
104 mathSSE::M2 mm(mIn.Array()[0], mIn.Array()[1], mIn.Array()[1], mIn.Array()[2]);
106 bool ok = mm.invert();
107 mOut.Array()[0] = mm.m00();
108 mOut.Array()[1] = mm.m01();
109 mOut.Array()[2] = mm.m11();
bool invertPosDefMatrix(ROOT::Math::SMatrix< T, N, N, ROOT::Math::MatRepSym< T, N > > &m)
std::vector< std::vector< double > > tmp