[SciPy-user] fminbound now passes arrays, but used to pass numbers
jason-sage at creativetrax.com
jason-sage at creativetrax.com
Wed May 27 09:33:42 EDT 2009
Stéfan van der Walt wrote:
> Hi Jason
>
> 2009/5/27 <jason-sage at 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! I'll probably cherry-pick that patch for Sage for now, and look
forward to upgrading to 0.7.1 soon when it comes out.
Thanks,
Jason
More information about the SciPy-User
mailing list