public void Invalidate() { var clone = _smallMatrix.Clone() as MatrixDouble; clone[0, 0]++; Assert.AreNotEqual(_smallMatrix.Determinant, clone.Determinant); }
public void MatrixDouble_Clone() { MatrixDouble m = CreateRandomMatrix(2, 2); MatrixDouble c = null; Assert.DoesNotThrow(() => c = m.Clone()); Assert.AreNotSame(m, c); Assert.AreEqual(m.GetType(), c.GetType(), "Clone() mast return the same matrix type"); }
public void MatrixDouble_GetHashCode() { MatrixDouble m = CreateRandomMatrix(3, 3); // ReSharper disable once ReturnValueOfPureMethodIsNotUsed Assert.DoesNotThrow(() => m.GetHashCode()); MatrixDouble c = m.Clone(); Assert.AreNotEqual(m.GetHashCode(), c.GetHashCode()); }
public void MatrixDouble_EqualsMatrix() { MatrixDouble m = CreateRandomMatrix(3, 3); m[0, 0] = 0.0f; Assert.IsTrue(m.Equals(m)); Assert.IsFalse(m.Equals(null)); Assert.IsFalse(m.Equals(new Matrix(3, 2))); Assert.IsFalse(m.Equals(new Matrix(2, 2))); MatrixDouble c = m.Clone(); Assert.IsTrue(m.Equals(c)); c[0, 0] = 1e-5f; Assert.IsFalse(m.Equals(c)); }