1 #ifndef DataFormat_Math_choleskyInversion_h
2 #define DataFormat_Math_choleskyInversion_h
11 template <
typename M1,
typename M2,
int N = M2::ColsAtCompileTime>
24 for (
int i = 0;
i <
N; ++
i) {
26 for (
int j =
i + 1;
j <
N; ++
j)
30 for (
int j = 0;
j <
N; ++
j) {
31 a[
j][
j] =
T(1.) / a[
j][
j];
33 for (
int l = jp1;
l <
N; ++
l) {
34 a[
j][
l] = a[
j][
j] * a[
l][
j];
36 for (
int i = 0;
i < jp1; ++
i)
37 s1 += a[
l][
i] * a[
i][jp1];
42 if constexpr (N == 1) {
47 a[1][0] = a[0][1] * a[1][1];
48 for (
int j = 2;
j <
N; ++
j) {
50 for (
int k = 0;
k < jm1; ++
k) {
52 for (
int i =
k;
i < jm1; ++
i)
53 s31 += a[
k][
i + 1] * a[
i + 1][
j];
55 a[
j][
k] = -s31 * a[
j][
j];
57 a[jm1][
j] = -a[jm1][
j];
58 a[
j][jm1] = a[jm1][
j] * a[
j][
j];
64 for (
int i = j + 1;
i <
N; ++
i)
65 s33 += a[j][
i] * a[
i][j];
69 for (
int k = 0;
k <
j; ++
k) {
71 for (
int i = j;
i <
N; ++
i)
72 s32 += a[
k][
i] * a[
i][j];
91 template <
typename M1,
typename M2>
93 using F = decltype(
src(0, 0));
97 template <
typename M1,
typename M2>
99 using F = decltype(
src(0, 0));
111 template <
typename M1,
typename M2>
112 inline constexpr
void __attribute__((always_inline)) invert33(M1
const& src, M2& dst) {
113 using F = decltype(
src(0, 0));
135 template <
typename M1,
typename M2>
136 inline constexpr
void __attribute__((always_inline)) invert44(M1
const& src, M2& dst) {
137 using F = decltype(
src(0, 0));
171 template <
typename M1,
typename M2>
172 inline constexpr
void __attribute__((always_inline)) invert55(M1
const& src, M2& dst) {
173 using F = decltype(
src(0, 0));
226 template <
typename M1,
typename M2>
227 inline constexpr
void __attribute__((always_inline)) invert66(M1
const& src, M2& dst) {
228 using F = decltype(
src(0, 0));
315 template <
typename M>
318 template <
typename M>
323 template <
typename M>
330 template <
typename M>
338 template <
typename M>
347 template <
typename M>
357 template <
typename M1,
typename M2,
int N>
359 static constexpr
void eval(M1
const& src, M2& dst) { dst = src.inverse(); }
362 template <
typename M1,
typename M2>
364 static constexpr
void eval(M1
const& src, M2& dst) { invert11(src, dst); }
367 template <
typename M1,
typename M2>
375 template <
typename M1,
typename M2>
383 template <
typename M1,
typename M2>
391 template <
typename M1,
typename M2>
399 template <
typename M1,
typename M2>
408 template <
typename M1,
typename M2>
410 if constexpr (M2::ColsAtCompileTime < 7)
411 Inverter<M1, M2, M2::ColsAtCompileTime>::eval(src, dst);
419 #endif // DataFormat_Math_choleskyInversion_h
constexpr void symmetrize11(M &dst)
constexpr void symmetrize55(M &dst)
constexpr void symmetrize44(M &dst)
static constexpr void eval(M1 const &src, M2 &dst)
static constexpr void eval(M1 const &src, M2 &dst)
constexpr void symmetrize33(M &dst)
constexpr void invertNN(M1 const &src, M2 &dst)
constexpr void __attribute__((always_inline)) invert11(M1 const &src
constexpr void symmetrize22(M &dst)
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
constexpr void symmetrize66(M &dst)