Boost logo

Ublas :

From: Vassilis Virvilis (vasvir_at_[hidden])
Date: 2006-06-29 09:17:44

Gunter Winkler wrote:
> Because preserving data usually makes no sense in numerical applications.

Usually yes. But in my case we are reading from file and we can't tell from
the start the vectors' size. It is very convenient to be able to resize
a sparse vector dynamically preserving the data.

> 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.

Not for sparse data.

> 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) ...

I understand in case of matrices the problem is much difficult but
for vectors I don't see why to depart from std::vector
resize behavior as it is implemented in the other sparse vectors
(mapped and coordinate).

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