The LAPACK forum has moved to https://github.com/Reference-LAPACK/lapack/discussions.

using zgeev

Open discussion regarding features, bugs, issues, vendors, etc.

using zgeev

Postby raad » Mon Jun 30, 2008 7:02 am

Hello,

I have installed lapack.3.1.1 with g77 compiler which I wanted to use for calculating eigenvectors and eigenvalues of general complex matrix. I test the zgeev with the following simple code:

program test
COMPLEX W(4),WORK(2*4)
REAL RWORK(2*4)
COMPLEX VR(4,4),VL(1,1)
COMPLEX D(4,4)

N1=4;
C
D(1,1)=(1.0,0.0)
D(1,2)=(0.0,0.0)
D(1,3)=(0.0,0.0)
D(1,4)=(0.0,0.0)
D(2,1)=(0.0,0.0)
D(2,2)=(1.0,0.0)
D(2,3)=(0.0,0.0)
D(2,4)=(0.0,0.0)
D(3,1)=(0.0,0.0)
D(3,2)=(0.0,0.0)
D(3,3)=(1.0,0.0)
D(3,4)=(0.0,0.0)
D(4,1)=(0.0,0.0)
D(4,2)=(0.0,0.0)
D(4,3)=(0.0,0.0)
D(4,4)=(1.0,0.0)
C
C
CALL ZGEEV('N','V',N1,D,N1,W,VL,1,VR,N1,WORK,N1*2,RWORK,INFO)
C
DO 1 ii=1,N1,1
DO 2 jj=1,N1,1
WRITE(*,*)'VR(',ii,',',jj,')'
WRITE(*,*)VR(ii,jj)
2 CONTINUE
1 CONTINUE
C
C
DO 3 jj=1,N1,1
WRITE(*,*)'W(',jj,')'
WRITE(*,*)W(jj)
3 CONTINUE

END PROGRAM test

Compiling with
g77 test.f -L. -llapack -lblas
the eigenvectors and eigenvalues I got, were:

VR( 1, 1)
(0.,NAN)
VR( 1, 2)
(0.,NAN)
VR( 1, 3)
(0.,0.)
VR( 1, 4)
(0.,0.)
VR( 2, 1)
(0.,NAN)
VR( 2, 2)
(0.,NAN)
VR( 2, 3)
(0.,0.)
VR( 2, 4)
(0.,0.)
VR( 3, 1)
(0.,NAN)
VR( 3, 2)
(0.,NAN)
VR( 3, 3)
(-6.22660855E-16,-0.0352373123)
VR( 3, 4)
(0.,1.875)
VR( 4, 1)
(0.,NAN)
VR( 4, 2)
(0.,0.)
VR( 4, 3)
(-3.77885392E+21,-0.000673946226)
VR( 4, 4)
(0.,0.)

W( 1)
(0.,0.)
W( 2)
(0.,0.)
W( 3)
(0.,0.)
W( 4)
(0.,0.)

I have no idea why the results are so incredibly wrong! 8|
Can anyone help me?

R.
raad
 
Posts: 4
Joined: Mon Jun 30, 2008 6:37 am

Postby sven » Mon Jun 30, 2008 1:42 pm

You need to declare your complex variables as COMPLEX*16, or alternatively call CGEEV if you really do want to use single precision.

Sven Hammarling.
sven
 
Posts: 146
Joined: Wed Dec 22, 2004 4:28 am

Postby raad » Mon Jun 30, 2008 4:04 pm

The problem is solved. Many thanks for the reply. :)
raad
 
Posts: 4
Joined: Mon Jun 30, 2008 6:37 am


Return to User Discussion

Who is online

Users browsing this forum: No registered users and 4 guests