14 template<
typename Scalar>
25 const Scalar denorm_min = std::numeric_limits<Scalar>::denorm_min();
43 const int abs_cases = 13;
44 const int num_cases = 2*abs_cases * 2*abs_cases;
46 const int num_repeats = 32;
50 for (
int i = 0;
i < abs_cases; ++
i) {
51 const Scalar abs_x = abs_vals[
i];
52 for (
int sign_x = 0; sign_x < 2; ++sign_x) {
53 Scalar x_case = sign_x == 0 ? -abs_x : abs_x;
54 for (
int j = 0;
j < abs_cases; ++
j) {
55 const Scalar abs_y = abs_vals[
j];
56 for (
int sign_y = 0; sign_y < 2; ++sign_y) {
57 Scalar y_case = sign_y == 0 ? -abs_y : abs_y;
69 const Scalar tol = test_precision<Scalar>();
71 for (
int i = 0;
i < 1; ++
i) {
72 for (
int j = 0;
j < num_cases; ++
j) {
78 std::cout <<
"pow(" <<
x(
i,
j) <<
"," <<
y(
i,
j) <<
") = " <<
a <<
" != " <<
e << std::endl;
85 template<
typename ArrayType>
void array(
const ArrayType&
m)
101 ColVectorType cv1 = ColVectorType::Random(
rows);
102 RowVectorType rv1 = RowVectorType::Random(
cols);
104 Scalar s1 = internal::random<Scalar>(),
105 s2 = internal::random<Scalar>();
123 ArrayType::Map(
m1.data(),
m1.rows(),
m1.cols()) -= ArrayType::Map(
m2.data(),
m2.rows(),
m2.cols());
127 ArrayType::Map(
m1.data(),
m1.rows(),
m1.cols()) += ArrayType::Map(
m2.data(),
m2.rows(),
m2.cols());
131 ArrayType::Map(
m1.data(),
m1.rows(),
m1.cols()) *= ArrayType::Map(
m2.data(),
m2.rows(),
m2.cols());
136 m2 = (
m2==0).select(1,
m2);
137 ArrayType::Map(
m1.data(),
m1.rows(),
m1.cols()) /= ArrayType::Map(
m2.data(),
m2.rows(),
m2.cols());
148 VERIFY_IS_APPROX(
m1.colwise().sum(),
m1.colwise().redux(internal::scalar_sum_op<Scalar,Scalar>()));
165 ArrayType::RowsAtCompileTime==
Dynamic?2:ArrayType::RowsAtCompileTime,
166 ArrayType::ColsAtCompileTime==
Dynamic?2:ArrayType::ColsAtCompileTime,
167 ArrayType::Options> FixedArrayType;
169 FixedArrayType
f1(s1);
176 FixedArrayType
f4(
f1.data());
181 FixedArrayType
f1{s1};
188 FixedArrayType
f4{
f1.data()};
212 OneDArrayType o1(
rows);
214 OneDArrayType o2(
static_cast<int>(
rows));
219 OneDArrayType o1{
rows};
232 TwoDArrayType o2(
static_cast<int>(
rows),
static_cast<int>(
cols));
238 ArrayType2 o4(
static_cast<int>(
rows),
static_cast<int>(
cols));
267 Index r = internal::random<Index>(0,
rows-1),
268 c = internal::random<Index>(0,
cols-1);
275 m4 = (m4.abs()==
Scalar(0)).select(1,m4);
304 Scalar mid = (
m1.cwiseAbs().minCoeff() +
m1.cwiseAbs().maxCoeff())/
Scalar(2);
325 VERIFY( (m1<-a || m1>
a).count() == (
m1.abs()>
a).count());
351 Scalar s1 = internal::random<Scalar>();
363 #if EIGEN_HAS_CXX11_MATH
464 m3.transposeInPlace();
466 m3.transposeInPlace();
535 std::complex<RealScalar>
zero(0.0,0.0);
568 Scalar s1 = internal::random<Scalar>();
576 m2.transposeInPlace();
578 m2.transposeInPlace();
581 ArrayType m5 = ArrayType::Random(131, 131);
583 m6.transposeInPlace();
587 template<
typename ArrayType>
void min_max(
const ArrayType&
m)
617 maxM1 =
m1.template maxCoeff<PropagateNaN>();
618 minM1 =
m1.template minCoeff<PropagateNaN>();
622 maxM1 =
m1.template maxCoeff<PropagateNumbers>();
623 minM1 =
m1.template minCoeff<PropagateNumbers>();
631 template<
typename Scalar>
639 template<
typename Scalar>
653 m2 =
m1.template shiftLeft<2>();
655 m2 =
m1.template shiftLeft<9>();
658 m2 =
m1.template shiftRight<2>();
660 m2 =
m1.template shiftRight<9>();