Boost logo

Boost :

From: Kris Thielemans (kris.thielemans_at_[hidden])
Date: 2000-12-06 11:18:16


--- In boost_at_[hidden], Kevlin Henney <kevlin_at_c...> wrote:
> In message <002201c05e00$59633a20$460a10ac_at_r...>, Kris Thielemans
> <kris.thielemans_at_i...> writes
> >- multi-dimensional arrays needn't be 'regular' or 'rectangular'. For
> >instance, a each index in a 2D array can give you a 1D array with
different
> >sizes
>
> Ragged arrays, ie like vector< vector<T> >, solve a different design
> problem to the one solved by Giovanni's code. Whilst I think there is a
> place for them, the constraint of regularity is important in the current
> design. Perhaps you would consider a separate proposal?
>

I'll first have to look more closely at the current proposal. Is there any
more recent source code than the CUJ paper?
Or a summary of current changes/proposals?

> >- I allow indices with non-zero offset
>
> For any particular reason?
>

just to have more natural index values in our application. For instance, the
centre of an image is represented by indices [0][0].
As I use pointers everywhere, it was painless to add, and doesn't influence
performance.

> >- there is some extra code like operator+ etc and (binary) IO (but that's
> >pretty trivial to add).
>
> What do you do for the ragged cases with operator+, ie where you add two
> arrays together and a position is filled in one but not the other? Given
> the different possibilities, I'm inclined to think of these options as
> expressed through separate algorithm functions rather than a single
> operator+.
>

Not sure if I understand this. Just as in the standard case, you're supposed
to add only arrays of the same index range. Otherwise, you're more thinking
about a sparse representation. No?

(Ok, in my actual implementation, the resulting array will actually 'grow'
such that its indices cover the index ranges of both arguments. This did
give us a lot of headache though, and I now think it's a case of
overdesigning).

>
> >- it should all have been derived from valarray (but that wasn't around
yet
> >when I started this project).
>
> No, what you did first seems like the right thing ;->
>

Anyone care to point me to a reference which explains why nobody likes
valarray?

By the way, I also don't agree with the 'STL is 1D' argument to have
iterators by default running over the whole list. I can't give better
arguments than the ones already on the list.

By the way, the only way I can see the 'different dimensions' view' a la
'flattened_array' working is when all data are stored in 1 long list. Then
it's pretty trivial. I'll have to check the code...

Kris

Kris Thielemans
MRC Cyclotron Unit,
Hammersmith Hospital,
DuCane Rd,London W12 0NN, United Kingdom

Phone on : +44 (020)8383 3731
FAX on : +44 (020)8383 2029

NEW web site address:
http://www.cu.mrc.ac.uk/~kris


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk