# HG changeset patch # User samer # Date 1358175158 0 # Node ID 47cb292350f3775bae9e854a7c94b62bf136b0bb # Parent 0ce3c2070089bd778487793f2f8f02f1d9ebebc3 Some documentation fixes. diff -r 0ce3c2070089 -r 47cb292350f3 general/algo/gatherer.m --- a/general/algo/gatherer.m Mon Jan 14 14:33:37 2013 +0000 +++ b/general/algo/gatherer.m Mon Jan 14 14:52:38 2013 +0000 @@ -1,4 +1,18 @@ % gatherer - API for autoexpanding arrays for accumulating data +% +% gatherer :: +% [N,M]:[[1,2]] ~'size of elements to gather', +% options { +% init :: natural/512 ~'initial size of buffer'; +% grow :: natural/2 ~'factor by which to auto-expand buffer'; +% max :: natural/1e9 ~'maximum size of buffer' +% } +% -> struct { +% remove :: natural => void ~'action to remove last n elements'; +% length :: void => natural ~'action to return current buffer length'; +% append :: [[N,M]] => void ~'action to append data to buffer'; +% collect :: void =>[[N,L]] ~'action to return buffer contents and reset'; +% }. function api=gatherer(size_in,varargin) opts=prefs('chunk',256,'init',512,'grow',2,'max',1e9,varargin{:}); n=uint32(0); diff -r 0ce3c2070089 -r 47cb292350f3 general/cellutils/cellmap.m --- a/general/cellutils/cellmap.m Mon Jan 14 14:33:37 2013 +0000 +++ b/general/cellutils/cellmap.m Mon Jan 14 14:52:38 2013 +0000 @@ -6,5 +6,5 @@ % preallocate to fix size Y=cell(size(X)); for i=1:numel(X) - Y{i}=feval(fn,X{i}); + Y{i}=fn(X{i}); end diff -r 0ce3c2070089 -r 47cb292350f3 general/cellutils/cellzip.m --- a/general/cellutils/cellzip.m Mon Jan 14 14:33:37 2013 +0000 +++ b/general/cellutils/cellzip.m Mon Jan 14 14:52:38 2013 +0000 @@ -17,7 +17,7 @@ for i=1:prod(sz) args=cellmap(@(c)c{i},varargin); - Y{i}=feval(fn,args{:}); + Y{i}=fn(args{:}); end diff -r 0ce3c2070089 -r 47cb292350f3 general/fileutils/frecurse.m --- a/general/fileutils/frecurse.m Mon Jan 14 14:33:37 2013 +0000 +++ b/general/fileutils/frecurse.m Mon Jan 14 14:52:38 2013 +0000 @@ -1,13 +1,13 @@ function frecurse(fn,dirname,level) -% recurse: recursively descend a directory tree +% frecurse: recursively descend a directory tree % -% recurse :: +% frecurse :: % (string ~'directory name',natural~'level'=>bool~'descend into?') ~'fn to process directory, % string ~'directory to start from, % natural ~'initial level assigned to start directory' % => void. % -% usage: recurse(,[,]) +% usage: frecurse(,[,]) % % traverses directory tree, starting at , % and calling the named for each directory. diff -r 0ce3c2070089 -r 47cb292350f3 general/fileutils/listfiles.m --- a/general/fileutils/listfiles.m Mon Jan 14 14:33:37 2013 +0000 +++ b/general/fileutils/listfiles.m Mon Jan 14 14:52:38 2013 +0000 @@ -1,7 +1,8 @@ function L=listfiles(dirname,varargin) % listfiles - list files in a directory % -% listfiles :: text ~'directory path', +% listfiles :: +% text ~'directory path', % options { % 'pattern':text ~'pattern to match files against', % 'regext':text ~'regular expression to match files against', diff -r 0ce3c2070089 -r 47cb292350f3 general/fileutils/md5file.m --- a/general/fileutils/md5file.m Mon Jan 14 14:33:37 2013 +0000 +++ b/general/fileutils/md5file.m Mon Jan 14 14:52:38 2013 +0000 @@ -1,3 +1,5 @@ +% md5file - Use md5sum to compute md5 hash +% md5file :: string ~'filename' -> string ~'hash'. function hash=md5file(fn) [rc,result]=system(sprintf('md5sum -b "%s"',fn)); if rc==0 diff -r 0ce3c2070089 -r 47cb292350f3 general/getparam.m --- a/general/getparam.m Mon Jan 14 14:33:37 2013 +0000 +++ b/general/getparam.m Mon Jan 14 14:52:38 2013 +0000 @@ -1,7 +1,7 @@ function a=getparam(s,field,def) % getparam - get value of named field or default if not present % -% getparam :: struct Fields, string, A -> A. +% getparam :: struct Fields, string~'field name', A~'default value' -> A. % % Typical usage is with structures returned by prefs. diff -r 0ce3c2070089 -r 47cb292350f3 general/sh.m --- a/general/sh.m Mon Jan 14 14:33:37 2013 +0000 +++ b/general/sh.m Mon Jan 14 14:52:38 2013 +0000 @@ -1,3 +1,2 @@ % sh - drop out to Unix shell -function sh -unix('bash'); +function sh, unix('bash'); end diff -r 0ce3c2070089 -r 47cb292350f3 general/tostring.m --- a/general/tostring.m Mon Jan 14 14:33:37 2013 +0000 +++ b/general/tostring.m Mon Jan 14 14:52:38 2013 +0000 @@ -7,6 +7,7 @@ % % Multiple inputs are converted to comma-separated string. s=cat_sep(',',map(@tostr,varargin)); +end function s=tostr(x) if ischar(x), s=x; @@ -19,4 +20,5 @@ elseif isa(x,'func'), s=tostring(x); else s=['obj:' class(x)]; end +end