If you don’t care about stability*, just run lu
without pivoting and extract the diagonal D
from the diagonal of U
. If it’s symmetric (and no pivoting is used), then U = DL'
.
*This is probably why such a method doesn’t exist in LinearAlgebra
.