5 #include "andres/marray.hxx"
10 size_t shape[] = {3, 4, 2};
31 size_t shape[] = {3, 4, 2};
37 std::cout << a.asString();
40 for(
size_t j=0; j<a.size(); ++j) {
41 std::cout << a(j) <<
' ';
43 std::cout << std::endl;
47 std::cout << *it <<
' ';
49 std::cout << std::endl;
56 size_t shape[] = {3, 4, 2};
74 c = a*a + 2*a*b + b*b;
90 size_t shape[] = {3, 4, 2};
94 float c = (a*a*a + 2*a*a*b + 2*a*b*b + b*b*b)(2, 0, 0);
95 std::cout << c << std::endl;
108 size_t shape[] = {15, 5};
110 for(
size_t j=0; j<a.size(); ++j) {
111 a(j) = 10 +
static_cast<int>(j);
116 size_t base[] = {5, 1};
120 std::cout << a.asString();
141 size_t newShape[] = {5, 3, 5};
142 d.
reshape(newShape, newShape + 3);
153 for(
size_t j=0; j<24; ++j) {
154 (**e)[j] =
static_cast<int>(j);
157 size_t shape[] = {3, 4, 2};
166 for(
size_t j=0; j<24; ++j) {
167 std::cout << (**e)[j] <<
", " << f(j) << std::endl;
171 for(
size_t x=0; x<shape[0]; ++x) {
172 for(
size_t y=0; y<shape[1]; ++y) {
173 for(
size_t z=0; z<shape[2]; ++z) {
174 std::cout <<
"e[" << x <<
"][" << y <<
"][" << z <<
"] = "
175 << e[x][y][z] <<
", "
176 <<
"f(" << x <<
", " << y <<
", " << z <<
") = "
177 << f(x, y, z) << std::endl;