fix bug in sorting of singular values

This commit is contained in:
Benoit Jacob 2009-08-09 00:05:38 +02:00
parent b10637be50
commit 5f8d58f36a

View File

@ -393,8 +393,9 @@ void SVD<MatrixType>::compute(const MatrixType& matrix)
{
int k;
W.end(n-i).minCoeff(&k);
if (k != i)
if (k != 0)
{
k += i;
std::swap(W[k],W[i]);
A.col(i).swap(A.col(k));
V.col(i).swap(V.col(k));