On 07/07/2006, at 6:26 AM, Travis Oliphant wrote:

> 1) .T  Have some kind of .T attribute

-1

The meaning of .T is unclear for ndim != 2, as the plethora of sub- 
vote options shows. And we already have a matrix object designed  
explicitly for the case ndim == 2. Let's make matrix objects more  
useful, rather than give up on matrices and hard-wire 2d concepts  
into arrays. I'm willing to help with this, and I'll post some ideas  
to a different thread.

>    If >0 on this then:
>
>    a) .T == .swapaxes(-2,-1)
>
>    b) .T == .transpose()
>
>    c) .T raises error for ndim > 2
>
>    d) .T returns (N,1) array for length (N,) array
>
>    e) .T returns self for ndim < 2

(Just for the record, I think option (d) is positively evil.)


> 2) .H  returns .T.conj()

-1

I'm against this for the same reasons I'm against .T, but more  
strongly, due to the extra memory allocation.


> 3) .M  returns matrix version of array

-0

This would have the advantage of making .T and .H redundant for 2-d  
arrays, since they'd be accessible as matrix attributes anyway. But I  
don't see a strong enough case for this as an extra attribute, since  
asmatrix() and mat() are available anyway.

I would like to deprecate mat() as an alias for matrix (by moving mat  
to the oldnumeric namespace); this would break the expectation that  
mat() perform a copy, and allow users to write

 >>> from numpy import asmatrix as mat

instead if they need a short, simple syntax that avoids the copy  
overhead.

It's also trivial for any serious user of matrices to write wrapper  
functions for ones, zeros, etc., such as

def matones(*args):
     return asmatrix(ones(*args))

There might be an argument for including these in e.g. the  
numpy.matrix namespace. This would make a .M attribute even less  
compelling.


> 4) .A  returns basearray (useful for sub-classes).

-0

This could be a good idea, but I'm not clear enough on its  
implications to vote either way.


-- Ed


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion

Reply via email to