|
Boost : |
From: garcia (garcia_at_[hidden])
Date: 2004-02-10 23:00:34
Greetings,
I am trying to grok what it is you describe, but I am afraid I may be
missing something. Could you explain in what ways dynamic_multi_array
differs from the arrays in the Boost.MultiArray library?
Thanks,
ron
RGProlog_at_[hidden] wrote:
> Is anyone interested in dynamic_multi_array template library that
> offers user intuitive convenience of use as well as capacity to hone
> in upon any specific subset of a multi-dimensional array? As an
> example of usage, a dynamic_multi_array object can be constructed and
> then resized and then reshaped like this:
>
> size_t arrayShape = { 3, 7, 15};
>
> dynamic_multi_array<double, 3> A(arrayShape);
>
> boost::array<size_t, 3> anotherArrayShape = {{ 5, 4, 22}};
>
> A.resize(anotherArrayShape);
>
> boost::array<size_t, 5> yetAnotherArrayShape = {{ 440, 1, 1, 0,
> 0}} ;
>
> A.reshape(yetAnotherArrayShape);
>
> size_t stillAnotherArrayShape[4] = { 22, 10, 2, 11};
>
> A.reshape(stillAnotherArrayShape);
>
> The libraryâs design owes a lot to Andrei Alexandrescuâs ideas. It is
> based on the data_table helper class template defined as follows:
>
> template<typename X>
>
> class data_table {
>
> â¦
>
> protected:
>
> std::vector<X> data_table_ ;};
>
> template<> <value_type>
>
> class data_table {
>
> â¦
>
> protected:
>
> value_type* data_table_ ;};
>
> Then, a sequence of the table class instantiation types is recursively
> defined and then given a name that is shared in different dimensional
> contexts as follows:
>
>
>
> typedef data_table<value_type> data_table_01;
>
> â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦.
>
> typedef data_table< data_table_49 > data_table_50 ;
>
>
>
> class Int2Type<int> {
>
> typedef data_table_01 data_table;
>
> }
>
> â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦
>
> class Int2Type<> <50> {
>
> typedef data_table_50 data_table;
>
> }
>
> Being a recursive template class, the data_table is implemented in a
> concise code that is mostly about stating a few recursive rules and
> implementing some access operators and is totally dimension
> independent. This is the central feature of the design since the user
> level wrapper class template by virtue of exporting a dimension
> appropriate data_table instantiation that uses its shared name
>
> template <T, size_t i, Allocator>
>
> class dynamic_multi_array {
>
> â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦.
>
> typedef â¦. class Int2Type <i>::data_table;
>
> }
>
> is also implemented in a way that hides all the implementation
> details, is concise and dimension independent, thus providing user
> with a great deal of flexibility, syntax safety, and, in case of a
> new user, a flat learning curve. This is a std::vector based design.
> The dynamic_multi_array template class, the libraryâs main component,
> extends, where appropriate, std::vector capacities, replicates its
> exception safety guarantees and has std::vector as its back end
> storage device.
>
> The libraryâs code, documentation including a short tutorial and a
> few key tests and will be posted in Dynamic Multi Array Folder on
> boost Files once the issue of available space will be resolved.
>
>
>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk