On 12/21/06, Sven Schreiber <[EMAIL PROTECTED]> wrote:
> Keith Goodman schrieb:
>
> > How about diag?
> >
>
> There was a thread about this (in which you participated, I believe);
> for matrices you should now use m.diagonal() I think. So diag doesn't
> qualify.
I think the different results returned by x.diagonal and M.diagonal(x)
is confusing:
>> x
matrix([[-0.87175207, 1.57394765],
[-1.7135918 , -1.5183181 ]])
>> x.diagonal()
matrix([[-0.87175207, -1.5183181 ]]) <-----matrix
>> M.diagonal(x)
array([-0.87175207, -1.5183181 ]) <-----array
321 def diagonal(a, offset=0, axis1=0, axis2=1):
322 """diagonal(a, offset=0, axis1=0, axis2=1) returns the given
diagonals
323 defined by the last two dimensions of the array.
324 """
325 return asarray(a).diagonal(offset, axis1, axis2)
Maybe this asarray could be changed to asanyarray?
_______________________________________________
Numpy-discussion mailing list
[email protected]
http://projects.scipy.org/mailman/listinfo/numpy-discussion