Remove random retry loop in SVD min-norm test

libeigen/eigen!2263

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
This commit is contained in:
Rasmus Munk Larsen
2026-03-08 11:20:27 -07:00
parent 7c3a344763
commit 411422f2dc

View File

@@ -174,11 +174,11 @@ void svd_min_norm(const MatrixType& m) {
typedef Matrix<Scalar, ColsAtCompileTime, RankAtCompileTime2> MatrixType2T; typedef Matrix<Scalar, ColsAtCompileTime, RankAtCompileTime2> MatrixType2T;
Index rank = RankAtCompileTime2 == Dynamic ? internal::random<Index>(1, cols) : Index(RankAtCompileTime2); Index rank = RankAtCompileTime2 == Dynamic ? internal::random<Index>(1, cols) : Index(RankAtCompileTime2);
MatrixType2 m2(rank, cols); MatrixType2 m2(rank, cols);
int guard = 0; m2.setRandom();
do { if (SVD_FOR_MIN_NORM(MatrixType2)(m2).setThreshold(test_precision<Scalar>()).rank() != rank) {
m2.setRandom(); // Ensure full row rank by making the leading square block diagonally dominant.
} while (SVD_FOR_MIN_NORM(MatrixType2)(m2).setThreshold(test_precision<Scalar>()).rank() != rank && (++guard) < 100); for (Index i = 0; i < rank; ++i) m2(i, i) += Scalar(1);
VERIFY(guard < 100); }
RhsType2 rhs2 = RhsType2::Random(rank); RhsType2 rhs2 = RhsType2::Random(rank);
// use QR to find a reference minimal norm solution // use QR to find a reference minimal norm solution