1 #ifndef SRC_UTILS_NDARRAYS_HPP_
2 #define SRC_UTILS_NDARRAYS_HPP_
9 for (
int i = 0; i < n1; ++i)
a[i] =
a[0] + i * n2;
27 a[0] =
new T*[n1 * n2];
28 a[0][0] =
new T[n1 * n2 * n3];
30 for (
int i = 0; i < n1; ++i) {
32 for (
int j = 0;
j < n2; ++
j)
a[i][
j] =
a[0][0] + i * n2 * n3 +
j * n3;
51 void NewCArray(T****&
a,
int n1,
int n2,
int n3,
int n4) {
53 a[0] =
new T**[n1 * n2];
54 a[0][0] =
new T*[n1 * n2 * n3];
55 a[0][0][0] =
new T[n1 * n2 * n3 * n4];
57 for (
int i = 0; i < n1; ++i) {
59 for (
int j = 0;
j < n2; ++
j) {
60 a[i][
j] =
a[0][0] + i * n2 * n3 +
j * n3;
61 for (
int k = 0; k < n3; ++k)
62 a[i][
j][k] =
a[0][0][0] + i * n2 * n3 * n4 +
j * n3 * n4 + k * n4;
void FreeCArray4(T ****a)
void NewCArray(T **&a, int n1, int n2)