public static void AlmostEqualRelative(Matrix<Complex32> expected, Matrix<Complex32> actual, int decimalPlaces) { if (expected.ColumnCount != actual.ColumnCount || expected.RowCount != actual.RowCount) { Assert.Fail("Matrix dimensions mismatch. Expected: {0}; Actual: {1}", expected.ToTypeString(), actual.ToTypeString()); } for (var i = 0; i < expected.RowCount; i++) { for (var j = 0; j < expected.ColumnCount; j++) { if (!actual.At(i, j).AlmostEqualRelative(expected.At(i, j), decimalPlaces)) { Assert.Fail("Not equal within {0} relative places. Expected:{1}; Actual:{2}", decimalPlaces, expected.At(i, j), actual.At(i, j)); } } } }