Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2007-03-05 16:12:49

Preben Hagh Strunge Holm schrieb:
> Probably this could be optimized a bit more:
> ------
> ublas::vector<double> T(Msize);
> for (unsigned int i = 0; i < Msize; ++i) {
> T(i) = inner_prod(prod(ddG[i], v), v);
> }
> ------
This is already good code.
> If the result of prod(ddG[i], v) is a sparse vector as well the
> operations are 10x10x10x72 = 72.000 floating points operations instead
> of 518.400!
> What happens in the multiplication above?
AFAIK the product can be sparse - but it may be dense with the current
implementation. You should check whether compressed_matrix performs
better or worse than mapped_vector_of_mapped_vector. If you really want
maximal performance you have to write a custom version of inner_prod(
prod(A, v), v ) as it was done for " y += prod(A,x) " in operation.hpp.

PS: There have been some bugs with the product/assignement of mvomv
which should be fixed in the current CVS head but not in the boost
1.33.x release.