From 411422f2dcafe63e36cf85d49cf91d8439a44338 Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen <4643818-rmlarsen1@users.noreply.gitlab.com> Date: Sun, 8 Mar 2026 11:20:27 -0700 Subject: [PATCH] Remove random retry loop in SVD min-norm test libeigen/eigen!2263 Co-authored-by: Rasmus Munk Larsen --- test/svd_common.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/svd_common.h b/test/svd_common.h index 0421d66b3..a9aa3b2eb 100644 --- a/test/svd_common.h +++ b/test/svd_common.h @@ -174,11 +174,11 @@ void svd_min_norm(const MatrixType& m) { typedef Matrix MatrixType2T; Index rank = RankAtCompileTime2 == Dynamic ? internal::random(1, cols) : Index(RankAtCompileTime2); MatrixType2 m2(rank, cols); - int guard = 0; - do { - m2.setRandom(); - } while (SVD_FOR_MIN_NORM(MatrixType2)(m2).setThreshold(test_precision()).rank() != rank && (++guard) < 100); - VERIFY(guard < 100); + m2.setRandom(); + if (SVD_FOR_MIN_NORM(MatrixType2)(m2).setThreshold(test_precision()).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