comparison general/numerical/minmax.m @ 4:e44f49929e56

Adding reorganised general toolbox, now in several subdirectories.
author samer
date Sat, 12 Jan 2013 19:21:22 +0000
parents
children
comparison
equal deleted inserted replaced
3:3f77126f7b5f 4:e44f49929e56
1 function R=minmax(X,I)
2 % minmax - return minimum and maximum along a particular dimension
3 %
4 % minmax :: [[N,M]], 1:natural -> [[2,M]].
5 % minmax :: [[N,M]], 2:natural -> [[N,2]].
6 % minmax :: [D:[[1,E]]], I:[E] -> [set(D,I,2)].
7 %
8 % The most general type means that the return array is the same size
9 % as the input array except that the size along the Ith dimension
10 % becomes 2, first element is min, second is max.
11 %
12 % The functions is constructed so that it is idemponent:
13 % minmax(X,I) == minmax(minmax(X,I),I)
14
15 R= cat(I,min(X,[],I),max(X,[],I));