3 #pragma GCC diagnostic ignored "-Wincompatible-pointer-types" 15 for (
size_t x = 0;
x <
P; ++
x)
16 for (
size_t y = 0; y <
P; ++y)
17 for (
size_t z = 0; z <
P; ++z) {
18 r[
x][y][z] = d[0] * w[
x] * w[y] * w[z] * u[
x][y][z];
21 for (
size_t x = 0;
x <
P; ++
x)
22 for (
size_t y = 0; y <
P; ++y)
23 for (
size_t z = 0; z <
P; ++z) {
25 for (
size_t k = 0;
k <
P; ++
k) {
26 accu +=
L[
x][
k] * w[y] * w[z] * u[
k][y][z];
28 r[
x][y][z] += d[1] * accu;
31 for (
size_t x = 0;
x <
P; ++
x)
32 for (
size_t y = 0; y <
P; ++y)
33 for (
size_t z = 0; z <
P; ++z) {
35 for (
size_t k = 0;
k <
P; ++
k) {
36 accu += w[
x] *
L[y][
k] * w[z] * u[
x][
k][z];
38 r[
x][y][z] += d[2] * accu;
41 for (
size_t x = 0;
x <
P; ++
x)
42 for (
size_t y = 0; y <
P; ++y)
43 for (
size_t z = 0; z <
P; ++z) {
45 for (
size_t k = 0;
k <
P; ++
k) {
46 accu += w[
x] * w[y] *
L[z][
k] * u[
x][y][
k];
48 r[
x][y][z] += d[3] * accu;
62 for (
size_t x = 0;
x <
P; ++
x)
63 for (
size_t y = 0; y <
P; ++y)
64 for (
size_t z = 0; z <
P; ++z) {
65 real_t M_u_xyz = w[
x] * w[y] * w[z] * u[
x][y][z];
66 M_u[
x][y][z] = M_u_xyz;
67 r[
x][y][z] = M_u_xyz * d[0];
70 for (
size_t i = 0; i <
P; ++i)
71 for (
size_t j = 0; j <
P; ++j) {
72 L_hat[i][j] =
L[i][j] / w[j];
75 for (
size_t x = 0;
x <
P; ++
x)
76 for (
size_t y = 0; y <
P; ++y)
77 for (
size_t z = 0; z <
P; ++z) {
79 for (
size_t k = 0;
k <
P; ++
k) {
80 accu += L_hat[
x][
k] * M_u[
k][y][z];
82 r[
x][y][z] += d[1] * accu;
85 for (
size_t x = 0;
x <
P; ++
x)
86 for (
size_t y = 0; y <
P; ++y)
87 for (
size_t z = 0; z <
P; ++z) {
89 for (
size_t k = 0;
k <
P; ++
k) {
90 accu += L_hat[y][
k] * M_u[
x][
k][z];
92 r[
x][y][z] += d[2] * accu;
95 for (
size_t x = 0;
x <
P; ++
x)
96 for (
size_t y = 0; y <
P; ++y)
97 for (
size_t z = 0; z <
P; ++z) {
99 for (
size_t k = 0;
k <
P; ++
k) {
100 accu += L_hat[z][
k] * M_u[
x][y][
k];
102 r[
x][y][z] += d[3] * accu;
128 int main(
int argc,
const char* argv[])
143 printf(
"mse2 = %G\n", mse2);
real_t * make_random(size_t size)
void helm_factor_impl(real_t w[P], real_t L[P][P], real_t d[4], real_t u[P][P][P], real_t L_hat[P][P], real_t M_u[P][P][P], real_t r[P][P][P])
real_t * make_empty(size_t size)
void helm_factor(real_t w[P], real_t L[P][P], real_t d[4], real_t u[P][P][P], real_t r[P][P][P])
void helm_naive(real_t w[P], real_t L[P][P], real_t d[4], real_t u[P][P][P], real_t r[P][P][P])
int main(int argc, const char *argv[])
static const uint32_t k[]
real_t mse(const real_t *a, const real_t *b, size_t size)
x
Return the smallest n such that 2^n >= _x.