[Numpy-discussion] .T Transpose shortcut for arrays again

Sven Schreiber svetosch at gmx.net
Thu Jul 6 12:40:46 EDT 2006


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 
>> approach.
>>   
> 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
linalg.okay_im_going_to_compute_the_inverse_for_you_but_its_probably_a_stupid_thing_to_do()
 ;-)

However, then why is it possible for matrices?? It's just seems
incoherent to me.

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.


> 
>>   
>>> -) * 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.

> Curmudgeonly yours,
> 
Well I don't know what that means, so here's my hopefully equally
incomprehensible reaction:
Mit freundlichen Grüßen,
Sven




More information about the NumPy-Discussion mailing list