dsyevd fails to diagonalize sym matrix/info param acts wierd

Post here if you have a question about LAPACK or ScaLAPACK algorithm or data format

dsyevd fails to diagonalize sym matrix/info param acts wierd

Postby albert0168 » Tue Jan 17, 2012 10:45 pm


I am new to ATLAS and LAPACK. I really like what I see so far in both ATLAS and LAPACK. The problem is that somehow a symmetric matrix is not able to be diagonalized. Also, the info parameter is acting strange.

I first compute a symmetric matrix S=Y^tY with the ATLAS cblas_dsyrk and store it in lower half of S which is DxD. I then use LAPACK's dsyevd which I define as shown in the code below to conform to the fortran parameter passing since I will be using the fortran library, not clapack.

I compile with:
Code: Select all
gcc -c file.c -I<path to atlas/include/cblas.h>
gcc -o file.o -L<path to atlas/lib> -llapack -lf77blas -lcblas -latlas -lgfortran

Note: Using atlas-3.8.4 and lapack-3.4.0. I built the lapack library by building the incomplete ATLAS liblapack.a, then the LAPACK version and combining the librarys with good old 'ar'. This was also suggested as the way to do things in the ATLAS user guide.

I check the info parameter and it is some very large positive number. Since it is not zero that means that a submatrix of the tridiagonal form was not able to be factored. This is a problem since all real finite dim symetric matrices can be diagonalized.

Then I set info=0 before hand and it returns info=0 at which point I find that several eigen values are negative, another falsehood.

I am not sure where the problem is coming from. I suspect that it may something to do with interfacing C with fortran since I am new to this. I find it strange that info does not seem to be modified by dsyevd.

Code: Select all
#include <cblas.h>

/* define dsyevd */
void dsyevd_ (char *jobz, \
char * upon, \
long * n, \
double * A, \
long * lda, \
double * W, \
double * work, \
long * lwork, \
long * iwork, \
long * liwork, \
long * info);

/* define/malloc D, work, iwork, D_S, Y, S */

cblas_dsyrk (CblasColMajor, \
CblasLower, \
D, \
1, \
alpha, \
Y, \
D, \
0., \
S, \

/*long info; uninitialized*/
long info = 0; /*initialized to zero*/
long query = -1;
char jobz = 'V';
char uplo = 'L';

dsyevd_ (&jobz, \
&uplo, \
&D, \
S, \
&D, \
D_S, \
work, \
&query, \
iwork, \
&query, \

/*find D_S[0] = -0.000000000000004323 < 0 no matter what info is returned as*/
Posts: 1
Joined: Tue Jan 17, 2012 9:35 pm

Re: dsyevd fails to diagonalize sym matrix/info param acts w

Postby admin » Wed Jan 18, 2012 1:50 pm

Hi Albert,
you should take a look at the following LAPACK examples to get started.
http://software.intel.com/sites/product ... dsyevd.htm
MKL and NAG are Optimized LAPACK Libraries developed by INTEL and NAG.

The query with -1 is just to get the workspace size, it does not make actual computation.
Site Admin
Posts: 612
Joined: Wed Dec 08, 2004 7:07 pm

Return to Algorithm / Data

Who is online

Users browsing this forum: No registered users and 3 guests