Boost logo

Boost :

From: Mike Tegtmeyer (tegtmeye_at_[hidden])
Date: 2007-06-18 12:29:28


All,

An updated version of cvalarray has been posted to the vault. Although the
original purpose was to mimic std::valarray as much as possible, features
that address the criticism of std::valarray in issue 93 (and others) of
the c++ working groups have been added. Since there are few specifics in
this area, it would be nice to hear the community weigh in on some of the
design decisions. In no particular order:

- non-member operations on cslice_array and cindirect_array are now
defined: ie

res[cslice<0,4,3>()] = (foo[cslice<1,4,3>()] * bar[cslice<2,4,3>()]);

expression templates are used to eliminate temporaries and operations are
unrolled for small N

- operator[] is defined for both cslice_array and cindirect_array. Not so
sure about this one. I can see a valid use case (computed indirect
indices) but if the purpose of std::slice_array and std::indirect_array is
to be transparent to the user, this is directly a violation of that. I can
go either way if folks don't like it.

- member computed assignment for cslice_array and cindirect array are
added for all: ie

T foo[N] = {...};
cvalarray<T,2*N> bar;

bar[cslice<1,N,2>()] += foo;

In addition it is now possible to have a computed assignment of another
cslice_array or cindirect_array: ie

foo[cslice<1,2,3>()] += bar[cslice<3,2,1>()];

or

cvalarry<size_t,2> indirect;
foo[cslice<1,2,3>()] += bar[indirect];

expression templates are used to eliminate temporaries and operations are
unrolled for small N

- transcendental operations are now defined for cslice_array and
cindirect_array: ie

cvalarray<float,10> foo = cos(bar[cslice<2,10,3>()]);

does not result in an unnecessary temporary creation.

The documentation and test cases have been updated for the above changes.

Mike


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