/**
* Returns true if the matrix is positive definite
*/
public static boolean spd(Matrix A) throws NotConvergedException {
EVD evd = EVD.factorize(A);
{
double[] S = evd.getRealEigenvalues();
for (int i = 0; i < S.length; ++i)
if (S[i] <= 0.)
return false;
}
{
double[] S = evd.getImaginaryEigenvalues();
for (int i = 0; i < S.length; ++i)
if (Math.abs(S[i]) > 1e-10)
return false;
}
return true;