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

jason-sage@creativetra... jason-sage@creativetra...
Wed May 27 03:27:32 CDT 2009

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]).



Jason Grout

More information about the SciPy-user mailing list