annotate sequences/@seq/diffwith.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents b1280319413e
children
rev   line source
samer@3 1 function Y=diffwith(F,X)
samer@3 2 % diffwith - Generalised diff using argbitrary binary function
samer@3 3 %
samer@3 4 % diffwith :: (A,A->B), seq A -> seq B.
samer@3 5 %
samer@3 6 % The given function gets called with the current value as the
samer@3 7 % first arguments and the previous value as the second.
samer@3 8
samer@23 9 Y=mapaccum(@diffst,head(X),next(X));
samer@3 10 function [y,s]=diffst(x,s)
samer@3 11 y=F(x,s);
samer@3 12 s=x;
samer@3 13 end
samer@3 14 end
samer@3 15