vkostyukov / la4j

Linear Algebra for Java
http://la4j.org
Apache License 2.0
373 stars 109 forks source link

Discovered bug in Matrix.select #223

Closed SamoylovMD closed 9 years ago

SamoylovMD commented 9 years ago

When I worked on tests, I discovered next situation:

    @Test(expected = IndexOutOfBoundsException.class)
    public void testSelect2() {
        // Throw exception when column indices are invalid
        Matrix a = matrixA(); //some big matrix
        int[] rowInd = new int[]{0, 1, 2};
        int[] colInd = new int[]{-1, 1, 2}; // all columns
        a.select(rowInd, colInd);
    }

a.select must throw IndexOutOfBoundsException or some other error message, but gives nothing! This is correct for CRS only, but there is analogous issue with testSelect1 and CCS. I believe it's somehow connected with #202.

DWiechert commented 9 years ago

After implementing range checks on Matrix, I un-ignored these 2 tests and they pass - https://github.com/DWiechert/la4j/commit/61b7aae1cd190b78cf6b9b27331b30fc9b7d6119

That commit has been added to PR #225.

vkostyukov commented 9 years ago

Thanks guys for discovering and fixing it!