On 4 Oct 2014, at 08:37 pm, Ariel Rokem <aro...@gmail.com> wrote: > >>> import numpy as np > >>> np.__version__ > '1.9.0' > >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=np.float)) > [array([[ 2., 2., -1.], > [ 2., 2., -1.]]), array([[-0.5, 2.5, 5.5], > [ 1. , 1. , 1. ]])] > > On the other hand: > >>> import numpy as np > >>> np.__version__ > '1.8.2' > >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=np.float)) > [array([[ 2., 2., -1.], > [ 2., 2., -1.]]), array([[ 1. , 2.5, 4. ], > [ 1. , 1. , 1. ]])] > > For what it's worth, the 1.8 version of this function seems to be in > agreement with the Matlab equivalent function ('gradient'): > >> gradient([[1, 2, 6]; [3, 4, 5]]) > ans = > 1.0000 2.5000 4.0000 > 1.0000 1.0000 1.0000 > > This seems like a regression to me, but maybe it's an improvement? > Technically yes, the function has been changed to use 2nd-order differences where possible, as is described in the docstring. Someone missed to update the example though, which still quotes the 1.8 results. And if the loss of Matlab-compliance is seen as a disadvantage, maybe there is a case for re-enabling the old behaviour via keyword argument?
Cheers, Derek _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion