Hi,
I'm still using your nice library and I've found a little bug again, this time in the SubMatrix() method for sparse matrices.
If you do something like this:
var matrix = new SparseMatrix(10, 10, 1.0);
var sub = matrix.SubMatrix(8, 2, 0, 2);
then the method will throw an IndexOutOfRangeException. This is due to a little typo in one of the boundary checks:
var endIndex = row < _rowIndex.Length - 1 ? _rowIndex[i + 1] : NonZerosCount;
should really be:
var endIndex = i < _rowIndex.Length - 1 ? _rowIndex[i + 1] : NonZerosCount;
(row being the index of the smaller to-be-output submatrix's row, whereas i is the index of the matrix's row currently being parsed).
Hope it helps!
Cheers and good luck. ;)
Comments: Fixed in changeset d2a96e1f16bb
I'm still using your nice library and I've found a little bug again, this time in the SubMatrix() method for sparse matrices.
If you do something like this:
var matrix = new SparseMatrix(10, 10, 1.0);
var sub = matrix.SubMatrix(8, 2, 0, 2);
then the method will throw an IndexOutOfRangeException. This is due to a little typo in one of the boundary checks:
var endIndex = row < _rowIndex.Length - 1 ? _rowIndex[i + 1] : NonZerosCount;
should really be:
var endIndex = i < _rowIndex.Length - 1 ? _rowIndex[i + 1] : NonZerosCount;
(row being the index of the smaller to-be-output submatrix's row, whereas i is the index of the matrix's row currently being parsed).
Hope it helps!
Cheers and good luck. ;)
Comments: Fixed in changeset d2a96e1f16bb