public void DeterminantException() { MatrixD a = new MatrixD(new double[, ] { { 1, 2 }, { 5, 6 }, { 0, 1 } }); LUDecompositionD d = new LUDecompositionD(a); double det = d.Determinant(); }
public void TestSingularMatrix() { MatrixD a = new MatrixD(new double[, ] { { 1, 2, 3 }, { 4, 5, 6 }, { 5, 7, 9 } }); LUDecompositionD d = new LUDecompositionD(a); Assert.AreEqual(true, d.IsNumericallySingular); Assert.IsTrue(Numeric.IsZero(d.Determinant())); }
public void Determinant() { MatrixD a = new MatrixD(new double[, ] { { 1, 2, 3, 4 }, { 5, 6, 7, 8 }, { 0, 1, 2, 0 }, { 1, 0, 1, 0 } }); LUDecompositionD d = new LUDecompositionD(a); Assert.AreEqual(false, d.IsNumericallySingular); Assert.IsTrue(Numeric.AreEqual(-24, d.Determinant())); MatrixD aPermuted = d.L * d.U; Assert.IsTrue(MatrixD.AreNumericallyEqual(aPermuted, a.GetSubmatrix(d.PivotPermutationVector, 0, 3))); }