[Numpy-discussion] adding a .M attribute to the array.

Pearu Peterson pearu at cens.ioc.ee
Tue Mar 5 23:46:02 CST 2002


On Tue, 5 Mar 2002, Travis Oliphant wrote:

> The suggestion was made to add ".M" as an attribute of arrays which returns a 
> matrix.  Thus, the code above can be written:
> sin(a).M * cos(a).M.T
> While some aesthestic simplicity is obtained, the big advantage is in 
> consistency.
> I've made this change and am ready to commit the change to the Numeric tree, 
> unless there are strong objections.   I know some people do not like the 
> proliferation of attributes, but in this case the notational convenience it 
> affords to otherwise overly burdened syntax and the consistency it allows 
> Numeric to deal with Matrix equations may be worth it.
> What do you think?

Would it be possible to use own Matrix classes instead of what is in
Matrix.py? I gather that there must be some setter method in Numeric for


with a requirement that MyMatrixClass must be a subclass of Matrix.Matrix.

I think it would be a very important feature as users can define their own
matrix operations, for example, using their own BLAS routines to
speed up operations with matrices (yes, I am thinking of SciPy specific
Matrix class).


More information about the Numpy-discussion mailing list