annotate arrows/stats/accumstats_cell.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents 672052bd81f8
children
rev   line source
samer@0 1 % accumstats - arrow that collects 1st and 2nd order statistics (cell version)
samer@0 2 %
samer@0 3 % accumstats :: arrow({[[N]]},{stats_cell},stats_cell).
samer@0 4 %
samer@0 5 % stats_cell ::= cell { nonneg, [[N]], [[N,N]] }.
samer@0 6
samer@0 7 function a=accumstats
samer@0 8 a=loop(@accum,@(s){0,0,0});
samer@0 9 end
samer@0 10
samer@0 11 function [y,s2]=accum(x,s),
samer@0 12 s2={s{1}+size(x,1),s{2}+sum(x,2),s{3}+x*x'};
samer@0 13 y=s2;
samer@0 14 end