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;
Index rank = RankAtCompileTime2 == Dynamic ? internal::random<Index>(1, cols) : Index(RankAtCompileTime2);
MatrixType2 m2(rank, cols);
int guard = 0;
do {
m2.setRandom();
} while (SVD_FOR_MIN_NORM(MatrixType2)(m2).setThreshold(test_precision<Scalar>()).rank() != rank && (++guard) < 100);
VERIFY(guard < 100);
m2.setRandom();
if (SVD_FOR_MIN_NORM(MatrixType2)(m2).setThreshold(test_precision<Scalar>()).rank() != rank) {
// Ensure full row rank by making the leading square block diagonally dominant.
for (Index i = 0; i < rank; ++i) m2(i, i) += Scalar(1);
}
RhsType2 rhs2 = RhsType2::Random(rank);
// use QR to find a reference minimal norm solution