从LAPACK调用DGESV时出现分段错误

时间:2019-02-24 03:25:51

标签: fortran lapack

我正在使用LAPACK运行我的第一个代码。而且我不明白为什么会出现错误。这是我的代码:

Program LinearEquations
    ! solving the matrix equation a*x=b using LAPACK
    Implicit none

    integer :: info
    integer,dimension(2) :: x

    real, dimension(2,2) :: a
    real, dimension(2) :: b

    a(1,:)=((/1,2/))
    a(2,:)=((/3,4/))
    b=((/4,10/))

    call dgesv(2, 1, a, 2, x, b, 2, info)

end program LinearEquations

我将其编译并运行:

gfortran -o test1.exe test1.f90 -lblas -llapack 

./test1.exe

它给了我

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
test1.sh: line 6:  4317 Segmentation fault      (core dumped) ./test1.exe

0 个答案:

没有答案