Hi,

there was a thread about this before, diag() is currently only
partly useful if you work with numpy-matrices, because the 1d->2d
direction doesn't work, as there are no 1d-numpy-matrices. This is
unfortunate because a numpy-matrix with shape (n,1) or (1,m) should be
naturally treated as a vector, imho. So it would be nice if this could
be fixed.

It's probably not the most efficient solution, but what I want for
numpy-matrix input x is to get:

mat(diag(x.A.squeeze))

where diag is the current implementation. This means that if x is not a
vector ("truly 2d"), then nothing is changed. But if one of the
dimensions of x is ==1, then it's turned into a 1d-array, and diag works
as it should.

Does that sound reasonable?

Thanks,
Sven


-------------------------------------------------------------------------
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