1 #ifndef TNT_ARRAY3D_UTILS_H
2 #define TNT_ARRAY3D_UTILS_H
18 s << M <<
" " << N <<
" " << K <<
"\n";
20 for (
int i=0; i<M; i++)
22 for (
int j=0; j<N; j++)
24 for (
int k=0; k<K; k++)
25 s << A[i][j][k] <<
" ";
45 for (
int i=0; i<M; i++)
46 for (
int j=0; j<N; j++)
47 for (
int k=0; k<K; k++)
70 for (
int i=0; i<m; i++)
71 for (
int j=0; j<n; j++)
72 for (
int k=0; k<p; k++)
73 C[i][j][k] = A[i][j][k] + B[i][j][k];
94 for (
int i=0; i<m; i++)
95 for (
int j=0; j<n; j++)
96 for (
int k=0; k<p; k++)
97 C[i][j][k] = A[i][j][k] - B[i][j][k];
120 for (
int i=0; i<m; i++)
121 for (
int j=0; j<n; j++)
122 for (
int k=0; k<p; k++)
123 C[i][j][k] = A[i][j][k] * B[i][j][k];
144 for (
int i=0; i<m; i++)
145 for (
int j=0; j<n; j++)
146 for (
int k=0; k<p; k++)
147 C[i][j][k] = A[i][j][k] / B[i][j][k];
164 for (
int i=0; i<m; i++)
165 for (
int j=0; j<n; j++)
166 for (
int k=0; k<p; k++)
167 A[i][j][k] += B[i][j][k];
182 for (
int i=0; i<m; i++)
183 for (
int j=0; j<n; j++)
184 for (
int k=0; k<p; k++)
185 A[i][j][k] -= B[i][j][k];
200 for (
int i=0; i<m; i++)
201 for (
int j=0; j<n; j++)
202 for (
int k=0; k<p; k++)
203 A[i][j][k] *= B[i][j][k];
219 for (
int i=0; i<m; i++)
220 for (
int j=0; j<n; j++)
221 for (
int k=0; k<p; k++)
222 A[i][j][k] /= B[i][j][k];
Definition: tnt_array3d.h:39
int dim3() const
Definition: tnt_array3d.h:239
int dim1() const
Definition: tnt_array3d.h:233
int dim2() const
Definition: tnt_array3d.h:236
Definition: tnt_array1d.h:36
Array1D< T > operator+(const Array1D< T > &A, const Array1D< T > &B)
Definition: tnt_array1d_utils.h:64
Array1D< T > & operator-=(Array1D< T > &A, const Array1D< T > &B)
Definition: tnt_array1d_utils.h:174
Array1D< T > & operator/=(Array1D< T > &A, const Array1D< T > &B)
Definition: tnt_array1d_utils.h:209
Array1D< T > operator*(const Array1D< T > &A, const Array1D< T > &B)
Definition: tnt_array1d_utils.h:107
Array1D< T > operator-(const Array1D< T > &A, const Array1D< T > &B)
Definition: tnt_array1d_utils.h:86
Array1D< T > & operator+=(Array1D< T > &A, const Array1D< T > &B)
Definition: tnt_array1d_utils.h:156
Array1D< T > & operator*=(Array1D< T > &A, const Array1D< T > &B)
Definition: tnt_array1d_utils.h:191
Array1D< T > operator/(const Array1D< T > &A, const Array1D< T > &B)
Definition: tnt_array1d_utils.h:128
std::ostream & operator<<(std::ostream &s, const Array1D< T > &A)
Definition: tnt_array1d_utils.h:31
std::istream & operator>>(std::istream &s, Array1D< T > &A)
Definition: tnt_array1d_utils.h:49