Boost logo

Ublas :

Subject: Re: [ublas] prod function usage
From: Umut Tabak (u.tabak_at_[hidden])
Date: 2011-05-20 09:48:37


On 05/20/2011 02:46 PM, Ungermann, Jörn wrote:
> Hi Umut,
>
> first off, do not use "prod" for this kind of product, but use axpy_prod
> instead. This will be quite a bit faster.
> However, you shouldn't get a segmentation fault either way.
> It's hard to second-guess the root cause, but from my experience, you either
> have sized either vector or the matrix wrong (happens surprisingly often, at
> least to myself), or you may have went wrong somewhere in the construction
> of the compressed_matrix. If you use, e.g., push_back for the construction,
> you can wreak some havoc with its internal data structure.
> If you have set neither of
> #define BOOST_UBLAS_NDEBUG 1
> #define BOOST_DISABLE_ASSERTS 1
> such errors should be detected, however.
>
> Kind Regards,
> Jörn
Ok I guess I located the source of the problem, how should I conduct an
operation like,

A = A - shift * B;

efficiently in ublas where A and B are compressed_matrix<double> and
shift is a scalar.

Thanks
Umut