[SciPy-dev] genetic algorithm, number theory, filterdesign,zerofinding
oliphant at ee.byu.edu
Thu Apr 11 12:15:32 CDT 2002
> > If you are not familiar with f2py then we can cooperate. You give me
> > a native C function and I'll give you an interface for calling this C
> > function from Python in no time.
> Hmm... f2py handles this?
Yes, as long as your C functions do not take complicated structures. Is
that true, Pearu -- or have you found some magic there too?
> I was thinking especially of the 1D case. My feeling is that you might save 1,2 iterations, at the expense of twice as many function evaluations in each iteration. Typical iteration count is about 10+, probably a bit less in situations where newton actually works. This clearly gets *much* worse in the multidimensional case.
Python gives us the power to use it or not. Yes if you are going to write
things in C, then thinking about things like this is useful. So, just
call it the secant method and ignore the derivative.
> I am also thinking of dropping the extra args for the function call. At times in the past, I would have killed for this in some circumstances, but if really needed in python one could do something like
You can do that in C-code, but the wrapper will have to include such a
dummy function as you describe. That is fine, but args=() is a standard
we are using in all of SciPy. We're not going to get rid of it.
> The fact that f might be a method instead of a plain old function needs to be detected, but this is needed anyway. In Fortran-77, if I recall, some sort of common was needed to achieve this sort of thing easily. Comments? Is this a good idea or a total kludge.
Again, use f2py. This is all handled easily.
More information about the Scipy-dev