annotate general/numerical/argmin1.m @ 6:0ce3c2070089
Removed duplicate code and fixed doc in timed_action.
author |
samer |
date |
Mon, 14 Jan 2013 14:33:37 +0000 |
parents |
e44f49929e56 |
children |
|
rev |
line source |
samer@4
|
1 function [I,Y]=argmin1(D,X)
|
samer@4
|
2 % argmin1 - return index of minimum along a particular dimension
|
samer@4
|
3 %
|
samer@4
|
4 % argmin1 ::
|
samer@4
|
5 % D:1..E ~'dimension over which to argmax',
|
samer@4
|
6 % [S:[[E]->natural]->real] ~
|
samer@4
|
7 % 'array of size S where S is an array of E naturals.
|
samer@4
|
8 % The array must be real so linear ordering is defined'
|
samer@4
|
9 % -> [T:[[E]->natural]->1..S(D)] ~
|
samer@4
|
10 % 'array of indices of maxima, of size T, where T is like
|
samer@4
|
11 % 'S except that T(D)=1. Indices are in the range 1..S(D)',
|
samer@4
|
12 % [T:[[E]->natural]->real] ~'the actual minimum values'.
|
samer@4
|
13
|
samer@4
|
14 [Y,I]=min(X,[],D);
|
samer@4
|
15
|