125 static_assert(n_rows > 0 || n_columns > 0,
126 "Specialization only for n_rows, n_columns > 0");
127 Assert(n_rows > 0 && n_columns > 0,
129 std::to_string(n_rows) +
", " +
130 std::to_string(n_columns) +
" was passed!"));
132 "This function should only use EvaluatorQuantity::value");
134 constexpr int mm = transpose_matrix ? n_rows : n_columns,
135 nn = transpose_matrix ? n_columns : n_rows;
137 std::array<Number, mm> x;
138 for (
int i = 0; i < mm; ++i)
139 x[i] = in[stride_in * i];
140 for (
int col = 0; col < nn; ++col)
143 if (transpose_matrix ==
true)
145 res0 = matrix[col] * x[0];
146 for (
int i = 1; i < mm; ++i)
148 const Number2 mji = matrix[i * n_columns + col];
152 res0.real(res0.real() + mji.real() * x[i].real() -
153 mji.imag() * x[i].imag());
154 res0.imag(res0.imag() + mji.imag() * x[i].real() +
155 mji.real() * x[i].imag());
163 res0 = matrix[col * n_columns] * x[0];
164 for (
int i = 1; i < mm; ++i)
166 const Number2 mij = matrix[col * n_columns + i];
170 res0.real(res0.real() + mij.real() * x[i].real() -
171 mij.imag() * x[i].imag());
172 res0.imag(res0.imag() + mij.imag() * x[i].real() +
173 mij.real() * x[i].imag());
180 out[stride_out * col] += res0;
182 out[stride_out * col] = res0;
205 const int stride_in_given,
206 const int stride_out_given)
208 const int mm = transpose_matrix ? n_rows : n_columns,
209 nn = transpose_matrix ? n_columns : n_rows;
210 Assert(n_rows > 0 && n_columns > 0,
212 Assert(n_rows > 0 && n_columns > 0,
214 std::to_string(n_rows) +
", " +
215 std::to_string(n_columns) +
" was passed!"));
218 "This function should only use EvaluatorQuantity::value");
220 Assert(consider_strides || (stride_in_given == 1 && stride_out_given == 1),
222 const int stride_in = consider_strides ? stride_in_given : 1;
223 const int stride_out = consider_strides ? stride_out_given : 1;
230 if (transpose_matrix && n_rows == 2)
232 const Number2 *matrix_1 = matrix + n_columns;
233 const Number x0 = in[0], x1 = in[stride_in];
234 for (
int col = 0; col < nn; ++col)
236 const Number result = matrix[col] * x0 + matrix_1[col] * x1;
238 out[stride_out * col] += result;
240 out[stride_out * col] = result;
243 else if (transpose_matrix && n_rows == 3)
245 const Number2 *matrix_1 = matrix + n_columns;
246 const Number2 *matrix_2 = matrix_1 + n_columns;
247 const Number x0 = in[0], x1 = in[stride_in], x2 = in[2 * stride_in];
248 for (
int col = 0; col < nn; ++col)
250 const Number result =
251 matrix[col] * x0 + matrix_1[col] * x1 + matrix_2[col] * x2;
253 out[stride_out * col] += result;
255 out[stride_out * col] = result;
262 std::array<Number, 129> x;
263 for (
int i = 0; i < mm; ++i)
264 x[i] = in[stride_in * i];
266 for (
int col = 0; col < nn; ++col)
269 if (transpose_matrix ==
true)
271 res0 = matrix[col] * x[0];
272 for (
int i = 1; i < mm; ++i)
273 res0 += matrix[i * n_columns + col] * x[i];
277 res0 = matrix[col * n_columns] * x[0];
278 for (
int i = 1; i < mm; ++i)
279 res0 += matrix[col * n_columns + i] * x[i];
282 out[stride_out * col] += res0;
284 out[stride_out * col] = res0;
289 int nn_regular = (nn / 4) * 4;
290 for (
int col = 0; col < nn_regular; col += 4)
292 Number res0, res1, res2, res3;
293 if (transpose_matrix ==
true)
295 const Number2 *matrix_ptr = matrix + col;
296 res0 = matrix_ptr[0] * in[0];
297 res1 = matrix_ptr[1] * in[0];
298 res2 = matrix_ptr[2] * in[0];
299 res3 = matrix_ptr[3] * in[0];
300 matrix_ptr += n_columns;
301 for (
int i = 1; i < mm; ++i, matrix_ptr += n_columns)
303 res0 += matrix_ptr[0] * in[stride_in * i];
304 res1 += matrix_ptr[1] * in[stride_in * i];
305 res2 += matrix_ptr[2] * in[stride_in * i];
306 res3 += matrix_ptr[3] * in[stride_in * i];
311 const Number2 *matrix_0 = matrix + col * n_columns;
312 const Number2 *matrix_1 = matrix + (col + 1) * n_columns;
313 const Number2 *matrix_2 = matrix + (col + 2) * n_columns;
314 const Number2 *matrix_3 = matrix + (col + 3) * n_columns;
316 res0 = matrix_0[0] * in[0];
317 res1 = matrix_1[0] * in[0];
318 res2 = matrix_2[0] * in[0];
319 res3 = matrix_3[0] * in[0];
320 for (
int i = 1; i < mm; ++i)
322 res0 += matrix_0[i] * in[stride_in * i];
323 res1 += matrix_1[i] * in[stride_in * i];
324 res2 += matrix_2[i] * in[stride_in * i];
325 res3 += matrix_3[i] * in[stride_in * i];
331 out[stride_out] += res1;
332 out[2 * stride_out] += res2;
333 out[3 * stride_out] += res3;
338 out[stride_out] = res1;
339 out[2 * stride_out] = res2;
340 out[3 * stride_out] = res3;
342 out += 4 * stride_out;
344 if (nn - nn_regular == 3)
346 Number res0, res1, res2;
347 if (transpose_matrix ==
true)
349 const Number2 *matrix_ptr = matrix + nn_regular;
350 res0 = matrix_ptr[0] * in[0];
351 res1 = matrix_ptr[1] * in[0];
352 res2 = matrix_ptr[2] * in[0];
353 matrix_ptr += n_columns;
354 for (
int i = 1; i < mm; ++i, matrix_ptr += n_columns)
356 res0 += matrix_ptr[0] * in[stride_in * i];
357 res1 += matrix_ptr[1] * in[stride_in * i];
358 res2 += matrix_ptr[2] * in[stride_in * i];
363 const Number2 *matrix_0 = matrix + nn_regular * n_columns;
364 const Number2 *matrix_1 = matrix + (nn_regular + 1) * n_columns;
365 const Number2 *matrix_2 = matrix + (nn_regular + 2) * n_columns;
367 res0 = matrix_0[0] * in[0];
368 res1 = matrix_1[0] * in[0];
369 res2 = matrix_2[0] * in[0];
370 for (
int i = 1; i < mm; ++i)
372 res0 += matrix_0[i] * in[stride_in * i];
373 res1 += matrix_1[i] * in[stride_in * i];
374 res2 += matrix_2[i] * in[stride_in * i];
380 out[stride_out] += res1;
381 out[2 * stride_out] += res2;
386 out[stride_out] = res1;
387 out[2 * stride_out] = res2;
390 else if (nn - nn_regular == 2)
393 if (transpose_matrix ==
true)
395 const Number2 *matrix_ptr = matrix + nn_regular;
396 res0 = matrix_ptr[0] * in[0];
397 res1 = matrix_ptr[1] * in[0];
398 matrix_ptr += n_columns;
399 for (
int i = 1; i < mm; ++i, matrix_ptr += n_columns)
401 res0 += matrix_ptr[0] * in[stride_in * i];
402 res1 += matrix_ptr[1] * in[stride_in * i];
407 const Number2 *matrix_0 = matrix + nn_regular * n_columns;
408 const Number2 *matrix_1 = matrix + (nn_regular + 1) * n_columns;
410 res0 = matrix_0[0] * in[0];
411 res1 = matrix_1[0] * in[0];
412 for (
int i = 1; i < mm; ++i)
414 res0 += matrix_0[i] * in[stride_in * i];
415 res1 += matrix_1[i] * in[stride_in * i];
421 out[stride_out] += res1;
426 out[stride_out] = res1;
429 else if (nn - nn_regular == 1)
432 if (transpose_matrix ==
true)
434 const Number2 *matrix_ptr = matrix + nn_regular;
435 res0 = matrix_ptr[0] * in[0];
436 matrix_ptr += n_columns;
437 for (
int i = 1; i < mm; ++i, matrix_ptr += n_columns)
438 res0 += matrix_ptr[0] * in[stride_in * i];
442 const Number2 *matrix_ptr = matrix + nn_regular * n_columns;
443 res0 = matrix_ptr[0] * in[0];
444 for (
int i = 1; i < mm; ++i)
445 res0 += matrix_ptr[i] * in[stride_in * i];
481 static_assert(n_rows > 0 || n_columns > 0,
482 "Specialization only for n_rows, n_columns > 0");
483 Assert(n_rows > 0 && n_columns > 0,
485 std::to_string(n_rows) +
", " +
486 std::to_string(n_columns) +
" was passed!"));
488 constexpr int mm = transpose_matrix ? n_rows : n_columns,
489 nn = transpose_matrix ? n_columns : n_rows;
490 constexpr int n_cols = nn / 2;
491 constexpr int mid = mm / 2;
493 std::array<Number, mm> x;
494 for (
int i = 0; i < mm; ++i)
495 x[i] = in[stride_in * i];
518 for (
int col = 0; col < n_cols; ++col)
522 if (transpose_matrix ==
true)
525 val1 = matrix[nn - 1 - col];
529 val0 = matrix[col * n_columns];
530 val1 = matrix[(col + 1) * n_columns - 1];
536 res0 += val1 * x[mm - 1];
537 res1 += val0 * x[mm - 1];
538 for (
int ind = 1; ind < mid; ++ind)
540 if (transpose_matrix ==
true)
542 val0 = matrix[ind * n_columns + col];
543 val1 = matrix[ind * n_columns + nn - 1 - col];
547 val0 = matrix[col * n_columns + ind];
548 val1 = matrix[(col + 1) * n_columns - 1 - ind];
550 res0 += val0 * x[ind];
551 res1 += val1 * x[ind];
552 res0 += val1 * x[mm - 1 - ind];
553 res1 += val0 * x[mm - 1 - ind];
557 res0 = res1 = Number();
558 if (transpose_matrix ==
true)
562 const Number tmp = matrix[mid * n_columns + col] * x[mid];
569 if (mm % 2 == 1 && nn % 2 == 0)
571 const Number tmp = matrix[col * n_columns + mid] * x[mid];
578 out[stride_out * col] += res0;
579 out[stride_out * (nn - 1 - col)] += res1;
583 out[stride_out * col] = res0;
584 out[stride_out * (nn - 1 - col)] = res1;
587 if (transpose_matrix ==
true && nn % 2 == 1 && mm % 2 == 1)
590 out[stride_out * n_cols] += x[mid];
592 out[stride_out * n_cols] = x[mid];
594 else if (transpose_matrix ==
true && nn % 2 == 1)
599 res0 = matrix[n_cols] * (x[0] + x[mm - 1]);
600 for (
int ind = 1; ind < mid; ++ind)
602 const Number2 val0 = matrix[ind * n_columns + n_cols];
603 res0 += val0 * (x[ind] + in[mm - 1 - ind]);
609 out[stride_out * n_cols] += res0;
611 out[stride_out * n_cols] = res0;
613 else if (transpose_matrix ==
false && nn % 2 == 1)
618 res0 = matrix[n_cols * n_columns] * (x[0] + x[mm - 1]);
619 for (
int ind = 1; ind < mid; ++ind)
621 const Number2 val0 = matrix[n_cols * n_columns + ind];
622 res0 += val0 * (x[ind] + x[mm - 1 - ind]);
631 out[stride_out * n_cols] += res0;
633 out[stride_out * n_cols] = res0;
654 for (
int col = 0; col < n_cols; ++col)
658 if (transpose_matrix ==
true)
661 val1 = matrix[nn - 1 - col];
665 val0 = matrix[col * n_columns];
666 val1 = matrix[(nn - col - 1) * n_columns];
672 res0 -= val1 * x[mm - 1];
673 res1 -= val0 * x[mm - 1];
674 for (
int ind = 1; ind < mid; ++ind)
676 if (transpose_matrix ==
true)
678 val0 = matrix[ind * n_columns + col];
679 val1 = matrix[ind * n_columns + nn - 1 - col];
683 val0 = matrix[col * n_columns + ind];
684 val1 = matrix[(nn - col - 1) * n_columns + ind];
686 res0 += val0 * x[ind];
687 res1 += val1 * x[ind];
688 res0 -= val1 * x[mm - 1 - ind];
689 res1 -= val0 * x[mm - 1 - ind];
693 res0 = res1 = Number();
696 if (transpose_matrix ==
true)
697 val0 = matrix[mid * n_columns + col];
699 val0 = matrix[col * n_columns + mid];
700 const Number tmp = val0 * x[mid];
706 out[stride_out * col] += res0;
707 out[stride_out * (nn - 1 - col)] += res1;
711 out[stride_out * col] = res0;
712 out[stride_out * (nn - 1 - col)] = res1;
719 if (transpose_matrix ==
true)
720 val0 = matrix[n_cols];
722 val0 = matrix[n_cols * n_columns];
723 res0 = val0 * (x[0] - x[mm - 1]);
724 for (
int ind = 1; ind < mid; ++ind)
726 if (transpose_matrix ==
true)
727 val0 = matrix[ind * n_columns + n_cols];
729 val0 = matrix[n_cols * n_columns + ind];
730 Number in1 = val0 * (x[ind] - x[mm - 1 - ind]);
734 out[stride_out * n_cols] += res0;
736 out[stride_out * n_cols] = res0;
743 for (
int col = 0; col < n_cols; ++col)
747 if (transpose_matrix ==
true)
750 val1 = matrix[nn - 1 - col];
754 val0 = matrix[col * n_columns];
755 val1 = matrix[(col + 1) * n_columns - 1];
761 res0 += val1 * x[mm - 1];
762 res1 += val0 * x[mm - 1];
763 for (
int ind = 1; ind < mid; ++ind)
765 if (transpose_matrix ==
true)
767 val0 = matrix[ind * n_columns + col];
768 val1 = matrix[ind * n_columns + nn - 1 - col];
772 val0 = matrix[col * n_columns + ind];
773 val1 = matrix[(col + 1) * n_columns - 1 - ind];
775 res0 += val0 * x[ind];
776 res1 += val1 * x[ind];
777 res0 += val1 * x[mm - 1 - ind];
778 res1 += val0 * x[mm - 1 - ind];
782 res0 = res1 = Number();
785 if (transpose_matrix ==
true)
786 val0 = matrix[mid * n_columns + col];
788 val0 = matrix[col * n_columns + mid];
789 const Number tmp = val0 * x[mid];
795 out[stride_out * col] += res0;
796 out[stride_out * (nn - 1 - col)] += res1;
800 out[stride_out * col] = res0;
801 out[stride_out * (nn - 1 - col)] = res1;
808 if (transpose_matrix ==
true)
809 val0 = matrix[n_cols];
811 val0 = matrix[n_cols * n_columns];
814 res0 = val0 * (x[0] + x[mm - 1]);
815 for (
int ind = 1; ind < mid; ++ind)
817 if (transpose_matrix ==
true)
818 val0 = matrix[ind * n_columns + n_cols];
820 val0 = matrix[n_cols * n_columns + ind];
821 Number in1 = val0 * (x[ind] + x[mm - 1 - ind]);
829 if (transpose_matrix ==
true)
830 val0 = matrix[mid * n_columns + n_cols];
832 val0 = matrix[n_cols * n_columns + mid];
833 res0 += val0 * x[mid];
836 out[stride_out * n_cols] += res0;
838 out[stride_out * n_cols] = res0;
880 int n_rows_runtime = 0,
881 int n_columns_runtime = 0,
882 int stride_in_runtime = 0,
883 int stride_out_runtime = 0)
885 static_assert(n_rows_static >= 0 && n_columns_static >= 0,
886 "Negative loop ranges are not allowed!");
888 const int n_rows = n_rows_static == 0 ? n_rows_runtime : n_rows_static;
889 const int n_columns =
890 n_rows_static == 0 ? n_columns_runtime : n_columns_static;
891 const int stride_in =
892 stride_in_static == 0 ? stride_in_runtime : stride_in_static;
893 const int stride_out =
894 stride_out_static == 0 ? stride_out_runtime : stride_out_static;
896 Assert(n_rows > 0 && n_columns > 0,
898 std::to_string(n_rows) +
", " +
899 std::to_string(n_columns) +
" was passed!"));
901 const int mm = transpose_matrix ? n_rows : n_columns,
902 nn = transpose_matrix ? n_columns : n_rows;
903 const int n_half = nn / 2;
904 const int m_half = mm / 2;
906 constexpr int array_length =
907 (n_rows_static == 0) ?
910 (1 + (transpose_matrix ? n_rows_static : n_columns_static) / 2);
911 const int offset = (n_columns + 1) / 2;
915 std::array<Number, array_length> xp, xm;
916 for (
int i = 0; i < m_half; ++i)
920 xp[i] = in[stride_in * i] - in[stride_in * (mm - 1 - i)];
921 xm[i] = in[stride_in * i] + in[stride_in * (mm - 1 - i)];
925 xp[i] = in[stride_in * i] + in[stride_in * (mm - 1 - i)];
926 xm[i] = in[stride_in * i] - in[stride_in * (mm - 1 - i)];
929 Number xmid = in[stride_in * m_half];
930 for (
int col = 0; col < n_half; ++col)
935 if (transpose_matrix ==
true)
937 r0 = matrix[col] * xp[0];
938 r1 = matrix[(n_rows - 1) * offset + col] * xm[0];
942 r0 = matrix[col * offset] * xp[0];
943 r1 = matrix[(n_rows - 1 - col) * offset] * xm[0];
945 for (
int ind = 1; ind < m_half; ++ind)
947 if (transpose_matrix ==
true)
949 r0 += matrix[ind * offset + col] * xp[ind];
950 r1 += matrix[(n_rows - 1 - ind) * offset + col] * xm[ind];
954 r0 += matrix[col * offset + ind] * xp[ind];
955 r1 += matrix[(n_rows - 1 - col) * offset + ind] * xm[ind];
961 if (mm % 2 == 1 && transpose_matrix ==
true)
964 r1 += matrix[m_half * offset + col] * xmid;
966 r0 += matrix[m_half * offset + col] * xmid;
968 else if (mm % 2 == 1 &&
971 r0 += matrix[col * offset + m_half] * xmid;
975 out[stride_out * col] += r0 + r1;
977 transpose_matrix ==
false)
978 out[stride_out * (nn - 1 - col)] += r1 - r0;
980 out[stride_out * (nn - 1 - col)] += r0 - r1;
984 out[stride_out * col] = r0 + r1;
986 transpose_matrix ==
false)
987 out[stride_out * (nn - 1 - col)] = r1 - r0;
989 out[stride_out * (nn - 1 - col)] = r0 - r1;
993 nn % 2 == 1 && mm % 2 == 1 && mm > 3)
996 out[stride_out * n_half] += matrix[m_half * offset + n_half] * xmid;
998 out[stride_out * n_half] = matrix[m_half * offset + n_half] * xmid;
1000 else if (transpose_matrix ==
true && nn % 2 == 1)
1005 r0 = matrix[n_half] * xp[0];
1006 for (
int ind = 1; ind < m_half; ++ind)
1007 r0 += matrix[ind * offset + n_half] * xp[ind];
1012 r0 += matrix[m_half * offset + n_half] * xmid;
1015 out[stride_out * n_half] += r0;
1017 out[stride_out * n_half] = r0;
1019 else if (transpose_matrix ==
false && nn % 2 == 1)
1026 r0 = matrix[n_half * offset] * xm[0];
1027 for (
int ind = 1; ind < m_half; ++ind)
1028 r0 += matrix[n_half * offset + ind] * xm[ind];
1032 r0 = matrix[n_half * offset] * xp[0];
1033 for (
int ind = 1; ind < m_half; ++ind)
1034 r0 += matrix[n_half * offset + ind] * xp[ind];
1041 r0 += matrix[n_half * offset + m_half] * xmid;
1044 out[stride_out * n_half] += r0;
1046 out[stride_out * n_half] = r0;
1115 static_assert(n_rows > 0 && n_columns > 0,
1116 "Specialization requires n_rows, n_columns > 0");
1118 constexpr bool evaluate_antisymmetric =
1121 constexpr int mm = transpose_matrix ? n_rows : n_columns,
1122 nn = transpose_matrix ? n_columns : n_rows;
1123 constexpr int n_half = nn / 2;
1124 constexpr int m_half = mm / 2;
1126 if (transpose_matrix)
1128 std::array<Number, mm> x;
1129 for (
unsigned int i = 0; i < mm; ++i)
1130 x[i] = in[stride_in * i];
1131 for (
unsigned int col = 0; col < n_half; ++col)
1136 r0 = matrix[col] * x[0];
1137 r1 = matrix[col + n_columns] * x[1];
1138 for (
unsigned int ind = 1; ind < m_half; ++ind)
1140 r0 += matrix[col + 2 * ind * n_columns] * x[2 * ind];
1142 matrix[col + (2 * ind + 1) * n_columns] * x[2 * ind + 1];
1148 r0 += matrix[col + (mm - 1) * n_columns] * x[mm - 1];
1151 out[stride_out * col] += r0 + r1;
1152 if (evaluate_antisymmetric)
1153 out[stride_out * (nn - 1 - col)] += r1 - r0;
1155 out[stride_out * (nn - 1 - col)] += r0 - r1;
1159 out[stride_out * col] = r0 + r1;
1160 if (evaluate_antisymmetric)
1161 out[stride_out * (nn - 1 - col)] = r1 - r0;
1163 out[stride_out * (nn - 1 - col)] = r0 - r1;
1169 const unsigned int shift = evaluate_antisymmetric ? 1 : 0;
1172 r0 = matrix[n_half + shift * n_columns] * x[shift];
1173 for (
unsigned int ind = 1; ind < m_half; ++ind)
1174 r0 += matrix[n_half + (2 * ind + shift) * n_columns] *
1179 if (!evaluate_antisymmetric && mm % 2 == 1)
1180 r0 += matrix[n_half + (mm - 1) * n_columns] * x[mm - 1];
1182 out[stride_out * n_half] += r0;
1184 out[stride_out * n_half] = r0;
1189 std::array<Number, m_half + 1> xp, xm;
1190 for (
int i = 0; i < m_half; ++i)
1191 if (!evaluate_antisymmetric)
1193 xp[i] = in[stride_in * i] + in[stride_in * (mm - 1 - i)];
1194 xm[i] = in[stride_in * i] - in[stride_in * (mm - 1 - i)];
1198 xp[i] = in[stride_in * i] - in[stride_in * (mm - 1 - i)];
1199 xm[i] = in[stride_in * i] + in[stride_in * (mm - 1 - i)];
1202 xp[m_half] = in[stride_in * m_half];
1203 for (
unsigned int col = 0; col < n_half; ++col)
1208 r0 = matrix[2 * col * n_columns] * xp[0];
1209 r1 = matrix[(2 * col + 1) * n_columns] * xm[0];
1210 for (
unsigned int ind = 1; ind < m_half; ++ind)
1212 r0 += matrix[2 * col * n_columns + ind] * xp[ind];
1213 r1 += matrix[(2 * col + 1) * n_columns + ind] * xm[ind];
1220 if (evaluate_antisymmetric)
1221 r1 += matrix[(2 * col + 1) * n_columns + m_half] * xp[m_half];
1223 r0 += matrix[2 * col * n_columns + m_half] * xp[m_half];
1227 out[stride_out * (2 * col)] += r0;
1228 out[stride_out * (2 * col + 1)] += r1;
1232 out[stride_out * (2 * col)] = r0;
1233 out[stride_out * (2 * col + 1)] = r1;
1241 r0 = matrix[(nn - 1) * n_columns] * xp[0];
1242 for (
unsigned int ind = 1; ind < m_half; ++ind)
1243 r0 += matrix[(nn - 1) * n_columns + ind] * xp[ind];
1247 if (mm % 2 == 1 && !evaluate_antisymmetric)
1248 r0 += matrix[(nn - 1) * n_columns + m_half] * xp[m_half];
1250 out[stride_out * (nn - 1)] += r0;
1252 out[stride_out * (nn - 1)] = r0;
2303 const unsigned int n_components,
2304 const int n_points_1d_non_template,
2307 const int n_points_1d = n_points_1d_template != -1 ?
2308 n_points_1d_template :
2309 n_points_1d_non_template;
2314 unsigned int compressed_index[100];
2315 compressed_index[0] = 0;
2316 for (
int i = 1; i < n_points_1d - 1; ++i)
2317 compressed_index[i] = 1;
2318 compressed_index[n_points_1d - 1] = 2;
2325 const auto check_and_set = [](Number &weight,
const Number &data) {
2326 if (weight == Number(-1.0) || weight == data)
2335 for (
unsigned int c = 0; c < Utilities::pow<unsigned int>(3, dim); ++c)
2336 weights[c] = Number(-1.0);
2338 for (
unsigned int c = 0; c < n_components; ++c)
2339 for (
int k = 0; k < (dim > 2 ? n_points_1d : 1); ++k)
2340 for (
int j = 0; j < (dim > 1 ? n_points_1d : 1);
2341 ++j, data += n_points_1d)
2343 const unsigned int shift =
2344 9 * compressed_index[k] + 3 * compressed_index[j];
2346 if (!check_and_set(weights[shift], data[0]))
2349 for (
int i = 1; i < n_points_1d - 1; ++i)
2350 if (!check_and_set(weights[shift + 1], data[i]))
2353 if (!check_and_set(weights[shift + 2], data[n_points_1d - 1]))
2365 const unsigned int n_components,
2366 const int n_points_1d_non_template,
2369 const int n_points_1d = n_points_1d_template != -1 ?
2370 n_points_1d_template :
2371 n_points_1d_non_template;
2373 Assert((n_points_1d % 2) == 1,
2374 ExcMessage(
"The function can only with add number of points"));
2378 const unsigned int n_inside_1d = n_points_1d / 2;
2380 unsigned int compressed_index[100];
2383 for (
int i = 0; i < n_inside_1d; ++i)
2384 compressed_index[c++] = 0;
2385 compressed_index[c++] = 1;
2386 for (
int i = 0; i < n_inside_1d; ++i)
2387 compressed_index[c++] = 2;
2394 const auto check_and_set = [](Number &weight,
const Number &data) {
2395 if (weight == Number(-1.0) || weight == data)
2404 for (
unsigned int c = 0; c < Utilities::pow<unsigned int>(3, dim); ++c)
2405 weights[c] = Number(-1.0);
2407 for (
unsigned int comp = 0; comp < n_components; ++comp)
2408 for (
int k = 0; k < (dim > 2 ? n_points_1d : 1); ++k)
2409 for (
int j = 0; j < (dim > 1 ? n_points_1d : 1);
2410 ++j, data += n_points_1d)
2412 const unsigned int shift =
2413 9 * compressed_index[k] + 3 * compressed_index[j];
2417 for (
int i = 0; i < n_inside_1d; ++i)
2418 if (!check_and_set(weights[shift], data[c++]))
2421 if (!check_and_set(weights[shift + 1], data[c++]))
2424 for (
int i = 0; i < n_inside_1d; ++i)
2425 if (!check_and_set(weights[shift + 2], data[c++]))