Mercurial > hg > ishara
diff general/arrutils/foldcols.m @ 12:fbc0540a9208
Moved some high-order functions from funutils to arrutils, updated docs and cleaned up funutils.
author | samer |
---|---|
date | Mon, 14 Jan 2013 22:21:11 +0000 |
parents | general/funutils/foldcols.m@e44f49929e56 |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/general/arrutils/foldcols.m Mon Jan 14 22:21:11 2013 +0000 @@ -0,0 +1,13 @@ +% foldcols - fold from left combinator for columns of an array +% +% foldcols :; +% (A,[[N]]->A) ~'folding function', +% A ~'initial value', +% [[N,L]] ~'data to scan, sequence of length L' +% -> A. + +function y=foldcols(f,y,X) + for i=1:size(X,2), y=f(y,X(:,i)); end +end + +