Boost logo

Ublas :

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

Am Montag, 21. Januar 2008 13:55 schrieb Per Abrahamsen:
> A = B1 + B2 + B3 + C1 + C2 + C3

> Both approaches put the time spend in the addition (and converting to
> compressed) down to 1 minute. Still, three times as much time spend
> on addition than on building the component matrixes. Any suggestions
> for how to improve on this?

Sparse addition is usually done in two steps (see cxsparse addition):
1) symbolic sum (count row lengths, estimate size of result, compute
2) actual sum (lookups into a fixed structure are fast, structure
changes are expensive)

Another solution is to use an iterative solver and use a custom axpy
which computes the products one by one

y = Ax = (B1+B2+B3) x + C1 x + ...