Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Single Value Decomposition implementation C++ [closed]

Who can recommend a stable and correct implementation Single Value Decomposition (SVD) in C++? Preferably standalone implementation (would not want to add large library for one method).

I use OpenCV... but openCV SVD returns different decompositions(!) for a single matrix. I understand, that exists more than one decomposition of simple matrix... but why openCV do like that? random basis? or what?

This instability causes the error in my calculations in some cases, and I can't understand why. However, the results are returned by mathlab or wolframalpha - always give correct calculations ....

like image 744
Vie Avatar asked Oct 04 '10 14:10

Vie


People also ask

What is singular value decomposition explain with example?

The singular values referred to in the name “singular value decomposition” are simply the length and width of the transformed square, and those values can tell you a lot of things. For example, if one of the singular values is 0, this means that our transformation flattens our square.

Can SVD be applied to any matrix?

The singular value decomposition is very general in the sense that it can be applied to any m × n matrix, whereas eigenvalue decomposition can only be applied to diagonalizable matrices.

What is the use of singular value decomposition?

Singular Value Decomposition (SVD) is a widely used technique to decompose a matrix into several component matrices, exposing many of the useful and interesting properties of the original matrix.


1 Answers

Try redsvd (BSD license). It implements clean and very efficient, modern algorithms for SVD, including partial (truncated) SVD.

Redsvd is built on top of the beautiful C++ templating library, eigen3. Since you mention installing is an issue, you'll like to hear eigen3 requires no installation. It's just templates (C++ header files).

Also, there don't exist "more than one decomposition of a single matrix". The SVD decomposition always exists and is unique, up to flipping signs of the corresponding U/V vectors.

like image 162
Radim Avatar answered Oct 16 '22 16:10

Radim