[SciPy-dev] Re: Two fortran/f2py questions
loredo at astro.cornell.edu
Mon Dec 13 14:34:30 CST 2004
Thanks a lot for the quick response!
Regarding ignoring wrapping some utility subprograms via a directive:
> But I think it would be a useful feature. So I'll add this request to
> my todo list.
> Btw, if you would use scipy_distutils-style setup.py file
> then you can add the "only: .. :" part to f2py_options
I thought there must be something like this; thanks for spelling
> I am not sure if I follow you correctly here but when using f2py from
> its CVS, all fortran objects have _cpointer attribute that is
> a C pointer to the actual Fortran or C function.
Well, I'm not sure I've followed you, either. 8-) Here's what
I'm trying to do. I have fortran functions and subroutines that
need to evaluate special functions as part of what they're doing.
E.g., for gamma functions, right now I just define a function
"gammaln" that returns the log of a gamma function, within the
fortran source of my module. But Scipy already has such a
function somewhere (in the Cephes library). Is there a way
I can use that Cephes function? For example, could I just
figure out the appropriate Cephes call (sorting out the
appropriate underscores and pointers) and write a setup.py
that will let my fortran routine use the Cephes library that
Scipy has installed somewhere? For performance, I'd rather
not have to send my fortran module a Python callback; after
all, the raw Cephes routine is sitting *somewhere*.
There are other examples; another module I have needs a
Cholesky decomposition in the middle of a calculation. Right
now it's just hard-coded in the C for the module. I should
just call the appropriate lapack/atlas routine for this,
and I'd love to know how to write the C code and accompanying
setup.py file to be able to do this portably without the
overhead of a Python callback.
This mail sent through IMP: http://horde.org/imp/
More information about the Scipy-dev