ndarray-linalg
ndarray-linalg copied to clipboard
refactor div-conq SVD, impl svd_rand
credit to @pmarks for original svd_rand impl
This should probably be 2 PRs, but I wanted to post it here for discussion first.
First, I moved svddc
to svd_dc
(so we can have svd_rand
), and moved svd_dc
under the SVD_
trait, de-duplicating a lot of logic.
I also implement svd_rand
, though this version does not have the changes required for complex numbers, which we definitely want. This is dependent on a set of complex trait requirements that just works for Array2
, but is needed for sparse representations of matrices (be they sprs or a low-rank representation like M = u.dot(&v)
.
I also add an optional feature on sprs, though right now only @pmarks branch of sprs implements the Dot traits required to make svd_rand
function.