|
Boost : |
From: Randy Roberts (rroberts_at_[hidden])
Date: 2000-12-07 17:07:20
--- In boost_at_[hidden], "Randy Roberts" <rroberts_at_r...> wrote:
> Some of us do alot of interfacing with old F77 or newer F90 code.
> An **intrinsic** FORTRAN-order for the actual array class would
> probably
> be more efficient, especially since we would need a raw pointer to
the
> data in contiguous FORTRAN-order. Therefore, I propose that the
array
> class be templated on a policy parameter dictating the intrinsic
> ordering
> of the data.
>
> template <int N>
> class C_ordering_policy
> {
> // I'll have to think about what goes in here. Sorry!
> };
>
> template <int N>
> class F77_ordering_policy
> {
> // I'll have to think about what goes in here. Sorry!
> };
>
> template <typename T, int N, class
OrderingPolicy=C_ordering_policy<N>
> >
> class array : private OrderingPolicy
> {
> // Use the OrderingPolicy to correctly create sub_array<N-1>
> };
>
> Sorry it's so sketchy, but my attempt at N-dimensional arrays was
> similar
> to the original article, but used std::valarray for the
> representation.
> The different OrderingPolicy's created and manipulated std::gslice's
> that were contained within the array's representation. I don't
think
> we want to do this here. :-}
The only problem with this, now that I remember my version,
is that my sub_array's had to handle generalized slices of the
original array's data. That's why I used the std::gslice mechanism.
array<double,2,F77_ordering_policy> a(dims(10)(20)); // ?? dims ??
a[3] would have to create a
sub_array<double,1,F77_ordering_policy>
that refers to a 20-strided slice of a's data (whereas
C_ordering_policy would have returned a single-strided slice).
What was so clean about Giovanni's original version was that each
sub_array handled a contiguous range of the array's data. Do we
want to allow that sub_array's manipulate general slices of the
array's data?
Regards,
Randy
-- Randy M. Roberts | "His men would follow him anywhere, rroberts_at_[hidden] | but only out of morbid curiosity." rsqrd_at_[hidden] | -- a performance review work: (505)665-4285
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk