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	Mon Feb 08 11:16:52 2010 +0100
+++ b/scripts/ChangeLog	Mon Feb 08 11:32:07 2010 +0100
@@ -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	Mon Feb 08 11:16:52 2010 +0100
+++ b/scripts/general/accumarray.m	Mon Feb 08 11:32:07 2010 +0100
@@ -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