[PYTHON MATRIX-SIG] Final conventions for alpha2
Sun, 18 Aug 1996 12:44:10 -0400
Carlos Fonseca wrote:
> On Sun, 18 Aug 1996, Konrad Hinsen wrote:
> > Obviously, but how often does this occur? (Of course I am not
> array. Thus, -1 are -2 the axes that end up making sense.
> If the population was assumed to be unstructured, then one of these would
> equivalent to 0, but not in general.
I'm going to stay out of this discussion for now, but please continue!
> > [explation of structural vs. non-structural]
> > Of course that means that take(a,argsort(a)) doesn't do anything
> > useful. But in what situation would you use it anyway? To sort the 1D
> > subarrays of a, you would write sort(a) (which being non-structural
> > should have a default axis of -1).
> But suppose I have to arrays, a and b, both aligned and three dimensional,
> and that there is a ono to one correspondence between the elements of a
> and those of b. I need to sort a and, at the same time, rearrange b so
> that the original relationship is retained:
> This should be enough.
You have a good point here, but I think that the issue is you want a
different function from Konrad. Alright, writing functions is something
I can do. What would you like it to be called?
> My experience is different. But Matlab doesn't let me write something
> like the above even for 2d arrays, so I end up using a for-loop.
So at least we aren't in danger of having you defect back to matlab :)
> Something else:
> How can I achieve
> rank = argsort(argsort(cost))
> without having to call argsort twice? Something like an inverted take
> (ekat below :-)
I see what you're looking for here, but I'm not convinced that having to
call argsort twice is enough of a burden to justify the function you're
asking for. I'd either like to see more examples of how this would be
useful, or have you wait and ask for this in version 1.1.
> rank = ekat(arange(n),argsort(cost))
> would be ideal. This would be like take, but "indices" would refer to the
> output matrix, and not to the input.
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: firstname.lastname@example.org
administrivia to: email@example.com