CMS 3D CMS Logo

Classes | Functions | Variables
math::cholesky Namespace Reference

Classes

struct  Inverter
 
struct  Inverter< M1, M2, 1 >
 
struct  Inverter< M1, M2, 2 >
 
struct  Inverter< M1, M2, 3 >
 
struct  Inverter< M1, M2, 4 >
 
struct  Inverter< M1, M2, 5 >
 
struct  Inverter< M1, M2, 6 >
 

Functions

template<typename M1 , typename M2 >
constexpr void __attribute__ ((always_inline)) invert11(M1 const &src
 
 dst (0, 0)
 
 dst (1, 0)
 
 dst (1, 1)
 
 dst (2, 0)
 
 dst (2, 1)
 
 dst (2, 2)
 
 dst (3, 0)
 
 dst (3, 1)
 
 dst (3, 2)
 
 dst (3, 3)
 
 dst (4, 0)
 
 dst (4, 1)
 
 dst (4, 2)
 
 dst (4, 3)
 
 dst (4, 4)
 
 dst (5, 0)
 
 dst (5, 1)
 
 dst (5, 2)
 
 dst (5, 3)
 
 dst (5, 4)
 
 dst (5, 5)
 
template<typename M1 , typename M2 , int N = M2::ColsAtCompileTime>
constexpr void invertNN (M1 const &src, M2 &dst)
 
else invertNN (src, dst)
 
template<typename M >
constexpr void symmetrize11 (M &dst)
 
template<typename M >
constexpr void symmetrize22 (M &dst)
 
template<typename M >
constexpr void symmetrize33 (M &dst)
 
template<typename M >
constexpr void symmetrize44 (M &dst)
 
template<typename M >
constexpr void symmetrize55 (M &dst)
 
template<typename M >
constexpr void symmetrize66 (M &dst)
 

Variables

constexpr void M2 & dst
 
auto li21 = luc1 * luc0 * luc2
 
auto li31 = (luc1 * (luc2 * luc4) - luc3) * luc0
 
auto li32 = -(luc2 * luc4)
 
auto li41 = (-luc1 * (luc2 * luc4) * (luc8 * luc5) + luc1 * (luc2 * luc7) + luc3 * (luc8 * luc5) - luc6) * luc0
 
auto li42 = (luc4 * luc8 * luc5 - luc7) * luc2
 
auto li43 = -(luc8 * luc5)
 
auto li51
 
auto li52 = (-luc4 * luc8 * luc13 * luc5 * luc9 + luc4 * luc12 * luc5 + luc7 * luc13 * luc9 - luc11) * luc2
 
auto li53 = (luc13 * luc8 * luc9 - luc12) * luc5
 
auto li54 = -luc13 * luc9
 
auto li61
 
auto li62
 
auto li63
 
auto li64 = (luc19 * luc14 * luc13 - luc18) * luc9
 
auto li65 = -luc19 * luc14
 
auto luc0 = F(1.0) / src(0, 0)
 
auto luc1 = src(1, 0) * src(1, 0) * luc0
 
auto luc10 = src(4, 0)
 
auto luc11 = (src(4, 1) - luc0 * luc1 * luc10)
 
auto luc12 = (src(4, 2) - luc0 * luc3 * luc10 - luc2 * luc4 * luc11)
 
auto luc13 = (src(4, 3) - luc0 * luc6 * luc10 - luc2 * luc7 * luc11 - luc5 * luc8 * luc12)
 
auto luc14
 
auto luc15 = src(5, 0)
 
auto luc16 = (src(5, 1) - luc0 * luc1 * luc15)
 
auto luc17 = (src(5, 2) - luc0 * luc3 * luc15 - luc2 * luc4 * luc16)
 
auto luc18 = (src(5, 3) - luc0 * luc6 * luc15 - luc2 * luc7 * luc16 - luc5 * luc8 * luc17)
 
auto luc19
 
auto luc2 = F(1.0) / (src(1, 1) - luc1)
 
auto luc20
 
auto luc3 = src(2, 0)
 
auto luc4 = (src(2, 1) - luc0 * luc1 * luc3)
 
auto luc5 = src(2, 2) - (luc0 * luc3 * luc3 + (luc2 * luc4) * luc4)
 
auto luc6 = src(3, 0)
 
auto luc7 = (src(3, 1) - luc0 * luc1 * luc6)
 
auto luc8 = (src(3, 2) - luc0 * luc3 * luc6 - luc2 * luc4 * luc7)
 
auto luc9 = src(3, 3) - (luc0 * luc6 * luc6 + luc2 * luc7 * luc7 + luc8 * (luc8 * luc5))
 

Function Documentation

◆ __attribute__()

template<typename M1 , typename M2 >
constexpr void math::cholesky::__attribute__ ( (always_inline)  ) const &
inline

fully inlined specialized code to perform the inversion of a positive defined matrix of rank up to 6.

adapted from ROOT::Math::CholeskyDecomp originally by

Author
Manuel Schiller
Date
Aug 29 2008

◆ dst() [1/21]

math::cholesky::dst ( ,
 
)

◆ dst() [2/21]

math::cholesky::dst ( ,
 
)

◆ dst() [3/21]

math::cholesky::dst ( ,
 
)

◆ dst() [4/21]

math::cholesky::dst ( ,
 
)

◆ dst() [5/21]

math::cholesky::dst ( ,
 
)

◆ dst() [6/21]

math::cholesky::dst ( ,
 
)

◆ dst() [7/21]

math::cholesky::dst ( ,
 
)

◆ dst() [8/21]

math::cholesky::dst ( ,
 
)

◆ dst() [9/21]

math::cholesky::dst ( ,
 
)

◆ dst() [10/21]

math::cholesky::dst ( ,
 
)

◆ dst() [11/21]

math::cholesky::dst ( ,
 
)

◆ dst() [12/21]

math::cholesky::dst ( ,
 
)

◆ dst() [13/21]

math::cholesky::dst ( ,
 
)

◆ dst() [14/21]

math::cholesky::dst ( ,
 
)

◆ dst() [15/21]

math::cholesky::dst ( ,
 
)

◆ dst() [16/21]

math::cholesky::dst ( ,
 
)

◆ dst() [17/21]

math::cholesky::dst ( ,
 
)

◆ dst() [18/21]

math::cholesky::dst ( ,
 
)

◆ dst() [19/21]

math::cholesky::dst ( ,
 
)

◆ dst() [20/21]

math::cholesky::dst ( ,
 
)

◆ dst() [21/21]

math::cholesky::dst ( ,
 
)

◆ invertNN() [1/2]

template<typename M1 , typename M2 , int N = M2::ColsAtCompileTime>
constexpr void math::cholesky::invertNN ( M1 const &  src,
M2 &  dst 
)
inline

Definition at line 17 of file choleskyInversion.h.

References a, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), dst, mps_fire::i, dqmiolumiharvest::j, isotrackApplyRegressor::k, MainPageGenerator::l, N, and TrackRefitter_38T_cff::src.

