[Numpy-discussion] Why ndarray provides four ways to flatten?

Alexander Belopolsky ndarray at mac.com
Wed Oct 29 13:09:39 EDT 2014

On Tue, Oct 28, 2014 at 10:11 PM, Nathaniel Smith <njs at pobox.com> wrote:

> .diagonal has no magic, it just turns out that the diagonal of any strided
> array is also expressible as a strided array. (Specifically, new_strides =
> (sum(old_strides),).)

This is genius!  Once you mentioned this, it is obvious how the new
diagonal() works and one can only wonder why it took over 20 years to get
this feature in NumPy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20141029/2ef81ac4/attachment.html>

More information about the NumPy-Discussion mailing list