Page 1 of 1

LAPACKE_zheevx: How to set ABSTOL=2*DLAMCH('S') in C++

PostPosted: Wed Aug 17, 2016 4:53 pm
by Boris_MV
This is a question about setting proper tolerance ("abstol") for convergence of eigenvalue calculation with LAPACKE_zheevx() function in C++.

When LAPACKE_zheev() fails to converge when calculating eigenvalues/eigenvectors with the default value of "abstol" (i.e. abstol=-1), the LAPACK manual says to set abstol=2*DLAMCH('S'). However, DLAMCH is Fortran function and I use C++ which does not recognize it as a valid C++ function. Could anyone please help me how to properly set "abstol=2*DLAMCH('S')" when using LAPACK with C++ (i.e. when using LAPACKE)?

Thanks very much in advance!!

Re: LAPACKE_zheevx: How to set ABSTOL=2*DLAMCH('S') in C++

PostPosted: Thu Aug 18, 2016 4:57 am
by Julien Langou
Hi Boris,

LAMCH is in LAPACKE so to set ABSTOL=2*DLAMCH('S'), one can use the C LAPACKE wrapper:
Code: Select all
double LAPACKE_dlamch( char cmach );

from C++.

If this does not work, then I would suggest to set ABSTOL to 5e-16 (for double precision) and give it a try.

Cheers,
Julien.

Re: LAPACKE_zheevx: How to set ABSTOL=2*DLAMCH('S') in C++

PostPosted: Thu Aug 18, 2016 1:53 pm
by Boris_MV
Thanks for the reply. I will try it and will post my finidngs.