view 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
line wrap: on
line source
% accumstats - arrow that collects 1st and 2nd order statistics (cell version)
%
% accumstats :: arrow({[[N]]},{stats_cell},stats_cell).
%
% stats_cell ::= cell { nonneg, [[N]], [[N,N]] }.

function a=accumstats
	a=loop(@accum,@(s){0,0,0});
end

function [y,s2]=accum(x,s), 
	s2={s{1}+size(x,1),s{2}+sum(x,2),s{3}+x*x'};
	y=s2;
end