Mercurial > hg > octave-terminal
changeset 10965:28ef5a31763d
small rewrite in common_size
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Mon, 13 Sep 2010 08:32:25 +0200 |
parents | 50273985ebca |
children | 07b4cd795742 |
files | scripts/ChangeLog scripts/general/common_size.m |
diffstat | 2 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2010-09-13 Jaroslav Hajek <highegg@gmail.com> + + * general/common_size.m: Partially rewrite using cellindexmat. + 2010-09-13 Jaroslav Hajek <highegg@gmail.com> * general/accumarray.m: Use @vec instead of @(x) x(:) for faster call.
--- a/scripts/general/common_size.m +++ b/scripts/general/common_size.m @@ -71,13 +71,9 @@ scal = !nscal; varargout = varargin; if (any (nscal)) - ## This could also be achieved by cellfun (@repmat, ...), but repmat is an - ## m-function and hence still carries interpreter overhead. Further, - ## cellfun is slightly optimized for the case used below. - uo = "uniformoutput"; dims = size (varargin{find (nscal, 1)}); - subs = substruct ("()", arrayfun (@ones, 1, dims, uo, false)); - varargout(scal) = cellfun ("subsref", varargin(scal), {subs}, uo, false); + subs = arrayfun (@ones, 1, dims, "uniformoutput", false); + varargout(scal) = cellindexmat (varargin(scal), subs{:}); endif endif endif