17  {
18 
19  // origin: CERNLIB
20 
21  using T = typename M2::Scalar;
22 
23  T a[N][N];
24  for (int i = 0; i < N; ++i) {
25  a[i][i] = src(i, i);
26  for (int j = i + 1; j < N; ++j)
27  a[j][i] = src(i, j);
28  }
29 
30  for (int j = 0; j < N; ++j) {
31  a[j][j] = T(1.) / a[j][j];
32  int jp1 = j + 1;
33  for (int l = jp1; l < N; ++l) {
34  a[j][l] = a[j][j] * a[l][j];
35  T s1 = -a[l][jp1];
36  for (int i = 0; i < jp1; ++i)
37  s1 += a[l][i] * a[i][jp1];
38  a[l][jp1] = -s1;
39  }
40  }
41 
42  if constexpr (N == 1) {
43  dst(0, 0) = a[0][0];
44  return;
45  }
46  a[0][1] = -a[0][1];
47  a[1][0] = a[0][1] * a[1][1];
48  for (int j = 2; j < N; ++j) {
49  int jm1 = j - 1;
50  for (int k = 0; k < jm1; ++k) {
51  T s31 = a[k][j];
52  for (int i = k; i < jm1; ++i)
53  s31 += a[k][i + 1] * a[i + 1][j];
54  a[k][j] = -s31;
55  a[j][k] = -s31 * a[j][j];
56  }
57  a[jm1][j] = -a[jm1][j];
58  a[j][jm1] = a[jm1][j] * a[j][j];
59  }
60 
61  int j = 0;
62  while (j < N - 1) {
63  T s33 = a[j][j];
64  for (int i = j + 1; i < N; ++i)
65  s33 += a[j][i] * a[i][j];
66  dst(j, j) = s33;
67 
68  ++j;
69  for (int k = 0; k < j; ++k) {
70  T s32 = 0;
71  for (int i = j; i < N; ++i)
72  s32 += a[k][i] * a[i][j];
73  dst(k, j) = dst(j, k) = s32;
74  }
75  }
76  dst(j, j) = a[j][j];
77  }
double Scalar
Definition: Definitions.h:25
#define N
Definition: blowfish.cc:9
double a
Definition: hdecay.h:121
long double T

