I would like to raise a few objections going from mild to strong: 1. .T : I am mildly against it. As an inexpensive operation that returns a view (so that a.T[...] = makes sense) it is a reasonable candidate for an attribute. Unfortunately reversing the order of axes at least as reasonable as swapaxes(-2,-1) and swapaxes(-2,-1) is invalid for rank < 2. My main objection is that a.T is fairly cryptic - is there any other language that uses attribute for transpose? Adding .T to arrays will lead to less readable code because in expressions like "a * b.T" it will not be clear whether * is a matrix or elemenwise multiplication.
2. .H : This is an O(n^2) complexity operation returning a copy so it is not appropriate for an attribute. It does not make much sense for any type other than complex, so it's use is limited. 3. .M : I am strongly against this. It will create a circular dependency between ndarray and matrix. I would expect that asmatrix is mostly used to convert function arguments and for this purpose @matrix_args decorator would be a better solution to reduce code clutter. 4. .A : I have no clue what this one does, so I won't comment. On 7/6/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > Bill Baxter wrote: > > So in short my proposal is to: > > -- make a.T a property of array that returns a.swapaxes(-2,-1), > > -- make a.H a property of array that returns > > a.conjugate().swapaxes(-2,-1) > > and maybe > > -- make a.M a property of array that returns numpy.asmatrix(a) > > I've tentatively implemented all of these suggestions as well as adding > the .A attribute to the ndarray as well (so that all sub-classes and > array scalars can get back a view as an ndarray). > > I did this to make it easier to do matrix-like calculations with or > with-out matrices. Matrix-calculation flexibility is still a sore-spot > for many and I think these syntatical-sugar attributes will help long term. > > If there are no strong objections, then the recent MATH attribute > checkin will stay. If there are major objections, then we can back them > out without too much trouble as well. > > -Travis > > > 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 > 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