diff scripts/general/accumarray.m @ 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 297996005012
children 19f2107d1fdd
line wrap: on
line diff
--- 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