[f2py] netlib spline source compilation

Jean-Michel Philippe jean-michel.philippe at arcelor.com
Tue Feb 22 12:58:10 EET 2005


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?

> 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.

> Not sure. Sometimes wrapping certain Fortran codes requires reading
> their documentation to understand what is the correct way to call
> these Fortran codes and then take this into account when wrapping
> with f2py.
> 
> HTH,
> Pearu

Ok I understand it could be too difficult to solve by myself if it does 
not work out the box... In this case I will simply use what is available!

Thanks.


JM. Philippe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sample.py
Type: text/x-python
Size: 2651 bytes
Desc: not available
Url : http://cens.ioc.ee/pipermail/f2py-users/attachments/20050222/9b22c436/sample.py


More information about the f2py-users mailing list