Fix deflation in BDCSVD.
Fixes #2491 (closed).
There were a couple issues with deflation44. Went back to the original paper to fix:
- swapped role of i, j to be more consistent with the paper
- use
hypot
instead ofsqrt(c^2 + r^2)
for better numeric stability - original code copied over the wrong diagonal element, which led to incorrect comparisons in future deflation44 steps, and a non-strictly-increasing diagonal.
With these changes, we now converge for the edge case of a large constant matrix - the diagonal is now guaranteed to be strictly increasing as described in the paper, so we no longer need the hack to avoid singularities in the perturbation step.