[Numpy-discussion] Slicing/selection in multiple dimensions simultaneously

David Warde-Farley dwf@cs.toronto....
Mon Mar 2 04:19:18 CST 2009

On 28-Feb-09, at 12:27 PM, Jonathan Taylor wrote:

> This does seem like the only way to write this nicely.  Unfortunately,
> I think this may be wasteful memory wise (in contrast to what the
> obvious matlab code would do) as it constructs an array with the whole
> first index intact at first.

True enough, though if I understand correctly, this is only a _view_  
onto the original array, and nothing is immediately copied. So it does  
waste memory creating a view and then a view on the view, but I don't  
think it's proportional to the size of the returned array.

Maybe Robert or someone else can confirm this.


More information about the Numpy-discussion mailing list