Boost Users :
Subject: Re: [Boost-users] [MultiArrrat] Unbalanced multi_array<>
From: Júlio Hoffimann (julio.hoffimann_at_[hidden])
Date: 2011-09-07 14:43:11
I appreciate your categorical answer, you saved me a lot of time. :-)
Actually, i'm using std::vector< std::vector<> >, but things will explode
when working with a real case. Sadly my matrices hasn't a defined structure,
i'll try to redesign the algorithm to avoid this memory consumption.
2011/9/7 Pierre-Andre Noel <noel.pierre.andre_at_[hidden]>
> 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
> storage.resize(9); // The first line of your example has 9 elements.
> storage.resize(5); // The second line of your example has 5 elements.
> storage.resize(3); // ...
> 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 <julio.hoffimann_at_[hidden]>
>> 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
>> 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.
>> Boost-users mailing list
> Boost-users mailing list
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net