|
Ublas : |
Subject: Re: [ublas] fixed size vector in boost::numeric::ublas?
From: Jesse Perla (jesseperla_at_[hidden])
Date: 2010-08-04 11:51:12
Nasos Iliopoulos <nasos_i <at> hotmail.com> writes:
> Me neither, I don't see any benefits (size and performance wise) using the bounded types. Unless we are talking about some exotically specialised requirements
> I don't find they should be around. If the fixed containers are in I also > believe that the new documentation should spend the least amount of lines on them as they are very confusing to the beginners. What do other people think?
Agreed. Especially with move semantics, which the bounded vector
can't benefit from (to my knowledge). Deprecate it in a few versions.
And I like the name fixed_vector with simplified documentation.
But let me make another plea for keeping resize(). The precondition
of the same size can be documented easily, and it will make life much
easier for generic programming... I have come across this multiple
times.
For example, I have a generic polynomial (parameterized based on
vector type of storage) which you can get the derivative of.
Naturally, it needs to drop a point in the size of the vector when
returning the derivative polynomial... So I have to create a new
vector (which is the identical ublas::vector<double> type vs.
ublas::c_vector<double, N-1> type if statically allocated. Then I
have to call the .resize(N-1) to make sure that the dynamic vector is
properly allocated (while the c_vector is already allocated and this
causes no harm)..... am not saying this is the best way to do it,
just that getting rid of the resize() interface would make my life
difficult in many places and cause meta-programming grief otherwise.
-Jesse