annotate general/numerical/array/arrshift.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 Y=arrshift(O,X)
|
samer@4
|
2 % arrshift - columnwise or rowwise subtraction for arrays
|
samer@4
|
3 %
|
samer@4
|
4 % This SUBTRACTS the first argument (a vector) from each
|
samer@4
|
5 % of the vectors (row or column) in the second argument.
|
samer@4
|
6 % Works in two modes: row vector or column vector mode.
|
samer@4
|
7 %
|
samer@4
|
8 % arrshift ::
|
samer@4
|
9 % [Size] ~'values to subtract',
|
samer@4
|
10 % [[N,M]] ~'array of vectors, array domain is M'
|
samer@4
|
11 % -> [[N,M]] ~'vectors relative to new origin'.
|
samer@4
|
12 %
|
samer@4
|
13 % The first argument is REPMATed up to the size of
|
samer@4
|
14 % the second and then subtracted.
|
samer@4
|
15 %
|
samer@4
|
16 % NB: this used to be called vecshift. vecshift is now
|
samer@4
|
17 % specialised to subtract a COLUMN vector from an array
|
samer@4
|
18 % the same size in the first dimension. This version
|
samer@4
|
19 % retains the generality of the original vecshift.
|
samer@4
|
20
|
samer@4
|
21 % note: this now works for any pair of arrays where size O
|
samer@4
|
22 % is an integer fraction of size X in any dimension
|
samer@4
|
23 Y=X-repmat_to(O,size(X));
|
samer@4
|
24
|