[Numpy-discussion] RE: An historical precedent for matrix operation symbols

Perry Greenfield perry at stsci.edu
Fri Mar 8 08:48:09 CST 2002


Paul Dubois writes:

[...]
Paul puts this very well and I agree with virtually everything he
says.
>
> One should not have any illusions: putting such operators on the array
> class is just expediency, a way to give the arrays a bit of a dual life.
> But a real matrix facility would have an abstract base class, be
> restricted to <= 2 dimensions, have realizations including symmetric,
> Hermitian, sparse, tridiagonal, yada yada yada.
>
A few comments on this point. I do think that this is correct. If a matrix
is stored as an array intrinsically, then constructing an array
representation
(e.g., array(b) where b is a matrix) would be very efficient since a new
array object consists of creating a new object that still uses the same
underlying data buffer the matrix object does. There is no significant
increase in memory. On the other hand, if a matrix class does use other
representations, particularly such as sparse or tridiagnonal, then there
naturally would be some cost to creating an array object since a new copy
of the data would be required. Having such various matrix representations
would certainly be useful (particularly sparse) but will certainly require
work to support (not something we (STScI) can sign up to do, but I hope
someone else is willing).

Perry





More information about the Numpy-discussion mailing list