Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2006-06-29 04:29:03

On Wednesday 28 June 2006 19:46, Vassilis Virvilis wrote:

> By looking at sparse_vector.hpp one can see the compressed_vector::resize()
> is not implemented for the preserving case. How difficult is this to be
> implemented? Looks easy enough but then why it hasn't been implemented so
> far?

Because preserving data usually makes no sense in numerical applications. This
flag has been introduced long time ago, but we decided to not fully support
preserving resize in all classes. It can be much better implemented as a free
function that knows which and how to transfer the data from old to new
storage. If you just want a container which can grow and shrink arbitrarily
std::vector is much more efficient.

BTW, for sparse vectors it is easy to decide which elements can be preserved.
But for dense matrix you have different choices: throw away some
rows/columns, create zero filled new columns, reorder matrix entries
(=reshape) ...


PS: please subscribe if you want to post to this list. Otherwise your messages
could be discarded together with all the daily spam ...