1
我想使用gnu库中的插值函数可以有人建议我,我该怎么做。这是我一直在尝试。cython-gsl库包装
import numpy as np
cdef extern from "gsl/gsl_spline.h":
int gsl_spline_init(gsl_spline * spline, const double xa[], const double ya[], size_t size)
def cs(gsl_spline * spline,xa = np.ndarray(double_t ,ndim=1) ,ya = np.ndarray(double_t ,ndim=1) , int size):
s = gsl_spline_init(gsl_spline * spline, dnp.ndarray(double_t ,ndim=1) xa, np.ndarray(double_t ,ndim=1) ya, int size)
return s
但虽然构建文件,我得到以下错误。
def cs(gsl_spline * spline,xa = np.ndarray(double_t ,ndim=1) ,ya = np.ndarray(double_t ,ndim=1) , int size):
s = gsl_spline_init(gsl_spline * spline, dnp.ndarray(double_t ,ndim=1) xa, np.ndarray(double_t ,ndim=1) ya, int size) ^
testone.pyx:14:75: Expected ')', found 'xa'
building 'pang' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/home/sulabh/.local/lib/python2.7/site-packages/numpy/core/include -I/home/sulabh/include/ -I/usr/include/python2.7 -c testone.c -o build/temp.linux-x86_64-2.7/testone.o
testone.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
error: command 'gcc' failed with exit status 1
感谢提供的信息@Ian – 2014-11-05 15:02:53