3 #include <boost/multi_array.hpp> 11 typedef boost::multi_array<double, 2> array_type;
16 array_type ar(boost::extents[l_size][t_size]);
17 cerr <<
"Dimensions: " << ar.dimensionality <<
endl;
18 cerr <<
"Dimension 0 is size " << ar.shape()[0] <<
endl;
19 cerr <<
"Dimension 1 is size " << ar.shape()[1] <<
endl;
21 Assert(l_size == ar.shape()[0]);
22 Assert(t_size == ar.shape()[1]);
23 for (
size_t l_ind=0; l_ind < l_size; ++l_ind) {
24 for (
size_t t_ind=0; t_ind < t_size; ++t_ind) {
25 ar[l_ind][t_ind] = l_ind*t_ind;
28 for (
size_t t_ind=0; t_ind < t_size; ++t_ind) {
29 for (
size_t l_ind=0; l_ind < l_size; ++l_ind) {
30 cerr <<
"\t[" << l_ind<<
"][" << t_ind <<
"] = " << ar[l_ind][t_ind];
35 array_type ar2(boost::extents[l_size][t_size]);
37 Assert(l_size == ar2.shape()[0]);
38 Assert(t_size == ar2.shape()[1]);
41 Assert(l_size == ar3.shape()[0]);
42 Assert(t_size == ar3.shape()[1]);
47 typedef boost::multi_array<double, 3> array_type3;
49 array_type3
B(boost::extents[nx][ny][nz]);
51 for (index3 i=0; i<nx; ++i) {
52 for (index3 j=0; j<ny; ++j) {
53 for (index3
k=0;
k<nz; ++
k) {
54 const double foo = i*j*
k;
QTextStream & endl(QTextStream &s)