[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Index of max, sort etc

**From**: |
Dirk Laurie |

**Subject**: |
Index of max, sort etc |

**Date**: |
Wed, 29 Mar 2000 09:08:52 +0200 (SAST) |

I often need to do something like this:
Find the row of matrix A for which some criterion
(e.g. its inner product with a vector w) is a maximum.
I use the following code:
[actual_unnneeded_max, kmax] = max(A*w);
desired_row = A(kmax,:);
It would have been nice if there existed a function
say "imax" which behaved exactly like "max" except that
the order of the return arguments is different. So
that one could code:
desired_row = A(imax(A*w),:);
Similar considerations apply to "sort".
I know I can easily define such a function myself ...
but if something of the kind exists or could exist,
why must I?
Dirk
-----------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.che.wisc.edu/octave/octave.html
How to fund new projects: http://www.che.wisc.edu/octave/funding.html
Subscription information: http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------

[Prev in Thread] |
**Current Thread** |
[Next in Thread] |

**Index of max, sort etc**,
*Dirk Laurie* **<=**