# Testing Matrices for Definiteness

The functions in this section test matrices for positive definiteness, etc. They may applied to any symmetric matrix over a real subring (i.e., ${\mathbb{Z}}$, ${\mathbb{Q}}$, or a real field), though the `SemiDefinite` functions must be over ${\mathbb{Z}}$ or ${\mathbb{Q}}$. Each function works by calling the function `OrthogonalizeGram` on its argument and then determining whether the resulting diagonal matrix has the appropriate form. Over a real field, a numerical check is made that the matrix has enough stability to determine definiteness.

## `IsPositiveDefinite(F): Mtrx -> BoolElt`

Given a symmetric matrix $F$ over the rationals or integers or a real field, return whether $F$ is positive definite, i.e., whether $vFv^{tr} > 0$ for all non-zero vectors $v\in {\mathbb{R}}^n$. Over a real field, it will fail in numerically unstable situations.

## `IsPositiveSemiDefinite(F): Mtrx -> BoolElt`

Given a symmetric matrix $F$ over the rationals or integers, return whether $F$ is positive semi-definite, i.e., whether $vFv^{tr} \geq 0$ for all non-zero vectors $v\in {\mathbb{R}}^n$.

## `IsNegativeDefinite(F): Mtrx -> BoolElt`

Given a symmetric matrix $F$ over the rationals or integers or a real field, return whether $F$ is negative definite, i.e., whether $vFv^{tr} < 0$ for all non-zero vectors $v\in {\mathbb{R}}^n$. Over a real field, it will fail in numerically unstable situations.

## `IsNegativeSemiDefinite(F): Mtrx -> BoolElt`

Given a symmetric matrix $F$ over the rationals or integers, return whether $F$ is negative semi-definite, i.e., whether $vFv^{tr} \leq 0$ for all non-zero vectors $v\in {\mathbb{R}}^n$.

## `Signature(F): Mtrx -> RngIntElt, RngIntElt, RngIntElt`

Given a symmetric matrix $F$ over the rationals or integers, return the signature of $F$, i.e. the number of positive, negative and zero eigenvalues.

## `NumericalSignature(M): Mtrx -> RngIntElt, RngIntElt`

Given a symmetric matrix over a real field, return its signature, that is, the number of positive and negative eigenvalues. Fails if (at least) one of the eigenvalues is too close to zero.
