public void Test_PseudoInverseOfDiagonalMatrix_RectangularMatrix2_WithTolerance() { double[,] matrix = { { 0.1, 0.0 }, { 0.0, 5.0 }, }; double tolerance = 0.2; double[,] expected = { { 0.0, 0.0 }, { 0.0, 0.2 }, }; double[,] actual = ArrayMatrixUtils.PseudoInverseOfDiagonalMatrix(matrix, tolerance); Assert.That(actual, Is.EqualTo(expected)); }
public void Test_PseudoInverseOfDiagonalMatrix_SquareMatrix_WithTolerance() { double[,] matrix = { { 1.0, 0.0, 0.0 }, { 0.0, 0.5, 0.0 }, { 0.0, 0.0, 0.1 }, }; double tolerance = 0.2; double[,] expected = { { 1.0, 0.0, 0.0 }, { 0.0, 2.0, 0.0 }, { 0.0, 0.0, 0.0 }, }; double[,] actual = ArrayMatrixUtils.PseudoInverseOfDiagonalMatrix(matrix, tolerance); Assert.That(actual, Is.EqualTo(expected)); }