[f2py] netlib spline source compilation

pearu at cens.ioc.ee pearu at cens.ioc.ee
Tue Feb 22 23:44:27 EET 2005


On Tue, 22 Feb 2005, Jean-Michel Philippe wrote:

> pearu at cens.ioc.ee a écrit :
> > Scipy has double precision dierckx under interpolate/fitpack.
> > At the moment it has only handwritten wrappers but that should
> > changed to f2py generated ones in future.
> 
> I saw some dierckx routines in scipy/interpolate/fitpack but not all of 
> them seem to be wrapped. Especially those concerning closed curves and 
> convexity constrained fitting. But if this is handwritten wrappers I 
> understand.
> Why isn't this f2py generated wrappers? Historical reasons or f2py known 
> limitations?

This is purely for historical reasons. In future fitpack will be wrapped
with f2py.


> > Could you give some specific examples of the not working cases?
> 
> I attached a Python sample script and the library is supposed to be 
> created by running 'f2py -c *.f -m fitpack' (this is a > 1Mo *.so 
> file...). The result in a console is:
> 
> ==========================
> 
> ir3331 at jm-philippe:~/splines $ python sample.py
> *** fitpack.curfit
> knots = [  0.    0.    0.    0.    9.9  19.8  29.7  39.6  49.5  59.4 
> 69.3  79.2  89.1
>           99.   99.   99.   99. ]
> coeffs = [-0.0710063  -0.04212754  0.44071415  0.03069734  0.75498194 
> 0.5086273
>        -0.24081355 -0.26763538 -0.3862184   0.4228628  -0.52170616 
> 0.38497531
>        -0.58779585  0.          0.          0.          0.        ]
> *** fitpack.percur
> knots = [  0.    0.    0.    0.    9.9  19.8  29.7  39.6  49.5  59.4 
> 69.3  79.2  89.1
>           99.   99.   99.   99. ]
> coeffs = [ 0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0. 
> 0.  0.]
> *** fitpack.cocosp
> knots = [  0.    0.    0.    0.    9.9  19.8  29.7  39.6  49.5  59.4 
> 69.3  79.2  89.1
>           99.   99.   99.   99. ]
> 0-th dimension must be fixed to 0 but got 100
> Traceback (most recent call last):
>    File "sample.py", line 62, in ?
>      fitpack.cocosp(x, y, w, knots, e, maxtr, maxbin, coeffs, sq, sx, 
> bind, fp, wrk, iwrk, ier)
> fitpack.error: failed in converting 3rd argument `w' of fitpack.cocosp 
> to C/Fortran array
> ir3331 at jm-philippe:~/splines $
> 
> =======================
> 
> Only the first Fortran routine produces results, the second one does not 
> compute any spline coefficient and the last one refuses to run.

Thanks for the example.
 
You have a typo in sample.py. When replacing the line

  fitpack.cocosp(x, y, w, knots, e, maxtr, maxbin, coeffs, sq, sx, bind, fp, wrk, iwrk, ier)

with

  fitpack.cocosp(x, y, w, knots, e, maxtr, maxbin, coeffs, sq, sx, bind, wrk, iwrk, ier)

then the sample script works fine.

Pearu




More information about the f2py-users mailing list