dimforge / nalgebra

Linear algebra library for Rust.
https://nalgebra.org
Apache License 2.0
4.04k stars 483 forks source link

Compute full SVD #588

Open michael-p opened 5 years ago

michael-p commented 5 years ago

For a matrix of shape R, C nalgebra's SVD decomposition currently computes the singular vector matrices U and V_t with shapes R, M and M, C where M = min(R, C). Although this is sufficient for many tasks like solving linear equation systems, in a lot of applications (e.g. in computer vision for homography or fundamental matrix decomposition) it is required to have a full decomposition where U and V_t have shape R, R and C, C. This is also what Eigen, nalgebra-lapack and SciPy compute by default.

It would be great if nalgebra provided this as well, at least optionally!

sebcrozet commented 5 years ago

Hi! Thank you for pointing this out. We should rename the current SVD to ThinSVD and implement the "fat" one under the SVD type.

jannschu commented 4 years ago

Is someone working on this?

astraw commented 4 years ago

@jannschu maybe the SVD implementation in nalgebra-lapack works for you, at least for now?

Ralith commented 1 year ago

I've just ran into this at well. As a non-expert, I spent a while very confused as to why nalgebra's SVD was providing matrices of weird dimensionality, since it doesn't mention "thin" anywhere.

I want the full SVD because I'm trying to compute both the pseudoinverse and null space of a matrix. This is motivated by implementation of the algorithm described in section 3.3 of Optimized Thruster Allocation Utilizing Dual Quaternions for the Asteroid Sample Return Mission (Smith, 2017).

Makogan commented 1 year ago

I would also like to have the full SVD as I need it for extracting the basis of the null space. It should be written in the documentation at the bare minimum, it is misleading to label the functionality as SVD when it in fact does not compute the SVD but a matrix subset of it.