diff --git a/HISTORY.md b/HISTORY.md index 432dc206a..776e4f61d 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -10,6 +10,7 @@ Thanks @johnmarinelli. - Fixed #523: In some circumstances, matrix subset returned a scalar instead of the correct subset. +- Fixed #536: A bug in an internal method used for sparse matrices. ## 2015-12-05, version 2.5.0 diff --git a/lib/function/algebra/sparse/cs_amd.js b/lib/function/algebra/sparse/cs_amd.js index 3109648dc..60fefbaac 100644 --- a/lib/function/algebra/sparse/cs_amd.js +++ b/lib/function/algebra/sparse/cs_amd.js @@ -161,7 +161,7 @@ function factory (type, config, load) { // scan, no entry in the w array is greater than or equal to mark. // clear w if necessary - mark = _wclear(mark, lemax, w, n); + mark = _wclear(mark, lemax, W, w, n); // scan 1: find |Le\Lk| for (pk = pk1; pk < pk2; pk++) { i = cindex[pk]; @@ -275,7 +275,7 @@ function factory (type, config, load) { W[degree + k] = dk; lemax = Math.max(lemax, dk); // clear w - mark = _wclear(mark + lemax, lemax, w, n); + mark = _wclear(mark + lemax, lemax, W, w, n); // Supernode detection. Supernode detection relies on the hash function h(i) computed for each node i. // If two nodes have identical adjacency lists, their hash functions wil be identical. @@ -496,7 +496,7 @@ function factory (type, config, load) { W[degree + i] = W[len + i]; } // clear w - var mark = _wclear(0, 0, w, n); + var mark = _wclear(0, 0, W, w, n); // n is a dead element W[elen + n] = -2; // n is a root of assembly tree @@ -549,15 +549,15 @@ function factory (type, config, load) { return nel; }; - var _wclear = function(mark, lemax, w, n) { + var _wclear = function(mark, lemax, W, w, n) { if (mark < 2 || (mark + lemax < 0)) { for (var k = 0; k < n; k++) { - if (w[k] !== 0) - w[k] = 1; + if (W[w + k] !== 0) + W[w + k] = 1; } mark = 2 ; } - // at this point, w [0..n-1] < mark holds + // at this point, W [0..n-1] < mark holds return mark; };