view general/numerical/array/argmax1.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents db7f4afd27c5
children
line wrap: on
line source
function [I,Y]=argmax1(D,X)
% argmax1 - return indices of maxima along a particular dimension
%
% argmax1 :: 
%    D:1..E   ~'dimension over which to argmax',
%    [S:[[E]->natural]->real] ~
%			'array of size S where S is an array of E naturals.
%         The array must be real so linear ordering is defined'
% -> [T:[[E]->natural]->1..S(D)] ~
%        'array of indices of maxima, of size T, where T is like
%        'S except that T(D)=1. Indices are in the range 1..S(D)',
%    [T:[[E]->natural]->real] ~'the actual maximum values'.

[Y,I]=max(X,[],D);