On Fri, Jun 8, 2012 at 7:45 PM, Frédéric Bastien <no...@nouiz.org> wrote:
> Hi, > > While reviewing the Theano op that wrap numpy.fill_diagonal, we found > an unexpected behavior of it: > > # as expected for square matrix > >>> a=numpy.zeros((5,5)) > >>> numpy.fill_diagonal(a, 10) > >>> print a > > # as expected long rectangular matrix > >>> a=numpy.zeros((3,5)) > >>> numpy.fill_diagonal(a, 10) > >>> print a > [[ 10. 0. 0. 0. 0.] > [ 0. 10. 0. 0. 0.] > [ 0. 0. 10. 0. 0.]] > > # Not as expected > >>> a=numpy.zeros((5,3)) > >>> numpy.fill_diagonal(a, 10) > >>> print a > [[ 10. 0. 0.] > [ 0. 10. 0.] > [ 0. 0. 10.] > [ 0. 0. 0.] > [ 10. 0. 0.]] > > > I can make a PR that will add a parameter wrap that allow to control > if it return the old behavior or what I would expect in the last case: > [[ 10. 0. 0.] > [ 0. 10. 0.] > [ 0. 0. 10.] > [ 0. 0. 0.] > [ 0. 0. 0.]] > > My questions is, do someone else expect the current behavior? Should > we change the default to be what I expect? Do you want that we warn if > the user didn't specify witch behavior and in the future we change it? > > There is a ticket for this: http://projects.scipy.org/numpy/ticket/1953 I agree that the behavior is unexpected and should be fixed. Warren > Anything else I didn't think? > > thanks > > Fred > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion >
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion