[SciPy-dev] gsl and scipy

Pearu Peterson pearu at cens.ioc.ee
Fri May 3 14:22:40 EDT 2002


On 3 May 2002, Jochen Küpper wrote:

> On Fri, 3 May 2002 09:52:24 -0500 (CDT) pearu  wrote:
> 
> arnd> Is there the possibility to use f2py etc. to generate the
> arnd> necessary wrappers for scipy in an automatic way ?  (on the gsl
> arnd> page they recommend: swig, g-wrap) How difficult would this be ?
> >> 
> >> Pearu,  that's actually exactly the question I was going to ask for
> >> the last couple of months:)
> 
> pearu> It is rather straightforward for functions with scalar
> pearu> (int,float,double,..), *scalar, scalar[] arguments.
> 
> Well, more important, besides the "complex"-problem: What's about
> functions taking arrays or function arguments (which in general are
> some fancy struct again)?  I.e.
> ,----
> | void gsl_siman_solve (const gsl_rng * R, void *X0_P,
> |           gsl_siman_Efunc_t EF, gsl_siman_step_t TAKE_STEP,
> |           gsl_siman_metric_t DISTANCE, gsl_siman_print_t
> |           PRINT_POSITION, gsl_siman_copy_t COPYFUNC,
> |           gsl_siman_copy_construct_t COPY_CONSTRUCTOR,
> |           gsl_siman_destroy_t DESTRUCTOR, size_t ELEMENT_SIZE,
> |           gsl_siman_params_t PARAMS)
> `----

Function arguments are fine for f2py provided that they are
expected to take only scalar or array arguments.

So, let me restate what f2py can wrap:

  C/Fortran functions with scalar[+], array[++], 
      and function [*] arguments
  Global C structs [**]/Fortran COMMON blocks
  Fortran F90 module subroutines/functions
  Fortran F90 module data

[+] scalar is C char, short, int, long, float, double, {float,float},
    {double,double}
[++] array is a pointer of a scalar type, eg. *int, *double, etc.
[*] with only scalar and array arguments
[**] containing only scalars and arrays

For some "fancy" C functions it is possible to write simple interface
functions that fall into the category that f2py can wrap.

For anything else f2py is silent.

Regards,
	Pearu




More information about the SciPy-Dev mailing list