1 #ifndef DataFormat_Math_invertPosDefMatrix_H
2 #define DataFormat_Math_invertPosDefMatrix_H
4 #include "Math/SMatrix.h"
5 #include "Math/CholeskyDecomp.h"
9 template<
typename T,
unsigned int N>
21 template<
typename T,
unsigned int N>
23 ROOT::Math::SMatrix<
T,
N,
N,ROOT::Math::MatRepSym<T,N> > & mOut) {
46 double m00()
const {
return mm[0][0];}
47 double m01()
const {
return mm[0][1];}
48 double m11()
const {
return mm[1][0];}
49 double m10()
const {
return mm[1][1];}
51 double & m00() {
return mm[0][0];}
52 double & m01() {
return mm[0][1];}
53 double & m11() {
return mm[1][0];}
54 double & m10() {
return mm[1][1];}
58 inline M2(
double i00,
double i01,
double i10,
double i11) {
59 m00()=i00; m01()=i01; m11()=i11; m10()=i10; }
61 Vec & r0() {
return mm[0]; }
62 Vec &
r1() {
return mm[1]; }
64 Vec
const & r0()
const {
return mm[0]; }
65 Vec
const &
r1()
const {
return mm[1]; }
69 inline bool invert() {
73 Vec det2{det[1],det[0]};
87 inline bool invertPosDefMatrix<double,2>(ROOT::Math::SMatrix<double,2,2,ROOT::Math::MatRepSym<double,2> > &
m) {
88 mathSSE::M2 mm(
m.Array()[0],
m.Array()[1],
m.Array()[1],
m.Array()[2]);
90 bool ok = mm.invert();
92 m.Array()[0] = mm.m00();
93 m.Array()[1] = mm.m01();
94 m.Array()[2] = mm.m11();
100 inline bool invertPosDefMatrix<double,2>(ROOT::Math::SMatrix<double,2,2,ROOT::Math::MatRepSym<double,2> >
const & mIn,
101 ROOT::Math::SMatrix<double,2,2,ROOT::Math::MatRepSym<double,2> > & mOut) {
103 mathSSE::M2 mm(mIn.Array()[0], mIn.Array()[1], mIn.Array()[1], mIn.Array()[2]);
105 bool ok = mm.invert();
106 mOut.Array()[0] = mm.m00();
107 mOut.Array()[1] = mm.m01();
108 mOut.Array()[2] = mm.m11();
bool Invert(M &m) const
place the inverse into m
class to compute the Cholesky decomposition of a matrix
bool invertPosDefMatrix(ROOT::Math::SMatrix< T, N, N, ROOT::Math::MatRepSym< T, N > > &m)
std::vector< std::vector< double > > tmp