annotate arrows/ufold.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 % ufold - Fold data into processing unit
samer@0 2 %
samer@0 3 % ufold ::
samer@0 4 % unit({[[N,1]]}, _, S) ~'live processing unit',
samer@0 5 % [[N,T]] ~'data to pass through',
samer@0 6 % S ~'initial state of unit',
samer@0 7 % options {
samer@0 8 % draw :: boolean/false ~'whether or not to call drawnow after each iteration';
samer@0 9 % quiet :: boolean/false ~'whether or not to suppress progress messages'
samer@0 10 % }
samer@0 11 % -> S ~'final state'.
samer@0 12 %
samer@0 13 % This function accepts the live processing unit associated
samer@0 14 % with an arrow (as created by with_arrow). The arrow must
samer@0 15 % accept one column vector as input. Its output is ignored.
samer@0 16 % The state of the unit is first set, then data is passed
samer@0 17 % through one column at a time, and the final state is returned.
samer@0 18
samer@0 19 function A2=ufold(unit,X,A1,varargin)
samer@0 20 if ~isempty(A1), unit.set_state(A1); end
samer@0 21 uiter(unit,size(X,2),@foldx,[],'label','ufold',varargin{:});
samer@0 22 A2=unit.get_state();
samer@0 23
samer@0 24 function s=foldx(i,s), unit.process(X(:,i)); end
samer@0 25 end