[Numpy-discussion] .T Transpose shortcut for arrays again
tim.hochberg at cox.net
Thu Jul 6 12:51:14 CDT 2006
Sven Schreiber wrote:
> Tim Hochberg schrieb:
>>>> -) .I for inverse; actually, why not add that to arrays as well as
>>>> "syntactic sugar"?
>>> Because it encourages people to do the wrong thing numerically speaking?
>>> My understanding is that one almost never wants to compute the inverse
>>> directly, at least not if you're subsequently going to multiply it with
>>> something, instead you want to use linalg.solve or some other similar
>> Also, having an attribute access do an expensive operation behind the
>> scenes seems antisocial.
> Ok, you (and Bill) may have a point there. (Although I'm not sure it's
> the best way to educate naive users like me about numerical efficiency
> by making inverse harder to access. Otherwise you should rename
> linalg.inv --way too easy!-- to
> However, then why is it possible for matrices?? It's just seems
> incoherent to me.
Because matrix users asked for it I imagine. Since I don't use the
matrix, I certainly wouldn't have objected. Also, the matrix class is
supposed to look a lot like matlab and I assume matlab has some trivial
way to produce an inverse -- even if it is a bad idea.
> Maybe you guys as the developers of numpy should really make up your
> mind about the future of matrices in numpy. Either it's supported, then
> eventually I would expect matrix versions of ones, zeros, eye, for
> example. (Although eye().M would come close enough I guess.) Or you
> decide that you don't really like all the problems that it implies and
> officially declare it unsupported.
> That would be valuable information for users like me who have had (and
> still sometimes have) a hard time figuring out whether I should be using
> arrays or matrices.
Well, the matrix class could use a champion I think. Preferably someone
who does a lot of matrix work and is capable of doing some development
on it, at least on the python end. Without that I imagine it will stay
kind of incoherent.
>>>> -) * being the matrix product instead of element-wise; Now, I could live
>>>> with using dot and I don't want to push anything, but maybe this is the
>>>> right time to consider another operator symbol as a shortcut for the dot
>>>> function to be used with arrays? (Unfortunately right now I can't think
>>>> of any sensible character(s) for that...)
>> 2. Backwards compatibility.
> I meant a *new* operator symbol.
Oh. Well, we're kind of short on those at the moment. The only thing I
know of that would work is to abuse the call operator, thus
dot(A, B) <=> (A)(B)
That's kind of weird though and it's never gotten much support.
>> Curmudgeonly yours,
A curmudgeon is an old, cranky, stubborn fixed in his ways kind of person.
> Well I don't know what that means, so here's my hopefully equally
> incomprehensible reaction:
> Mit freundlichen Grüßen,
With great (big? much?) friendship (friendliness?)?
More information about the Numpy-discussion