Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2008-01-21 15:17:53


Am Montag, 21. Januar 2008 13:55 schrieb Per Abrahamsen:
> A = B1 + B2 + B3 + C1 + C2 + C3
>
> I'd expected the solver to take most of the time, followed by the
> building of the component matrixes (B1..B3 and C1..C3). Not so.
> Everything else is noise compared to the time spend in matrix
> addition. Something like 2 seconds in the solver, 20 seconds
> building the component matrixes, and 3 minutes adding them together.
>
> I tried using different matrix types, everything made the situation
> worse except 1) using dense matrixes, and 2) using temporary
> coordinate matrix and adding the compressed matrixes with this
> function:

Yes - this is true. Ublas still has no optimized compressed_matrix sum
so far. You already found the best solution: use a coordinate matrix
for the assembling and then compress it.

The compressed_matrix can be efficiently constructed from a coordinate
matrix. (see matrix.hpp:2671)

I also experimented with a special assign_temporary which avoided
copying the index and value array. However I found that the time of
(2*nnz) copies can be neglected compared to the time of the sort and
compress step.

mfg
Gunter