问题描述
谁能推荐一个稳定和正确实施单值分解(SVD)的C ++? preferably独立实施(不想加大型图书馆的一种方法)。
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).
我用OpenCV的......但是OpenCV的SVD返回不同的分解(!)的一个矩阵。据我所知,存在简单矩阵的多个分解......但为什么OpenCV的做这样的?随机的基础上?还是什么?
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?
这不稳定导致错误在我的计算,在某些情况下,我不明白为什么。 然而,结果被mathlab或WolframAlpha的回来了 - 总是得到正确的计算结果....
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 ....
推荐答案
如果你不能找到一个独立的实现,您可以尝试的这确实SVD。这是pretty的大,但它的模板,只有这样你只需要一个运行时依赖。
If you can't find a stand-alone implementation, you might try the eigen library which does SVD . It is pretty large, however it is template-only so you only have a compile-time dependency.
这篇关于单值分解落实C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!