Use Mathematica to decompose a given matrix $Q$ as $LDU$, where $L$, $D$ is a triangular matrix, diagonal matrix, respectively, and $U$ is the transpose of $L$.
The built-in LUDecomposition function fails for non-singular matrices.
I searched on the internet and found the NCAlgebra suite contains such a function.
<<NCAlgebra`
{ldl,p,s,rank}=NCLDLDecomposition@mat;
{ll,dd,uu}=GetFullLDUMatrices[ldl,s]
But I checked that ll.dd.uu is not the same as mat. I am not sure whether this is a bug.
Are there any more stable alternative ways to compute matrix LDU decomposition?
ResourceFunction["LDLDecomposition"]in the Wolfram Function Repository, $\endgroup$