Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/364.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 成功的f2py-LAPACK调用后转储内核_Python_Numpy_Lapack_F2py - Fatal编程技术网

Python 成功的f2py-LAPACK调用后转储内核

Python 成功的f2py-LAPACK调用后转储内核,python,numpy,lapack,f2py,Python,Numpy,Lapack,F2py,我使用f2py从python调用一个LAPACK例程,即DGEQP3。我首先创建了一个pyf文件,以便创建一个更可用的接口 f2py -h dgeqp3.pyf -m dgeqp3 SRC/dgeqp3.f 此文件现在看起来如下所示: ! -*- f90 -*- ! Note: the context of this file is case sensitive. python module dgeqp3 ! in interface ! in :dgeqp3

我使用f2py从python调用一个LAPACK例程,即DGEQP3。我首先创建了一个pyf文件,以便创建一个更可用的接口

f2py -h dgeqp3.pyf -m dgeqp3 SRC/dgeqp3.f
此文件现在看起来如下所示:

!    -*- f90 -*-
! Note: the context of this file is case sensitive.

python module dgeqp3 ! in 
    interface  ! in :dgeqp3
        subroutine dgeqp3(m,n,a,lda,jpvt,tau,work,lwork,info) ! in :dgeqp3:SRC/dgeqp3.f
            integer :: m
            integer :: n
            double precision dimension(lda,0) :: a
            integer intent(hide),depend(a) :: lda=shape(a,0)
            integer intent(in, out), dimension(n), depend(n) :: jpvt
            double precision intent(out), depend(m), dimension(m),  :: tau
            double precision intent(out), depend(lwork), dimension(lwork) :: work
            integer :: lwork
            integer intent(out) :: info
        end subroutine dgeqp3
    end interface 
end python module dgeqp3
我是这样构建库的:

f2py -c dgeqp3.pyf SRC/dgeqp3.f -lblas -llapack -latlas
我创建了下面的脚本来调用例程,它似乎工作得很完美

import dgeqp3
import numpy as np
print(np.version.version)
A = np.array([1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0])    
jpvt = np.array([0,0,0])
lwork = 10 
j,t,w,i = dgeqp3.dgeqp3(3, 3, A, jpvt, lwork)
然而,就在程序终止之前,我得到了

*** Error in `python': free(): invalid next size (fast): 0x0000000002bb8e60 ***
Aborted (core dumped)

我使用的是numpy版本1.8.2,并在64位Ubuntu14.04内核3.13.0-43-generic上从LAPACK 3.5.0编译了DGEQP3库。可能出了什么问题?

我没有完全解决这个问题,但我发现这个Fortran函数有一个包装器

而且,这个调用只需要输入矩阵作为参数,这非常方便

scipy.linalg.lapack.dgeqp3