If we have an $n \times n$ matrix, with all entries taken modulo $p$, how can we output the three matrixes in LDU decomposition, with all entries again modulo $p$? We can assume the input matrix is invertible.
That is, $LDU=A$, with $A$ given. $L$ is a lower-triangular matrix, $D$ is a diagonal matrix, and $U$ is an upper-triangular matrix. The entries of the results are modulo $p$.
LUDecomposition[mat,Modulus->p]
and separate out the diagonal from the upper part. $\endgroup$LUDecomposition[]
pivots, so you have an extra permutation matrix to contend with. If you need the version without pivoting, you'll have to write your own. $\endgroup$LUDecomposition[{{4, 4, 4, 3}, {0, 0, 4, 1}, {3, 3, 4, 2}, {4, 1, 0, 4}}, Modulus -> 5]
But that would be because the leading $2\times 2$ block is singular, which is exactly when pivoting is necessary. $\endgroup$