27 bool complex_real_product_ok =
true;
31 int ibeta, it, iemin, iemax;
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;
57 Scalar factor = internal::random<Scalar>();
59 factor = internal::random<Scalar>();
62 factor = internal::random<Scalar>();
64 factor = internal::random<Scalar>();
69 MatrixType vzero = MatrixType::Zero(rows, cols),
70 vrand = MatrixType::Random(rows, cols),
90 RealScalar
size =
static_cast<RealScalar
>(m.size());
120 Index i = internal::random<Index>(0,rows-1);
121 Index j = internal::random<Index>(0,cols-1);
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();
180 vcopy.stableNormalize();
187 VERIFY_IS_APPROX(vbig/big_scaling, (vbig.stableNorm() * vbig.stableNormalized()).
eval()/big_scaling);
197 CALL_SUBTEST_3(
stable_norm(VectorXd(internal::random<int>(10,2000))) );
198 CALL_SUBTEST_4(
stable_norm(VectorXf(internal::random<int>(10,2000))) );
199 CALL_SUBTEST_5(
stable_norm(VectorXcd(internal::random<int>(10,2000))) );
EIGEN_DONT_INLINE T::Scalar hypotNorm(T &v)
EIGEN_DEVICE_FUNC const SqrtReturnType sqrt() const
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
#define EIGEN_DONT_INLINE
EIGEN_DONT_INLINE T copy(const T &x)
#define VERIFY_IS_APPROX(a, b)
constexpr int first(int i)
Implementation details for constexpr functions.
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
EIGEN_DONT_INLINE T::Scalar stableNorm(T &v)
NumTraits< Scalar >::Real RealScalar
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Abs2ReturnType abs2() const
#define VERIFY_IS_MUCH_SMALLER_THAN(a, b)
bool isPlusInf(const T &x)
void stable_norm(const MatrixType &m)
#define VERIFY_IS_NOT_APPROX(a, b)
internal::nested_eval< T, 1 >::type eval(const T &xpr)
EIGEN_DONT_INLINE T::Scalar blueNorm(T &v)
The matrix class, also used for vectors and row-vectors.
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x