test_matev_c.f90 1.02 KB
program test_matev
use fvn_linear
implicit none
complex(8),dimension(3,3) :: a
real(8),dimension(3,3) :: ra,ia
complex(8),dimension(3) :: evala
complex(8),dimension(3,3) :: eveca
integer :: status,i,j

call init_random_seed()
call random_number(ra)
call random_number(ia)
a=ra+fvn_i*ia
a=a*100
call fvn_matev(3,a,evala,eveca,status)

write(*,*) "The matrix :"
write (*,'(3("(",e12.5,",",e12.5,")"))') a
write (*,*)
do i=1,3
  write(*,'("Eigenvalue ",I3," : (",e12.5,",",e12.5,")  ")') i,evala(i)
  write(*,'("Modulus : ",e12.5)') abs(evala(i))
  write(*,*) "Associated Eigenvector :"
  do j=1,3
    write(*,'("(",e12.5,",",e12.5,")  ")') eveca(j,i)  
  end do
  write(*,*)
end do

! tri
write(*,*) "With sort option"
call fvn_matev(3,a,evala,eveca,status,.true.)
do i=1,3
  write(*,'("Eigenvalue ",I3," : (",e12.5,",",e12.5,")  ")') i,evala(i)
  write(*,'("Modulus : ",e12.5)') abs(evala(i))
  write(*,*) "Associated Eigenvector :"
  do j=1,3
    write(*,'("(",e12.5,",",e12.5,")  ")') eveca(j,i)  
  end do
  write(*,*)
end do


end program