Skip to content

Commit be6851c

Browse files
committed
Make dampedInverse compatible with full U and/or full V
1 parent b8fe09c commit be6851c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/sot/core/matrix-svd.hh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ void dampedInverse( const JacobiSVD <dg::Matrix>& svd,
5555
ArrayWrapper<const SV_t> sigmas (svd.singularValues());
5656

5757
SV_t sv_inv (sigmas / (sigmas.cwiseAbs2() + threshold * threshold));
58+
const dg::Matrix::Index m = std::min(svd.rows(), svd.cols());
5859

5960
_inverseMatrix.noalias() =
60-
( svd.matrixV() * sv_inv.asDiagonal() * svd.matrixU().transpose());
61+
( svd.matrixV().rightCols(m) * sv_inv.asDiagonal() * svd.matrixU().rightCols(m).transpose());
6162
}
6263

6364
void dampedInverse( const dg::Matrix& _inputMatrix,

0 commit comments

Comments
 (0)