Sven Schreiber wrote:
> That would be fine with me. However, I'd like to point out that after
> some bug-squashing currently all numpy functions deal with
> numpy-matrices correctly, afaik. The current behavior of numpy.diag
> could be viewed as a violation of that principle. (Because if x has
> shape (n,1), diag(x) returns only the first entry, which is pretty
> stupid for a diag-function operating on a vector.)

I don't think so. It's operating exactly as it is documented to. It doesn't do 
what you want, but it's not supposed to read your mind and guess that you are 
treating (n,1) and (1,n) arrays as linear algebraic vectors and that you want 
to 
form a diagonal matrix from that vector. It handles matrix objects just fine; 
it 
does not obey a particular convention that you want to use, though. That's 
neither broken nor a violation of the principle that most numpy functions 
should 
accept matrix objects; it's just not what you want.

I don't want to introduce a backwards-compatibility-breaking special case to 
the 
function. "Special cases aren't special enough to break the rules." Different 
functionality should go into a different function.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion

Reply via email to