[Numpy-discussion] Functions for indexing into certain parts of an array (2d)

Robert Kern robert.kern at gmail.com
Sat Jun 6 16:46:42 EDT 2009

On Sat, Jun 6, 2009 at 15:31, Bruce Southey <bsouthey at gmail.com> wrote:

> While not trying to be negative, this raises important questions that
> need to be covered because the user should not have to do trial and
> error to find what actually works and what that does not. While
> certain features can be fixed within Numpy, API changes should be
> avoided.

He's proposing additional functions, not changes to existing functions.

> How does this address non-contiguous memory,  Fortran ordered arrays

They just work. These functions create index arrays to use with fancy
indexing which works on all of these because of numpy's abstractions.
Please read the code. This is obvious.

> or arrays with more than 2 dimensions?

diag_indices(n, ndim=3), etc.

> How does this handle record and masked arrays as well as the matrix
> subclass that are supported by Numpy?

Again, these functions work via fancy indexing. We don't need to
repeat all of the documentation on fancy indexing in each of these

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco

More information about the NumPy-Discussion mailing list