public void SetUpdatesMatrixEntry(int i, int j, double newValue) { Double[,] dblArray = new Double[,] { {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, }; var fullMatrix = new FullMatrix<Double>(Guid.NewGuid(), dblArray); fullMatrix.SetEdge(i, j, newValue); Assert.Equal(newValue, fullMatrix[i, j]); }
public void IsBinaryReturnsTrueAndFalseForInt32Matrix() { Int32[,] dblArray = new Int32[,] { {0, 0, 1, 0}, {1, 1, 0, 0}, {0, 0, 0, 0}, {1, 0, 0, 1} }; var fullMatrix = new FullMatrix<Int32>(Guid.NewGuid(), dblArray); Assert.True(fullMatrix.IsBinary); fullMatrix.SetEdge(2, 2, 3); Assert.False(fullMatrix.IsBinary); }
public void SetEdgeThrowsExceptionIfIndexIsOutOfRange() { Int32[,] dblArray = new Int32[,] { {1, 2, 3}, {2, 1, 2}, {3, 2, 1} }; var fullMatrix = new FullMatrix<Int32>(Guid.NewGuid(), dblArray); Assert.Throws<IndexOutOfRangeException>(() => fullMatrix.SetEdge(4, 0, 3)); Assert.Throws<IndexOutOfRangeException>(() => fullMatrix.SetEdge(1, -1, -10)); }
public void IsBinaryReturnsTrueAndFalseForDoubleMatrix() { Double[,] dblArray = new Double[,] { {0, 0, 1, 0}, {1, 1, 0, 0}, {0, 0, 0, 0}, {1, 0, 0, 1} }; var fullMatrix = new FullMatrix<Double>(Guid.NewGuid(), dblArray); Assert.True(fullMatrix.IsBinary); fullMatrix.SetEdge(2, 2, 1.444); Assert.False(fullMatrix.IsBinary); }