changeset 17712:e3ac73be7894

__sprand_impl__.m : Fix off by one error in the column index for large matrices (bug #40325)
author David Bateman <dbateman@free.fr>
date Mon, 21 Oct 2013 20:28:24 +0200
parents 9ccb48d39ce9
children ccc0576641f9
files scripts/sparse/private/__sprand_impl__.m
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/sparse/private/__sprand_impl__.m	Sun Oct 20 22:23:31 2013 +0200
+++ b/scripts/sparse/private/__sprand_impl__.m	Mon Oct 21 20:28:24 2013 +0200
@@ -70,6 +70,7 @@
     k = min (length (idx), k);
     j = floor ((idx(1:k) - 1) / m);
     i = idx(1:k) - j * m;
+    j++;
   else
     idx = randperm (mn, k);
     [i, j] = ind2sub ([m, n], idx);