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

Bruce Southey bsouthey at gmail.com
Sun Jun 7 09:19:29 EDT 2009


On Sun, Jun 7, 2009 at 3:37 AM, Fernando Perez<fperez.net at gmail.com> wrote:
> On Sun, Jun 7, 2009 at 1:28 AM, Fernando Perez <fperez.net at gmail.com> wrote:
>>
>> OK.  Will send it in when I know whether you'd want the fill_diagonal
>> one, and where that should go.
>>
>
> One more question.  For these *_indices() functions, would you want an
> interface that accepts *either*
>
> diag_indices(size,ndim)

As I indicated above, this is unacceptable for the apparent usage.

I do not understand what is expected with the ndim argument. If it is
the indices of an array elements of the form: [0][0][0],  [1][1][1],
... [k][k][k] where k=min(a.shape) for some array a then an ndim args
is total redundant (although using shape is not correct for 1-d
arrays). This is different than the diagonals of two 2-d arrays from
an shape of 2 by 3 by 4 or some other expectation.



>
> or
>
> diag_indices(anarray)
>

+1

Bruce



More information about the NumPy-Discussion mailing list