public void DeterminantTest3()
{
double[,] m =
{
{ 0, 4, 0, 2 },
{ 4, 1, 2, 4 },
{ 0, 2, 1, 1 },
{ 2, 4, 1, 1 }
};
Assert.IsTrue(m.IsSymmetric());
Assert.IsFalse(m.IsPositiveDefinite());
double expected = 44;
bool thrown = false;
try
{
Matrix.Determinant(m, symmetric: true);
}
catch (Exception)
{
thrown = true;
}
Assert.IsTrue(thrown);
thrown = false;
try
{
Matrix.LogDeterminant(m, symmetric: true);
}
catch (Exception)
{
thrown = true;
}
Assert.IsTrue(thrown);
double det = Matrix.PseudoDeterminant(m);
Assert.AreEqual(expected, det, 1e-10);
Assert.IsFalse(Double.IsNaN(det));
}