I am writing a code on Fortran via the ubuntu terminal. I've used LAPACK dgeev subroutine, but there is an error. I've tried to install lapack, but it seems issue somewhere else
/usr/bin/ld: /tmp/cc8TsQMm.o: in function
MAIN__': main.f95:(.text+0xc46): undefined reference todgeev_' /usr/bin/ld: main.f95:(.text+0xe54): undefined reference to `dgeev_' collect2: error: ld returned 1 exit status
Code is below:
program matrix
implicit none
integer :: n, i, j, info, end_file
complex :: eig_val
double precision , allocatable :: a(:,:), wr(:), wi(:), vr(:,:), work(:)
double precision:: dummy(1,1)
intrinsic :: cmplx, max,nint
n = 0
open (unit =1, file = "matrix.txt")
do
read(1, *, iostat = end_file)
IF (end_file /= 0) EXIT
n = n + 1
end do
Allocate(a(n,n), vr(n,n), wr(n), wi(n))
Rewind(1)
Read(1,*) a
a = transpose(a)
Call dgeev('N', 'V', n, a, n, wr, wi, dummy, 1, vr, n, dummy, -1, info)
lwork = max((64+2)*n, nint(dummy(1,1)))
allocate(work(lwork))
Call dgeev('N', 'V', n, a, n, wr, wi, dummy,1, vr, n, work, lwork, info)
do j = 1,n
eig_val = complex (wr(j), wi(j))
Write(*,*) "Eigenvalue", j, ":", eig_val
Write(*,*) " Its eigenvector: [", vr(j,:), "]"
end do
end program