Example #1
0
    public void SparseRowMatrixCheck()
    {
        SparseRowMatrix sm = new SparseRowMatrix(10, 100);

        Assert.Equal(0, sm.NonZeroValueCount);
        sm.At(8, 8, 0);
        Assert.Equal(0.0D, sm.At(8, 8));  //  Should not insert a value
        Assert.Equal(0, sm.NonZeroValueCount);

        Assert.Equal(sm.rowLength(0), 0);
        Assert.Throws <IndexOutOfRangeException>(() => sm.rowLength(-2));
        Assert.Throws <ArgumentOutOfRangeException>(() => sm.RowLengthSafe(-2));
        Assert.Throws <IndexOutOfRangeException>(() => sm.rowLength(101));
        Assert.Throws <ArgumentOutOfRangeException>(() => sm.RowLengthSafe(101));
    }