Re: [Numpy-discussion] numpy.numarray.transpose()
On 09/28/2009 03:15 AM, Pauli Virtanen wrote: Mon, 28 Sep 2009 10:07:47 +0200, Michael.Walker wrote: [clip] In [7]: f = f.transpose() In [8]: print f [[1 3] [2 4]] as expected. I mention this because I think that it is worth knowing having lost a LOT of time to it. Is it worth filing as a bug report? This is not a bug! This specific difference between numpy and numarray is documented on the 'converting from numarray' page: http://www.scipy.org/Converting_from_numarray I am referring to the behaviour of numpy.numarray.transpose() being that of numpy.transpose() instead of numarray.transpose. One expects that numpy.numarray would function as numarray, for the purpose of backwards compatability. So, is this worth filing a bug report for? Michael Walker Plant Modelling Group CIRAD, Montpellier 04 67 61 57 27 ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] numpy.numarray.transpose()
Tue, 29 Sep 2009 11:08:42 +0200, Michael.Walker wrote: [clip] I am referring to the behaviour of numpy.numarray.transpose() being that of numpy.transpose() instead of numarray.transpose. One expects that You probably mean the transpose methods numpy.numarray.ndarray.transpose and numarray.ndarray.transpose. The transpose functions function identically. numpy.numarray would function as numarray, for the purpose of backwards compatability. So, is this worth filing a bug report for? There is no harm in creating a bug ticket. This is at least a documentation issue even in the case the main problem becomes a wontfix. -- Pauli Virtanen ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] numpy.numarray.transpose()
Hello list, I just thought I'd point out a difference between 'import numarray' and 'import numpy.numarray' . Consider the following In [1]: from numpy.numarray import * In [2]: d = array((1,2,3,4)) In [3]: f = reshape(d,(2,2)) In [4]: print f [[1 2] [3 4]] In [5]: f.transpose() Out[5]: array([[1, 3], [2, 4]]) In [6]: print f [[1 2] [3 4]] Now in pure numarray, f would have changed to the transposed form, so that the output from [5] and [6] would match, and be different from that of [4]. (I don't have numarray installed myself but a workmates computer, and examples on the web have the usage f.transpose() . Now, In [7]: f = f.transpose() In [8]: print f [[1 3] [2 4]] as expected. I mention this because I think that it is worth knowing having lost a LOT of time to it. Is it worth filing as a bug report? Michael Walker Plant Modelling Group CIRAD, Montpellier 04 67 61 57 27 ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] numpy.numarray.transpose()
On 09/28/2009 03:15 AM, Pauli Virtanen wrote: Mon, 28 Sep 2009 10:07:47 +0200, Michael.Walker wrote: [clip] In [7]: f = f.transpose() In [8]: print f [[1 3] [2 4]] as expected. I mention this because I think that it is worth knowing having lost a LOT of time to it. Is it worth filing as a bug report? Yes. It indeed seems that in numarray, transpose() transposes the array in-place. This could maybe be fixed by a new numarray-emulating ndarray subclass. The tricky problem then is that some functions don't, IIRC, preserve subclasses, which may lead to surprises. (Anyway, these should be fixed at some point...) At the least, we should write a well-visible differences to numarray document that explains all differences and known bugs. This is not a bug! This specific difference between numpy and numarray is documented on the 'converting from numarray' page: http://www.scipy.org/Converting_from_numarray What actually is incorrect is that the numpy.numarray.transpose has the same docstring as numpy.transpose. So it would be very helpful to first correct the numpy.array.transpose documentation. A larger goal would be to correctly document all the numpy.numarray and numpy.numeric functions as these should not be linked to the similar numpy functions. If these are identical then it should state that, what differences exist and then refer to equivalent numpy page for example, numpy.numarray.matrixmultiply and numpy.dot. Also, the documentation for these numpy.numarray and numpy.numeric functions should state that these are mainly included for compatibility reasons and may be removed at a future date. Bruce ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] numpy.numarray.transpose()
Mon, 28 Sep 2009 09:29:30 -0500, Bruce Southey wrote: [clip] This is not a bug! This specific difference between numpy and numarray is documented on the 'converting from numarray' page: http://www.scipy.org/Converting_from_numarray Oh. I completely missed that page. Now, it should just be transferred to the main documentation. Also, it might be possible to make numpy.numarray.ndarray different from numpy.ndarray. But I doubt this is high priority -- it may be more efficient just to document the fact. What actually is incorrect is that the numpy.numarray.transpose has the same docstring as numpy.transpose. So it would be very helpful to first correct the numpy.array.transpose documentation. numpy.numarray.transpose is numpy.transpose, so fixing this would involve implementing the numarray-style transpose, too. -- Pauli Virtanen ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion