mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Remove random retry loops in tests (batch 1: simple scalar cases)
libeigen/eigen!2260 Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
This commit is contained in:
@@ -38,8 +38,8 @@ void basicStuff(const MatrixType& m) {
|
||||
VectorType v1 = VectorType::Random(rows), vzero = VectorType::Zero(rows);
|
||||
SquareMatrixType sm1 = SquareMatrixType::Random(rows, rows), sm2(rows, rows);
|
||||
|
||||
Scalar x = 0;
|
||||
while (x == Scalar(0)) x = internal::random<Scalar>();
|
||||
Scalar x = internal::random<Scalar>();
|
||||
if (x == Scalar(0)) x = Scalar(1);
|
||||
|
||||
Index r = internal::random<Index>(0, rows - 1), c = internal::random<Index>(0, cols - 1);
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ void linearStructure(const MatrixType& m) {
|
||||
MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols), m3(rows, cols);
|
||||
|
||||
Scalar s1 = internal::random<Scalar>();
|
||||
while (abs(s1) < RealScalar(1e-3)) s1 = internal::random<Scalar>();
|
||||
if (s1 == Scalar(0)) s1 = Scalar(1);
|
||||
|
||||
Index r = internal::random<Index>(0, rows - 1), c = internal::random<Index>(0, cols - 1);
|
||||
|
||||
|
||||
@@ -209,10 +209,7 @@ void testMatrixType(const MatrixType& m) {
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename MatrixType::RealScalar RealScalar;
|
||||
|
||||
Scalar s1;
|
||||
do {
|
||||
s1 = internal::random<Scalar>();
|
||||
} while (abs(s1) < RealScalar(1e-5) && (!NumTraits<Scalar>::IsInteger));
|
||||
Scalar s1 = internal::random<Scalar>();
|
||||
|
||||
MatrixType A;
|
||||
A.setIdentity(rows, cols);
|
||||
|
||||
Reference in New Issue
Block a user