[Numpy-discussion] matrices in 1.1

Alan G Isaac aisaac at american.edu
Fri Mar 21 15:57:45 EDT 2008


On Fri, 21 Mar 2008, Nadav Horesh apparently wrote:
> But asmatrix returns a matrix object and any subsequent 
> operation of it returns a matrix. What I am thinking about 
> is a convenient way to apply matrix operation on an array. 

I suspect what you are really wanting is a way for NumPy to 
define new operators ...

The only thing short of that that seems to get at what you 
want is the occasionally surfacing proposal to let both 
arrays and matrices have attributes ``A`` (asarray) and 
``M`` (asmatrix).  I do not like this, and I do not think it 
has gotten favorable reception.

Matrices are just meant to be 2d arrays with some 
conveniences for linear algebra.

By the way, I trust you know about the ``A`` attribute for 
matrices.

Anyway, what is a use case where ``asmatrix`` does not get 
you what you need (i.e., a matrix object view on your array 
data)?

Cheers,
Alan Isaac






More information about the NumPy-Discussion mailing list