The current solution uses a fixed arbitrary threshold of 1e-10 on the singular values, I replaced it with the common heuristic n*eps*max(s).
The current solution uses a fixed arbitrary threshold of 1e-10 on the singular values, I replaced it with the common heuristic n*eps*max(s).