我是fortran的新手,正在尝试使用DGESV解决一组线性方程。我试图让最简单的程序只是为了让方法运行,但是收到此错误消息:
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
Backtrace for this error:
#0 0x106cef092
#1 0x106cee3b0
#2 0x7fff8dda9f19
Segmentation fault: 11
以下是代码:
program linearEqSolver
implicit none
EXTERNAL DGESV
integer, parameter :: N = 3, NRHS = 1, LDA = N,LDB = N
integer :: INFO
real, dimension (N) :: IPIV, b
real, dimension (N,N) :: A
b = (/ 4, -6, 7/)
A(:,1) = (/ 1, 1, -1/)
A(:,2) = (/ 1, -2, 3/)
A(:,3) = (/ 2, 3, 1/)
CALL DGESV( N, NRHS, A, LDA, IPIV, B, LDB, INFO )
end program