On Sun, May 11, 2008 at 1:01 PM, Keith Goodman <kwgoodman@gmail.com> wrote:
> The most basic, and the most contentious, design decision of a new
> matrix class is matrix indexing. There seems to be two camps:
>> 1. The matrix class should be more like the array class. In particular
> x[0,:] should return a 1d array or a 1d array like object that
> contains the orientation (row or column) as an attribute and x[0]
> should return a 1d array. (Is x.sum(1) also a 1d array like object?)
>> 2. A matrix is a matrix: all operations on a matrix, including
> indexing, should return a matrix or a scalar.
>> Does that describe the two approaches to matrix indexing? Are there
> other approaches?
> _________
Pretty well, I think. The thing about 2) is that ndarray routines break if
they can't treat arrays as nested sequences, i.e. scalar indexing needs to
return an array of one less dimension. So the matrix class shouldn't
subclass ndarray in that case, but rather should use an ndarray as a
component. More code to write, but such is life.
3) Everything is an array. I think Matlab treats scalars as 1x1 arrays.
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080511/7c2f303d/attachment.html