◆ invertNN() [2/2]

else math::cholesky::invertNN ( src  ,
dst   
)

◆ symmetrize11()

template<typename M >
constexpr void math::cholesky::symmetrize11 ( M &  dst)
inline

Definition at line 316 of file choleskyInversion.h.

316 {}

◆ symmetrize22()

template<typename M >
constexpr void math::cholesky::symmetrize22 ( M &  dst)
inline

Definition at line 319 of file choleskyInversion.h.

References dst.

Referenced by symmetrize33().

319  {
320  dst(0, 1) = dst(1, 0);
321  }

◆ symmetrize33()

template<typename M >
constexpr void math::cholesky::symmetrize33 ( M &  dst)
inline

Definition at line 324 of file choleskyInversion.h.

References dst, and symmetrize22().

Referenced by symmetrize44().

324  {
325  symmetrize22(dst);
326  dst(0, 2) = dst(2, 0);
327  dst(1, 2) = dst(2, 1);
328  }
constexpr void symmetrize22(M &dst)

◆ symmetrize44()

template<typename M >
constexpr void math::cholesky::symmetrize44 ( M &  dst)
inline

Definition at line 331 of file choleskyInversion.h.

References dst, and symmetrize33().

Referenced by symmetrize55().

331  {
332  symmetrize33(dst);
333  dst(0, 3) = dst(3, 0);
334  dst(1, 3) = dst(3, 1);
335  dst(2, 3) = dst(3, 2);
336  }
constexpr void symmetrize33(M &dst)

◆ symmetrize55()

template<typename M >
constexpr void math::cholesky::symmetrize55 ( M &  dst)
inline

Definition at line 339 of file choleskyInversion.h.

References dst, and symmetrize44().

Referenced by symmetrize66().

339  {
340  symmetrize44(dst);
341  dst(0, 4) = dst(4, 0);
342  dst(1, 4) = dst(4, 1);
343  dst(2, 4) = dst(4, 2);
344  dst(3, 4) = dst(4, 3);
345  }
constexpr void symmetrize44(M &dst)

◆ symmetrize66()

template<typename M >
constexpr void math::cholesky::symmetrize66 ( M &  dst)
inline

Definition at line 348 of file choleskyInversion.h.

References dst, and symmetrize55().

348  {
349  symmetrize55(dst);
350  dst(0, 5) = dst(5, 0);
351  dst(1, 5) = dst(5, 1);
352  dst(2, 5) = dst(5, 2);
353  dst(3, 5) = dst(5, 3);
354  dst(4, 5) = dst(5, 4);
355  }
constexpr void symmetrize55(M &dst)

Variable Documentation

◆ dst

constexpr void M2 & math::cholesky::dst

◆ li21

auto math::cholesky::li21 = luc1 * luc0 * luc2

Definition at line 104 of file choleskyInversion.h.

Referenced by fastInvertPDM2().

◆ li31

auto math::cholesky::li31 = (luc1 * (luc2 * luc4) - luc3) * luc0

Definition at line 125 of file choleskyInversion.h.

◆ li32

auto math::cholesky::li32 = -(luc2 * luc4)

Definition at line 124 of file choleskyInversion.h.

◆ li41

auto math::cholesky::li41 = (-luc1 * (luc2 * luc4) * (luc8 * luc5) + luc1 * (luc2 * luc7) + luc3 * (luc8 * luc5) - luc6) * luc0

Definition at line 157 of file choleskyInversion.h.

◆ li42

auto math::cholesky::li42 = (luc4 * luc8 * luc5 - luc7) * luc2

Definition at line 156 of file choleskyInversion.h.

◆ li43

auto math::cholesky::li43 = -(luc8 * luc5)

Definition at line 155 of file choleskyInversion.h.

◆ li51

auto math::cholesky::li51

◆ li52

auto math::cholesky::li52 = (-luc4 * luc8 * luc13 * luc5 * luc9 + luc4 * luc12 * luc5 + luc7 * luc13 * luc9 - luc11) * luc2

Definition at line 203 of file choleskyInversion.h.

◆ li53

auto math::cholesky::li53 = (luc13 * luc8 * luc9 - luc12) * luc5

Definition at line 202 of file choleskyInversion.h.

◆ li54

auto math::cholesky::li54 = -luc13 * luc9

Definition at line 201 of file choleskyInversion.h.

◆ li61

