[SciPy-user] fminbound now passes arrays, but used to pass numbers

Stéfan van der Walt stefan@sun.ac...
Wed May 27 04:29:47 CDT 2009


Hi Jason

2009/5/27  <jason-sage@creativetrax.com>:
> In changeset 5205 (29 Nov 2008), to resolve #544, someone added the
> following code to the fminbound function in optimize/optimize.py:
>
> x1 = atleast_1d(x1)
> x2 = atleast_1d(x2)
> if len(x1) != 1 or len(x2) != 1:
>     raise ValueError, "Optimisation bounds must be scalars" \
>           " or length 1 arrays"
>
> An effect of the first two lines is that the x value passed to the
> function a few lines later is no longer a single number, but an
> ndarray.  This messes things up for us in the Sage project, where the
> calculations in the function may or may not know how to deal with an
> ndarray.  Can we make x1 and x2 numbers if they were originally
> numbers?  Otherwise, we have to wrap all of our functions in a (slow)
> python call lambda x: f(x[0]).

This should be fixed in

http://projects.scipy.org/scipy/changeset/5790

Thanks,
Stéfan


More information about the SciPy-user mailing list