27 bool complex_real_product_ok =
true;
31 int ibeta, it, iemin, iemax;
33 ibeta = std::numeric_limits<RealScalar>::radix;
34 it = std::numeric_limits<RealScalar>::digits;
35 iemin = std::numeric_limits<RealScalar>::min_exponent;
36 iemax = std::numeric_limits<RealScalar>::max_exponent;
38 VERIFY( (!(iemin > 1 - 2*it || 1+it>iemax || (it==2 && ibeta<5) || (it<=4 && ibeta <= 3 ) || it<2))
39 &&
"the stable norm algorithm cannot be guaranteed on this computer");
41 Scalar inf = std::numeric_limits<RealScalar>::infinity();
44 complex_real_product_ok =
false;
45 static bool first =
true;
47 std::cerr <<
"WARNING: compiler mess up complex*real product, " <<
inf <<
" * " << 1.0 <<
" = " <<
inf*
RealScalar(1) << std::endl;
59 factor = internal::random<Scalar>();
62 factor = internal::random<Scalar>();
64 factor = internal::random<Scalar>();
70 vrand = MatrixType::Random(
rows,
cols),
126 v(
i,
j) = std::numeric_limits<RealScalar>::quiet_NaN();
137 v(
i,
j) = std::numeric_limits<RealScalar>::infinity();
141 if(complex_real_product_ok){
151 v(
i,
j) = -std::numeric_limits<RealScalar>::infinity();
155 if(complex_real_product_ok) {
164 Index i2 = internal::random<Index>(0,
rows-1);
165 Index j2 = internal::random<Index>(0,
cols-1);
167 v(
i,
j) = -std::numeric_limits<RealScalar>::infinity();
168 v(i2,j2) = std::numeric_limits<RealScalar>::quiet_NaN();
173 if (i2 !=
i || j2 !=
j) {
186 vcopy.stableNormalize();
193 VERIFY_IS_APPROX(vbig/big_scaling, (vbig.stableNorm() * vbig.stableNormalized()).eval()/big_scaling);
198 template<
typename Scalar>
204 factor = internal::random<Scalar>();
207 factor = internal::random<Scalar>();
209 factor = internal::random<Scalar>();
215 nan (std::numeric_limits<RealScalar>::quiet_NaN());
217 Scalar a = internal::random<Scalar>(-1,1);
218 Scalar b = internal::random<Scalar>(-1,1);