mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Remove random retry loops in tests (batch 5: geometry, mixing types, triangular)
libeigen/eigen!2264 Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
This commit is contained in:
@@ -96,9 +96,9 @@ void lines() {
|
||||
Vector u = Vector::Random();
|
||||
Vector v = Vector::Random();
|
||||
Scalar a = internal::random<Scalar>();
|
||||
while (abs(a - 1) < Scalar(1e-4)) a = internal::random<Scalar>();
|
||||
while (u.norm() < Scalar(1e-4)) u = Vector::Random();
|
||||
while (v.norm() < Scalar(1e-4)) v = Vector::Random();
|
||||
if (abs(a - 1) < Scalar(1e-4)) a = Scalar(0);
|
||||
if (u.norm() < Scalar(1e-4)) u = Vector::Unit(0);
|
||||
if (v.norm() < Scalar(1e-4)) v = Vector::Unit(1);
|
||||
|
||||
HLine line_u = HLine::Through(center + u, center + a * u);
|
||||
HLine line_v = HLine::Through(center + v, center + a * v);
|
||||
|
||||
@@ -162,9 +162,8 @@ void transformations() {
|
||||
|
||||
// Transform
|
||||
// TODO complete the tests !
|
||||
a = 0;
|
||||
while (abs(a) < Scalar(0.1))
|
||||
a = internal::random<Scalar>(-Scalar(0.4) * Scalar(EIGEN_PI), Scalar(0.4) * Scalar(EIGEN_PI));
|
||||
a = internal::random<Scalar>(-Scalar(0.4) * Scalar(EIGEN_PI), Scalar(0.4) * Scalar(EIGEN_PI));
|
||||
if (abs(a) < Scalar(0.1)) a = Scalar(0.1);
|
||||
q1 = AngleAxisx(a, v0.normalized());
|
||||
Transform3 t0, t1, t2;
|
||||
|
||||
|
||||
@@ -77,10 +77,10 @@ void mixingtypes(int size = SizeAtCompileType) {
|
||||
float epsf = std::sqrt(std::numeric_limits<float>::min EIGEN_EMPTY());
|
||||
double epsd = std::sqrt(std::numeric_limits<double>::min EIGEN_EMPTY());
|
||||
|
||||
while (std::abs(sf) < epsf) sf = internal::random<float>();
|
||||
while (std::abs(sd) < epsd) sd = internal::random<double>();
|
||||
while (std::abs(scf) < epsf) scf = internal::random<CF>();
|
||||
while (std::abs(scd) < epsd) scd = internal::random<CD>();
|
||||
if (std::abs(sf) < epsf) sf = 1.0f;
|
||||
if (std::abs(sd) < epsd) sd = 1.0;
|
||||
if (std::abs(scf) < epsf) scf = CF(1);
|
||||
if (std::abs(scd) < epsd) scd = CD(1);
|
||||
|
||||
// check scalar products
|
||||
VERIFY_MIX_SCALAR(vcf * sf, vcf * complex<float>(sf));
|
||||
|
||||
@@ -86,7 +86,7 @@ void triangular_square(const MatrixType& m) {
|
||||
|
||||
m1 = MatrixType::Random(rows, cols);
|
||||
for (int i = 0; i < rows; ++i)
|
||||
while (numext::abs2(m1(i, i)) < RealScalar(1e-1)) m1(i, i) = internal::random<Scalar>();
|
||||
if (numext::abs2(m1(i, i)) < RealScalar(1e-1)) m1(i, i) = Scalar(1);
|
||||
|
||||
Transpose<MatrixType> trm4(m4);
|
||||
// test back and forward substitution with a vector as the rhs
|
||||
|
||||
Reference in New Issue
Block a user