Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2007-03-12 04:15:11


On Monday 12 March 2007 08:50, Preben Hagh Strunge Holm wrote:
> How can the "dense product difference" be measured without
> multiplication like dense?
> And why is the result not exactly the same?
>
> Multiplication of a dense matrix with a lot of members exactly 0
> compared to a compressed matrix?

Yes. There are a lot of these "structure checks" in ublas. They always compare
the results of a slow, known to be working algorithm with the results of
the "optimal" algorithm. (This is one reason because the debug version of
ublas is much slower than the release version.) These checks were implemented
in order to catch internal errors and misuse of functions. Unfortunately they
sometimes throw on legal code which is close to misuse.

> dGv is actually supposed to be very small! Actually this is a measure of
> the error!
>
> This is really a strange "error" for me since the product of a matrix
> and a vector should be able to be anything!

Yes. But if the input data has only a few significant bits, the _order_ of
computation heavily influences the result. This is a situtation which should
be avoided and thus the error is thrown. I think the error message should be
modified to express this.

> And why is the problem not present running without optimization and a
> problem when using optimization!

This may be because the order of computations might be different for different
compiler options (try to force IEEE float arithmetic to check this). However,
the error should not appear when compiling with -DNDEBUG.

mfg
Gunter