annotate general/numerical/array/minmax.m @ 61:eff6bddf82e3
tip
Finally implemented perceptual brightness thing.
author |
samer |
date |
Sun, 11 Oct 2015 10:20:42 +0100 |
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));
|