[SciPy-Dev] On pulling fwrap refactor into upstream SciPy

Pauli Virtanen pav at iki.fi
Tue Feb 8 16:58:08 EST 2011


On Tue, 08 Feb 2011 21:48:28 +0100, Dag Sverre Seljebotn wrote:
> On 02/08/2011 12:09 PM, Pauli Virtanen wrote:
[clip]
> > If manual changes are necessary, can they be cleanly separated from
> > the automatic boilerplate?
> >    
>
> Not code-wise, but history-wise.
> 
> That is, I have several times changed the code generation of Fwrap,
> regenerated the boilerplate, and put the manual changes back in (using
> git).
[clip]

Clever, that's doable with git. However, it's not very pretty, and I have 
a nasty feeling about mixing autogenerated code with manual code in the 
long term.

    ***

It however looks like that a viable plan [A] could be to replace all F2Py 
wrappers in Scipy with more or less manually written Cython wrappers. The 
wrapper code doesn't look *too* bad, and is in any case almost write-
once. This would require factoring out common parts of the Fwrap code 
pieces (e.g. all the fw_* functions) to a reusable-within-Scipy Cython 
library. Some other common tasks for such a library: helpers for 
declaring ufuncs etc.

Another plan [B] could be to try to improve Fwrap until it can produce 
compatible results directly from the .pyf sources, or some other mostly 
declarative definition. (This would probably be a nice boon for Fwrap 
itself, too.) Here, one would need to think to which degree this is 
possible at all; you probably have a pretty good understanding on this.


Continuing with stupid questions (although this one wasn't answered in 
your initial mail :) --

What are those *_fc.f files for? It seems their purpose is to deal
with assumed-shape arrays. However, unlike F90, AFAIK for F77 one should 
just assume that double precision :: a(10,10) is compatible with 
a(10*10). So as far as I see, all *_fc.f could be dropped.

It seems this also would strip out all of the fw_copyshape() stuff in the 
pyx files, useful for plan [A].

	Pauli




More information about the SciPy-Dev mailing list