LAPACK Archives

[Lapack] Different Eigenvalues

HI,

I'm trying to compute the eigenvalues and eigenvectors of a complex hermitean 
matrix and noticed that I seem to get different answers depending on if I call 
zheevx with UPLO='U' or UPLO='L'. Sometimes both runs give the wrong answer, 
i.e. eigenvectors are not orthonormal, sometimes just one of them is wrong. The 
eigenvalues are always correct. I normally don't program in Fortran, so maybe 
I'm doing something wrong with my errors.
I posted an example-code below. It would be great, if you can give me some 
hints. I really need to get this working.  Thx a lot!!!
Oh, I compiled with:   g77 -o code code.f -L/usr/local/lib -llapack -lblas



      PROGRAM test_lapack
      INTEGER :: i,j,k
      COMPLEX*16 Im,test
      COMPLEX*16 fortran_array (8,8), WORK(264), evec(8,8)
      DOUBLE PRECISION :: ABSTOL, VL, VU, RWORK(56), eval(8)
      INTEGER :: row, column,column2
      INTEGER :: IL, INFO, IU, LWORK, M,N, LDA
      INTEGER :: IFAIL(8), IWORK(40)
      N=8
      VL=0.
      VU=1.
      IL=0
      IU=1
      ABSTOL=2*DLAMCH('S')
      M=8
      Im =(0.,1.)
      LWORK=264
      LDA = 8;

      fortran_array(1,1)=-56.
      fortran_array(2,1)= (0.,1.)
      fortran_array(3,1)= 0.
      fortran_array(4,1)= 0.
      fortran_array(5,1)= 0.
      fortran_array(6,1)= 0.
      fortran_array(7,1)= -1. 
      fortran_array(8,1)= 0.

      fortran_array(1,2)= (0.,-1.)
      fortran_array(2,2)=-15.
      fortran_array(3,2)= 0.
      fortran_array(4,2)= 0.
      fortran_array(5,2)= 0.
      fortran_array(6,2)= 0.
      fortran_array(7,2)= 0.
      fortran_array(8,2)= 0.

      fortran_array(1,3)= 0.
      fortran_array(2,3)= 0.
      fortran_array(3,3)=-46.
      fortran_array(4,3)= (0.,17.)
      fortran_array(5,3)= -1. 
      fortran_array(6,3)= 0.
      fortran_array(7,3)= 0.
      fortran_array(8,3)= 0.

      fortran_array(1,4)= 0.
      fortran_array(2,4)= 0.
      fortran_array(3,4)= (0.,-17.)
      fortran_array(4,4)=-25.
      fortran_array(5,4)= 0. 
      fortran_array(6,4)= 0.
      fortran_array(7,4)= 0.
      fortran_array(8,4)= 0.

      fortran_array(1,5)= 0.
      fortran_array(2,5)= 0.
      fortran_array(3,5)= -1. 
      fortran_array(4,5)= 0.
      fortran_array(5,5)=-26.
      fortran_array(6,5)= 0.
      fortran_array(7,5)= 0.
      fortran_array(8,5)= 0.

      fortran_array(1,6)= 0.
      fortran_array(2,6)= 0.
      fortran_array(3,6)= 0. 
      fortran_array(4,6)= 0.
      fortran_array(5,6)= 0.
      fortran_array(6,6)=-5.
      fortran_array(7,6)= 0.
      fortran_array(8,6)= 0.

      fortran_array(1,7)= -1.; 
      fortran_array(2,7)= 0.
      fortran_array(3,7)= 0. 
      fortran_array(4,7)= 0.
      fortran_array(5,7)= 0.
      fortran_array(6,7)= 0.
      fortran_array(7,7)=-16.
      fortran_array(8,7)= (0.,3.)

      fortran_array(1,8)= 0.
      fortran_array(2,8)= 0.
      fortran_array(3,8)= 0. 
      fortran_array(4,8)= 0.
      fortran_array(5,8)= 0.
      fortran_array(6,8)= 0.
      fortran_array(7,8)= (0.,-3.)
      fortran_array(8,8)=-35.
    
!      DO column=1,8
!         DO row=1,8
!            WRITE (*,*) fortran_array(row,column),
!     2                  fortran_array(column,row) 
!            END DO
!         END DO
      PRINT *,N
      CALL zheevx('v','a','U',N,fortran_array,LDA,VL,VU,IL,IU,ABSTOL,M,
     2             eval,evec, N, WORK,LWORK,RWORK,IWORK,isuppz,info)

      Print *,WORK(1)

!      DO i=1,8
!         WRITE (*,*) eval(i)
!      END DO

!      DO column=1,8
!         DO row=1,8
!            WRITE (*,*) column,row,eval(column),evec(row,column)
!         END DO
!      END DO

!      DO column=1,8   
!         DO column2=1,8
!            test=(0.,0.)
!            DO row=1,8
!               test=test+evec(column,row)*evec(column2,row)
!            END DO
!            WRITE (*,*) column,column2,ABS(test)
!         END DO
!      END DO

      STOP
      END


Ines



-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://lists.cs.utk.edu/private/lapack/attachments/20071023/527a1329/attachment.html
 

<Prev in Thread] Current Thread [Next in Thread>
  • [Lapack] Different Eigenvalues, Waldmueller, Ines <=


For additional information you may use the LAPACK/ScaLAPACK Forum.
Or one of the mailing lists, or