Mercurial > hg > ishara
annotate general/numerical/array/minmax.m @ 35:f1ce7876346a
Updated docs.
author | samer |
---|---|
date | Mon, 21 Jan 2013 11:01:45 +0000 |
parents | db7f4afd27c5 |
children |
rev | line source |
---|---|
samer@4 | 1 function R=minmax(X,I) |
samer@4 | 2 % minmax - return minimum and maximum along a particular dimension |
samer@4 | 3 % |
samer@4 | 4 % minmax :: [[N,M]], 1:natural -> [[2,M]]. |
samer@4 | 5 % minmax :: [[N,M]], 2:natural -> [[N,2]]. |
samer@4 | 6 % minmax :: [D:[[1,E]]], I:[E] -> [set(D,I,2)]. |
samer@4 | 7 % |
samer@4 | 8 % The most general type means that the return array is the same size |
samer@4 | 9 % as the input array except that the size along the Ith dimension |
samer@4 | 10 % becomes 2, first element is min, second is max. |
samer@4 | 11 % |
samer@4 | 12 % The functions is constructed so that it is idemponent: |
samer@4 | 13 % minmax(X,I) == minmax(minmax(X,I),I) |
samer@4 | 14 |
samer@4 | 15 R= cat(I,min(X,[],I),max(X,[],I)); |