# Predicates

The functions in this section test various properties of matrices. See also the Lattices chapter for a description of the function [`IsPositiveDefinite`](../../LatticesQuadraticForms/Lattices/definite.md#function-lat-ispositivedefinite) and related functions.

## `IsZero(A): Mtrx -> BoolElt`

Given an $m \times n$ matrix $A$ over the ring $R$, return `true` iff $A$ is the $m \times n$ zero matrix.

## `IsOne(A): Mtrx -> BoolElt`

Given a square $m \times m$ matrix $A$ over the ring $R$, return `true` iff $A$ is the $m \times m$ identity matrix.

## `IsMinusOne(A): Mtrx -> BoolElt`

Given a square $m \times m$ matrix $A$ over the ring $R$, return `true` iff $A$ is the negation of the $m \times m$ identity matrix.

## `IsScalar(A): Mtrx -> BoolElt`

Given a square $m \times m$ matrix $A$ over the ring $R$, return `true` iff $A$ is scalar, i.e., iff $A$ is the product of some element of $R$ and the $m \times m$ identity matrix.

## `IsDiagonal(A): Mtrx -> BoolElt`

Given a square matrix $A$ over the ring $R$, return `true` iff $A$ is diagonal, i.e., iff the only non-zero entries of $A$ are on the diagonal.

## `IsSymmetric(A): Mtrx -> BoolElt`

Given a square matrix $A$ over the ring $R$, return `true` iff $A$ is symmetric, i.e., iff $A$ equals its transpose.

## `IsHermitian(A, f): Mtrx, Map -> BoolElt`

Given a square matrix $A$ over the ring $R$, and an involution $f : R \to R$, return `true` iff $A$ is Hermitian with respect to $f$, i.e., iff $A$ equals applying $f$ to its transpose.

## `IsUpperTriangular(A): Mtrx -> BoolElt`

Given a matrix $A$ over the ring $R$, return `true` iff $A$ is upper triangular, i.e., iff the only non-zero entries of $A$ are on or above the diagonal.

## `IsLowerTriangular(A): Mtrx -> BoolElt`

Given a matrix $A$ over the ring $R$, return `true` iff $A$ is lower triangular, i.e., iff the only non-zero entries of $A$ are on or below the diagonal.

## `IsUnit(A): Mtrx -> BoolElt`

Given a square matrix $A$ over the ring $R$, return `true` iff $A$ is a unit, i.e., iff $A$ has an inverse. The coefficient ring $R$ may be any commutative ring (since the computation depends on testing if the determinant is a unit – a calculation which is supported in all commutative rings).

## `IsSingular(A): Mtrx -> BoolElt`

Given a square $m \times m$ matrix $A$ over the ring $R$, return `true` iff $A$ is singular, i.e., iff the determinant of $A$ is zero (or, equivalently, iff the rank of $A$ is less than $m$). Note that `(not IsSingular(A))` is *not* equivalent to `IsUnit(A)` whenever $R$ is not a field: if the determinant of $A$ is non-zero but not a unit, then $A$ is non-singular but not invertible. The coefficient ring $R$ may be any commutative ring (since the computation involves only computing the determinant and testing whether it is zero).

## `IsSymplecticMatrix(A): Mtrx -> BoolElt`

Given an $m \times m$ matrix $A$ over the integers, return `true` if and only if $A$ is an integer symplectic matrix, that is, $AJ{}^tA = J$, where $J = \left(\begin{matrix}0 & {\bf 1}_g \\ -{\bf 1}_g & 0\end{matrix}\right).$
