Boost logo

Ublas :

Subject: [ublas] ublas double precision issues
From: Umut Tabak (u.tabak_at_[hidden])
Date: 2011-06-13 08:11:32

Dear all,

I have implemented a lanczos solver in ublas, however there is a subtle
question from the point of view of accuracy related to floating point

My solver works fine and I could find the eigenvalues and eigenvectors
however comparing the eigenvalues that are found by the rayleigh
coefficients, and that is

\frac{\Phi^T K \Phi}{\Phi^T M \Phi},

for a generalized problem gives different result well on the first
eigenvalues on the order of 1e-5 relative error.

I compute them with the computed vectors (these are also computed by
some matrix-vector multiplications using axpy_prod inside the solver) by

     axpy_prod(Mss, Phi_str[k], Mq, true);
     axpy_prod(Kss, Phi_str[k], Kq, true);
     cout << inner_prod( Phi_str[k], Kq ) /inner_prod( Phi_str[k], Mq )
<< endl;

I would expect that the differences between these two computed values to
be small, because in theory they should be equal. 1e-5 error is not that
small still. Moreover the errors increases at higher eigenvalues and
vectors. I guess this is an internal problem with the operations used in

Is there a general way to increase accuracy of the general floating
point operations in boost? Is there a define macro that I should use or so?

Best regards,


If I have a thousand ideas and only one turns out to be good,
I am satisfied.
Alfred Nobel