annotate general/arrutils/foldcols.m @ 61:eff6bddf82e3
tip
Finally implemented perceptual brightness thing.
author |
samer |
date |
Sun, 11 Oct 2015 10:20:42 +0100 |
parents |
fbc0540a9208 |
children |
|
rev |
line source |
samer@4
|
1 % foldcols - fold from left combinator for columns of an array
|
samer@4
|
2 %
|
samer@4
|
3 % foldcols :;
|
samer@4
|
4 % (A,[[N]]->A) ~'folding function',
|
samer@4
|
5 % A ~'initial value',
|
samer@4
|
6 % [[N,L]] ~'data to scan, sequence of length L'
|
samer@4
|
7 % -> A.
|
samer@4
|
8
|
samer@12
|
9 function y=foldcols(f,y,X)
|
samer@12
|
10 for i=1:size(X,2), y=f(y,X(:,i)); end
|
samer@12
|
11 end
|
samer@4
|
12
|
samer@4
|
13
|