This would probably work by setting all small negative values to be 0, which makes it positive semi-deifnite and low-rank
At that point, the it could be multiplied back to create the matrix, and then take the cholesky, or maybe the eigenvalue decomposition or QR could be manipulated directly.
The current "regularization" hack to deal with lower-rank stationary distributions could be replaced with something more stable. That has two parts:
lyapd
instead of regularization directly or taking the cholesky https://github.com/HighDimensionalEconLab/DifferentiableStateSpaceModels.jl/blob/v0.4.14/src/generate_perturbation.jl#L250-L251