[Numpy-discussion] adding a .M attribute to the array.
Paul F Dubois
paul at pfdubois.com
Wed Mar 6 13:52:07 CST 2002
To me, matrices are just arrays of rank <=2 which should be interpreted
with their specific algebra.
-- If a class is roughly data plus behaviors, a matrix is not simply an
array of rank <=2. You can express the concept of a matrix most cleanly
as a separate class.
Adding an argumentless member function .M to "convert" from one class to
the other, and not make the other class explicit, is a bit weird. But if
the other class "Matrix" is explicit, you needn't give it a privleged
status with respect to Numeric.array by having a member function in
Numeric.array that amounts to a Matrix constructor. The only real
motivation for that seems to me to be the feeling that M(x) is somehow
less clear than x.M. Note that except for a tricky property behavior,
you really ought to have to write the latter as x.M().
As I said, I think we can beef up Matrix to make the linear algebra
freaks happy, even to making things like transpose(A)*(B) as optimized
More information about the Numpy-discussion