Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2006-07-05 05:55:52


On Wednesday 05 July 2006 11:08, Nico Galoppo wrote:
> Therefore, I changed my code to fill a temporary
> ublas::generalized_vector_of_vector< real_type, row_major,
> ublas::vector<compressed_vector<real_type> > > first, then assigning to the
> compressed_matrix as such: C.assign(tmp);
>
> The fill time has improved from 150s (compressed_matrix) to 0.9 s (fill of
> vector_of_vector) + 29 s (assignment).
>
> I was wondering if there may be an even faster way.

The fastest way is to precompute the sparsity pattern and prepare a compressed
matrix with it. In my programs I now use a coordinate matrix which is a good
compromise between speed of insertion (using +=), storage requirement and
multiplication speed. Maybe you can speed up the insertion a little if you
modify the constructor of gvov to pass the number of non_zeroes to the
constructor of vector_data_value_type (=compressed vector). Unfortunately,
this cannot be done in general because non_zeroes is not part of the general
vector concept.

mfg
Gunter