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