From: Stefan v. d. W. <st...@su...> - 2006-07-11 11:11:12
|
On Tue, Jul 11, 2006 at 12:37:23PM +0200, Pau Gargallo wrote: > > Something's not quite right here. The argsort docstring states that: > > > > argsort(a,axis=3D-1) return the indices into a of the sorted arra= y > > along the given axis, so that take(a,result,axis) is the sorted a= rray. > > > > But > > > > N.take(A,A.argsort()) breaks. Either this is a bug, or the docstring > > needs to be updated. > > > > Cheers > > St=E9fan > > >=20 > I think the docstring is wrong, because take doesn't do that. > if you N.take(A,A.argsort(1), 1), it doesn't break but it doesn't sort > A neither. >=20 > Take seems to peek entire columns, but take's docstring is missing. >=20 > For the argsort docstring, it may be usefull to indicate that if one do > >>> ind =3D indices(A.shape) > >>> ind[ax] =3D A.argsort(axis=3Dax) > then A[ind] is the sorted array. We can always adapt the documentation at http://numeric.scipy.org/numpydoc/numpy-9.html#pgfId-36425 into a docstring. I'll file a ticket. Cheers St=E9fan |