Mercurial > hg > octave-lojdl
changeset 10274:db613bccd992
take advantage of new sort optimization in accumarray
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Mon, 08 Feb 2010 11:32:07 +0100 |
parents | 3a8c13b71612 |
children | 19f2107d1fdd |
files | scripts/ChangeLog scripts/general/accumarray.m |
diffstat | 2 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2010-02-08 Jaroslav Hajek <highegg@gmail.com> + + * general/accumarray.m: Add new test that also forces index cache + generation for faster sorting. + 2010-02-08 Jaroslav Hajek <highegg@gmail.com> * general/accumarray.m: 1 more small fix.
--- a/scripts/general/accumarray.m +++ b/scripts/general/accumarray.m @@ -147,9 +147,11 @@ if (ismatrix (subs)) subs = num2cell (subs, 1); endif - subs = sub2ind (sz, subs{:}); + subs = sub2ind (sz, subs{:}); # creates index cache elseif (! isempty (sz) && length (sz) < 2) error ("accumarray: needs at least 2 dimensions"); + elseif (! isindex (subs)) # creates index cache + error ("accumarray: indices must be positive integers"); endif