[Numpy-discussion] Two bugs in numpy 0.9.2 and a suggestion.
tim.hochberg at cox.net
Thu Jan 12 06:51:09 CST 2006
Paulo J. S. Silva wrote:
>Now the suggestion. What about adding a "transpose" property (in the
>Python parlance) to ndarray objects? I would call it "t". The following
>Python code explains what I mean:
>from numpy import *
> t = property(transpose, None, None)
>If you add this 3 lines to a file, import the Myndarray class, and
>create one of such arrays you will get transpose(a) by simply typing
>a.t. This allow for the following type of code (which I prefer):
>cost = dot(c.t, x)
>cost = dot(transpose(c), x)
>cost = dot(c.transpose(), x)
>Such a compact notation can be a blessing in code that needs lots of
>transpose (like the BFGS formula for example).
>If I knew more about writing C extensions for Python I would try to do
>it myself, but I don't. Is it possible to define properties in a C
Wouldn't this be more appropriate in Matrix (I'm assuming numpy has an
equivalent to Numeric/Numarray's Matrix class)? For general N-D arrays I
rarely find transpose without axes arguments to be useful, so for me
this would would just amount to extra cruft.
More information about the Numpy-discussion