
No, Boost.MultiArray is not what you are looking for. Boost.MultiArray is for data organized as a multi-dimensional "box": each of its dimension has a specified size. In 3D, these can be understood as height, width and length. Memory is allocated for every possible elements within this box, no exception.
a00 a01 a02 a03 a04 a05 a06 a07 a08 a10 a11 a12 a13 a14 a20 a21 a22 a30 a31 a40
For your 2D example, you could use a vector of vector.
std::vector< std::vector< my_type > > storage(5); // Your example has 5
lines.
storage[0].resize(9); // The first line of your example has 9 elements.
storage[1].resize(5); // The second line of your example has 5 elements.
storage[2].resize(3); // ...
storage[3].resize(2);
storage[4].resize(1);
If your data is organized according to a "simplex" topology (the
multi-dimensional extension of a triangular matrix, see
http://en.wikipedia.org/wiki/Simplex ), then I may have something for you.
Contact me again and I will give you further information. However, from your
example, I guess that this is not the case.
Pierre-André Noël
2011/9/7 Júlio Hoffimann
Dear all,
By reading Boost.MultiArray docs, i haven't figured out any possible way to deal with unbalanced matrices. The following picture explains what i mean by unbalanced:
// two dimensional unbalanced matrix:
a00 a01 a02 a03 a04 a05 a06 a07 a08 a10 a11 a12 a13 a14 a20 a21 a22 a30 a31 a40
Each row has it's own extent (defined at runtime). Seems multi_array<> classes are not designed to increase it's subcontainers decoupled, and at a given depth, they always share the same extent? Could you confirm or guide me in how to achieve this behavior? I really need to save memory due to large 3D matrices.
Regards, Júlio.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users