Hi,
I am new to using fortran. In my work I need to calculate the eigenvalues and eigenvectors of various matrices. Sometimes they have complex eigenvectors sometimes real. You can find my simple code that calculates a simple example of 2*2 matrix's eigenvectors and eigenvalues. They are supposed to be complex, however, I do not get complex eigenvectors. Can you please let me know what I am doing wrong.
Thank you
(please do not worry about the extra inputs. This is actually a part of a bigger code)
program sec
implicit none
real(8),dimension,,allocatable :,EigVecint
real(8),dimension),allocatable ::WORK, EigValintr,EigValinti
integer :: INFO, Nz,i,j
CHARACTER (LEN=100):: D2intmat, InvD2intmat, EigValintmat, D2eigintmat,cornerinvmat, cornermat
CHARACTER (LEN=100) :: D2intcolmat, D2introwmat, EigVecintmat
allocate (D(2,2), EigValintr(2), EigValinti(2), EigVecint(2,2), WORK(4*(2)))
Nz=3
D(1,1)=3
D(2,1)=4
D(1,2)=-2
D(2,2)=-1
cornermat='cornermat'
OPEN(16,FILE=cornermat)
DO i=1,2
WRITE(16,*) (D(i,j),j=1,2)
ENDDO
CLOSE(16)
CALL DGEEV('N','V',2,D,2,EigValintr,EigValinti,EigVecint,2,EigVecint,Nz-1,WORK,4*(2),INFO)
EigValintmat='EigValintmat'
OPEN(21,FILE=EigValintmat)
DO i=1,Nz-1
WRITE(21,*)i,EigValintr(i),EigValinti(i)
ENDDO
CLOSE(21)
EigVecintmat='EigVecintmat'
OPEN(22,FILE=EigVecintmat)
DO i=1,Nz-1
WRITE(22,*) (EigVecint(i,j),j=1,Nz-1)
ENDDO
CLOSE(22)
end program sec
I am new to using fortran. In my work I need to calculate the eigenvalues and eigenvectors of various matrices. Sometimes they have complex eigenvectors sometimes real. You can find my simple code that calculates a simple example of 2*2 matrix's eigenvectors and eigenvalues. They are supposed to be complex, however, I do not get complex eigenvectors. Can you please let me know what I am doing wrong.
Thank you
(please do not worry about the extra inputs. This is actually a part of a bigger code)
program sec
implicit none
real(8),dimension,,allocatable :,EigVecint
real(8),dimension),allocatable ::WORK, EigValintr,EigValinti
integer :: INFO, Nz,i,j
CHARACTER (LEN=100):: D2intmat, InvD2intmat, EigValintmat, D2eigintmat,cornerinvmat, cornermat
CHARACTER (LEN=100) :: D2intcolmat, D2introwmat, EigVecintmat
allocate (D(2,2), EigValintr(2), EigValinti(2), EigVecint(2,2), WORK(4*(2)))
Nz=3
D(1,1)=3
D(2,1)=4
D(1,2)=-2
D(2,2)=-1
cornermat='cornermat'
OPEN(16,FILE=cornermat)
DO i=1,2
WRITE(16,*) (D(i,j),j=1,2)
ENDDO
CLOSE(16)
CALL DGEEV('N','V',2,D,2,EigValintr,EigValinti,EigVecint,2,EigVecint,Nz-1,WORK,4*(2),INFO)
EigValintmat='EigValintmat'
OPEN(21,FILE=EigValintmat)
DO i=1,Nz-1
WRITE(21,*)i,EigValintr(i),EigValinti(i)
ENDDO
CLOSE(21)
EigVecintmat='EigVecintmat'
OPEN(22,FILE=EigVecintmat)
DO i=1,Nz-1
WRITE(22,*) (EigVecint(i,j),j=1,Nz-1)
ENDDO
CLOSE(22)
end program sec