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
/* 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, \
/*long info; uninitialized*/
long info = 0; /*initialized to zero*/
long query = -1;
char jobz = 'V';
char uplo = 'L';
dsyevd_ (&jobz, \
/*find D_S = -0.000000000000004323 < 0 no matter what info is returned as*/