1 #ifndef DataFormat_Math_invertPosDefMatrix_H
2 #define DataFormat_Math_invertPosDefMatrix_H
4 #include "Math/SMatrix.h"
7 template<
typename T,
unsigned int N>
19 template<
typename T,
unsigned int N>
21 ROOT::Math::SMatrix<
T,
N,
N,ROOT::Math::MatRepSym<T,N> > & mOut) {
35 #include <pmmintrin.h>
40 struct M {
double m00,m01,m11,m10;};
49 inline M2(
double i00,
double i01,
double i10,
double i11) {
50 mm.m00=i00; mm.m01=i01; mm.m11=i11; mm.m10=i10; }
52 double & operator[](
int i) {
return m[
i];}
53 __m128d & r0() {
return r[0]; }
54 __m128d & r1() {
return r[1]; }
56 double operator[](
int i)
const {
return m[
i];}
57 __m128d
const & r0()
const {
return r[0]; }
58 __m128d
const & r1()
const {
return r[1]; }
62 inline bool invert() {
65 __m128d det = _mm_mul_pd(r0(),tmp);
66 __m128d det2 = _mm_shuffle_pd(det,det,1);
68 det = _mm_sub_pd(det,det2);
70 r1() = _mm_div_pd(r0(),det);
72 r0() = _mm_div_pd(tmp,det);
73 double d; _mm_store_sd(&d,det);
81 inline bool invertPosDefMatrix<double,2>(ROOT::Math::SMatrix<double,2,2,ROOT::Math::MatRepSym<double,2> > &
m) {
82 mathSSE::M2 mm(
m.Array()[0],
m.Array()[1],
m.Array()[1],
m.Array()[2]);
84 bool ok = mm.invert();
94 inline bool invertPosDefMatrix<double,2>(ROOT::Math::SMatrix<double,2,2,ROOT::Math::MatRepSym<double,2> >
const & mIn,
95 ROOT::Math::SMatrix<double,2,2,ROOT::Math::MatRepSym<double,2> > & mOut) {
97 mathSSE::M2 mm(mIn.Array()[0], mIn.Array()[1], mIn.Array()[1], mIn.Array()[2]);
99 bool ok = mm.invert();
100 mOut.Array()[0] = mm[0];
101 mOut.Array()[1] = mm[1];
102 mOut.Array()[2] = mm[2];
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)
struct mathSSE::Rot3 __attribute__
std::vector< std::vector< double > > tmp