Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2005-04-25 07:29:26


Hello,

I was looking for an ublas expression, to compute

y += D * A * x;

where D is a diagonal matrix (stored in a vector of the diagonal elements of
D) and A is a sparse matrix.

In banded.hpp I found the (still to document) diagonal_matrix and
diagonal_adaptor types which are special banded matrices (with lower and
upper bandwidth equal to zero).
Using these types with prod(D,A) is not optimal, since it uses the most
complicated available prod: (sparse = sparse * sparse).

Should we introduce a new matrix proxy? Something like
DA := scaled_matrix(D, A)
where D is a vector and A a matrix. DA(i,j) would evaluate to D(i)*A(i,j) and
could reuse all iterators of A. The proxy should be usable (and optimizeable)
by axpy_prod, too.

mfg
Gunter