annotate general/algo/product_it.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents f7fb679637ff
children
rev   line source
samer@10 1 function h=product_it(f,g)
samer@10 2 % product_it- compose two iterators to run in parallel
samer@10 3 %
samer@10 4 % product_it::
samer@10 5 % iterator(A) ~'first iterator transformer and initial value',
samer@10 6 % iterator(B) ~'second iterator transformer and initial value',
samer@10 7 % -> iterator(cell {A,B}) ~'combined iterator'.
samer@10 8 %
samer@10 9 % The state transformer function returns [] to signal termination
samer@10 10 % if EITHER of the sub-transformer functions returns [].
samer@10 11
samer@10 12 ff=f{1}; gg=g{1};
samer@10 13 h={@prodit,{f{2},g{2}}};
samer@10 14
samer@10 15 function h=prodit(s)
samer@10 16 s1=ff(s{1});
samer@10 17 s2=gg(s{2});
samer@10 18 if isempty(s1) || isempty(s2)
samer@10 19 h=[];
samer@10 20 else
samer@10 21 h={s1,s2};
samer@10 22 end
samer@10 23 end
samer@10 24 end
samer@10 25