BLAS 및 LAPACK의 Fortran 작동 방식 등을 이해하려고하므로 행렬을 생성하고 반전하는 코드를 작성했습니다.LAPACK 및 BLAS 서브 루틴에 대한 정의되지 않은 참조
여기에 내가 전화 한 파일에서 행렬 A는 코드
program test
Implicit none
external ZGETRF
external ZGETRI
integer ::M
complex*16,allocatable,dimension(:,:)::A
complex*16,allocatable,dimension(:)::WORK
integer,allocatable,dimension(:)::IPIV
integer i,j,info,error
Print*, 'Enter size of the matrix'
Read*, M
Print*, 'Enter file of the matrix'
READ(*,*), A
OPEN(UNIT=10,FILE = '(/A/)' ,STATUS='OLD',ACTION='READ')
allocate(A(M,M),WORK(M),IPIV(M),stat=error)
if (error.ne.0)then
print *,"error:not enough memory"
stop
end if
!definition of the test matrix A
do i=1,M
do j=1,M
if(j.eq.i)then
A(i,j)=(1,0)
else
A(i,j)=0
end if
end do
end do
call ZGETRF(M,M,A,M,IPIV,info)
if(info .eq. 0) then
write(*,*)"succeded"
else
write(*,*)"failed"
end if
call ZGETRI(M,A,M,IPIV,WORK,M,info)
if(info .eq. 0) then
write(*,*)"succeded"
else
write(*,*)"failed"
end if
deallocate(A,IPIV,WORK,stat=error)
if (error.ne.0)then
print *,"error:fail to release"
stop
end if
close (10)
end program test
, 그리고 또한 내가 매트릭스 (M)의 크기를 말한다. 내가 gfortran 그들을 copile 때 나는이 메시지를받을
/tmp/ccVkb1zY.o: In function
MAIN__': test.f03:(.text+0x751): undefined reference to
zgetrf_' test.f03:(.text+0x85d): undefined reference to `zgetri_' collect2: error: ld returned 1 exit status
내가 BLAS 설치 및 LAPACK 내가 올바른 방법 도서관에서 전화를했는지 모르겠 그래서 설치.
의견이 있으십니까?
당신이 컴파일 명령을 줄 수 있습니까? – ztik
아니, 할 수 없었다. 컴파일하려고 할 때 오류가 발생했습니다 – Daniel
[gfortran LAPACK "정의되지 않은 참조"오류 (https://stackoverflow.com/questions/20669410/gfortran-lapack-undefined-reference-error)의 가능한 복제본 –