Fixed a bug in an internal method used for sparse matrices, see #536. Still needs extra unit tests to verify the behavior

This commit is contained in:
jos 2016-01-08 19:58:26 +01:00
parent c174865685
commit eff330d635
2 changed files with 8 additions and 7 deletions

View File

@ -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

View File

@ -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;
};