auto math::cholesky::li61
Initial value:
=
(-luc19 * luc13 * luc8 * luc4 * luc1 * luc2 * luc5 * luc9 * luc14 +
luc18 * luc8 * luc4 * luc1 * luc2 * luc5 * luc9 + luc19 * luc12 * luc4 * luc1 * luc2 * luc5 * luc14 +
luc19 * luc13 * luc7 * luc1 * luc2 * luc9 * luc14 + luc19 * luc13 * luc8 * luc3 * luc5 * luc9 * luc14 -
luc17 * luc4 * luc1 * luc2 * luc5 - luc18 * luc7 * luc1 * luc2 * luc9 - luc19 * luc11 * luc1 * luc2 * luc14 -
luc18 * luc8 * luc3 * luc5 * luc9 - luc19 * luc12 * luc3 * luc5 * luc14 -
luc19 * luc13 * luc6 * luc9 * luc14 + luc16 * luc1 * luc2 + luc17 * luc3 * luc5 + luc18 * luc6 * luc9 +

Definition at line 281 of file choleskyInversion.h.

◆ li62

auto math::cholesky::li62

◆ li63

auto math::cholesky::li63

◆ li64

auto math::cholesky::li64 = (luc19 * luc14 * luc13 - luc18) * luc9

Definition at line 274 of file choleskyInversion.h.

◆ li65

auto math::cholesky::li65 = -luc19 * luc14

Definition at line 273 of file choleskyInversion.h.

◆ luc0

auto math::cholesky::luc0 = F(1.0) / src(0, 0)

Definition at line 100 of file choleskyInversion.h.

◆ luc1

auto math::cholesky::luc1 = src(1, 0) * src(1, 0) * luc0

Definition at line 101 of file choleskyInversion.h.

◆ luc10

auto math::cholesky::luc10 = src(4, 0)

Definition at line 187 of file choleskyInversion.h.

◆ luc11

auto math::cholesky::luc11 = (src(4, 1) - luc0 * luc1 * luc10)

Definition at line 188 of file choleskyInversion.h.

◆ luc12

auto math::cholesky::luc12 = (src(4, 2) - luc0 * luc3 * luc10 - luc2 * luc4 * luc11)

Definition at line 189 of file choleskyInversion.h.

◆ luc13

auto math::cholesky::luc13 = (src(4, 3) - luc0 * luc6 * luc10 - luc2 * luc7 * luc11 - luc5 * luc8 * luc12)

Definition at line 190 of file choleskyInversion.h.

◆ luc14

auto math::cholesky::luc14

◆ luc15

auto math::cholesky::luc15 = src(5, 0)

Definition at line 249 of file choleskyInversion.h.

◆ luc16

auto math::cholesky::luc16 = (src(5, 1) - luc0 * luc1 * luc15)

Definition at line 250 of file choleskyInversion.h.

◆ luc17

auto math::cholesky::luc17 = (src(5, 2) - luc0 * luc3 * luc15 - luc2 * luc4 * luc16)

Definition at line 251 of file choleskyInversion.h.

◆ luc18

auto math::cholesky::luc18 = (src(5, 3) - luc0 * luc6 * luc15 - luc2 * luc7 * luc16 - luc5 * luc8 * luc17)

Definition at line 252 of file choleskyInversion.h.

◆ luc19

auto math::cholesky::luc19

◆ luc2

auto math::cholesky::luc2 = F(1.0) / (src(1, 1) - luc1)

Definition at line 102 of file choleskyInversion.h.

◆ luc20

math::cholesky::luc20

◆ luc3

auto math::cholesky::luc3 = src(2, 0)

Definition at line 118 of file choleskyInversion.h.

◆ luc4

auto math::cholesky::luc4 = (src(2, 1) - luc0 * luc1 * luc3)

Definition at line 119 of file choleskyInversion.h.

◆ luc5

auto math::cholesky::luc5 = src(2, 2) - (luc0 * luc3 * luc3 + (luc2 * luc4) * luc4)

Definition at line 120 of file choleskyInversion.h.

◆ luc6

auto math::cholesky::luc6 = src(3, 0)

Definition at line 146 of file choleskyInversion.h.

◆ luc7

auto math::cholesky::luc7 = (src(3, 1) - luc0 * luc1 * luc6)

Definition at line 147 of file choleskyInversion.h.

◆ luc8

auto math::cholesky::luc8 = (src(3, 2) - luc0 * luc3 * luc6 - luc2 * luc4 * luc7)

Definition at line 148 of file choleskyInversion.h.

◆ luc9

auto math::cholesky::luc9 = src(3, 3) - (luc0 * luc6 * luc6 + luc2 * luc7 * luc7 + luc8 * (luc8 * luc5))

Definition at line 149 of file choleskyInversion.h.