[Numpy-discussion] OpenOpt Suite release 0.45

Nathaniel Smith njs at pobox.com
Fri Mar 15 16:04:12 EDT 2013


On Fri, Mar 15, 2013 at 7:34 PM, Dmitrey <tmp50 at ukr.net> wrote:
> --- Исходное сообщение ---
>
> От кого: "Alan G Isaac" <alan.isaac at gmail.com>
> Дата: 15 марта 2013, 20:38:38
>
> On 3/15/2013 9:21 AM, Dmitrey wrote:
>> Temporary walkaround for a serious bug in FuncDesigner automatic
>> differentiation kernel due to a bug in some versions of Python or NumPy,
>
>
> Are the suspected bugs documented somewhere?
>
> the suspected bugs are not documented yet, I guess it will be fixed in
> future versions of Python or numpy
> the bug is hard to locate and isolate, it looks like this:
>
>             derivative_items = list(pointDerivative.items())
>
>             # temporary walkaround for a bug in Python or numpy
>             derivative_items.sort(key=lambda elem: elem[0])
>             ######################################
>
>             for key, val in derivative_items:
>                 indexes = oovarsIndDict[key]
>
>                 # this line is not reached in the involved buggy case
>                 if not involveSparse and isspmatrix(val): val = val.A
>
>                 if r.ndim == 1:
>                     r[indexes[0]:indexes[1]] = val.flatten() if type(val) ==
> ndarray else val
>                 else:
>                     # this line is not reached in the involved b uggy case
>                     r[:, indexes[0]:indexes[1]] = val if val.shape ==
> r.shape else val.reshape((funcLen, prod(val.shape)/funcLen))
>
> so, pointDerivative is Python dict of pairs (F_i, N_i), where F_i are
> hashable objects, and even for the case when N_i are ordinary scalars (they
> can be numpy arrays or scipy sparse matrices) results of this code are
> different wrt was or was not derivative_items.sort() performed; total number
> of nonzero elements is same for both cases. oovarsIndDict is dict of pairs
> (F_i, (n_start_i, n_end_i)), and for the case N_i are all scalars for all i
> n_end_i = n_start_i - 1.

If you can turn this into a minimal self-contained working example we
can take a look...

-n



More information about the NumPy-Discussion mailing list