public void TestCofactor() { var m1 = new MatrixD(new double[] { 1.0, 4.0, 7.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0 }, 3, 3, false); var cf1 = m1.Cofactor(1, 1); Assert.AreEqual<double>(-12, Math.Round(cf1)); //var m1 = new MatrixD(new double[] { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 }, 3, 3, false); //var cf1 = m1.Cofactor(0, 0); //Assert.AreEqual<MatrixD>( // new MatrixD(new double[] { 5.0, 6.0, 8.0, 9.0 }, 2, 2), // cf1); //var m2 = new MatrixD(new double[] { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 }, 3, 3, true); //var cf2 = m2.Cofactor(0, 0); //Assert.AreEqual<MatrixD>( // new MatrixD(new double[] { 5.0, 6.0, 8.0, 9.0 }, 2, 2, true), // cf2); }