12 template<
typename T,
typename U>
17 template<
typename T,
typename U>
23 template<
typename T,
typename U>
32 <<
"\n actual = " << actual
33 <<
"\n expected = " <<
expected <<
"\n\n";
37 #define VERIFY_IS_EQUAL_OR_NANS(a, b) VERIFY(test_is_equal_or_nans(a, b))
49 for(
int k=0; k<100; ++k)
51 T x = internal::random<T>();
70 for(
int k=0; k<100; ++k)
72 T x = internal::random<T>();
81 for (
int i=0;
i<1000; ++
i) {
90 const T inf = std::numeric_limits<T>::infinity();
91 const T nan = std::numeric_limits<T>::quiet_NaN();
102 typedef typename std::complex<T> ComplexT;
104 for (
int i=0;
i<1000; ++
i) {
105 const ComplexT
x = internal::random<ComplexT>();
113 const T inf = std::numeric_limits<T>::infinity();
114 const T nan = std::numeric_limits<T>::quiet_NaN();
117 const int kNumCorners = 20;
118 const ComplexT
corners[kNumCorners][2] = {
123 {ComplexT(one,
inf), ComplexT(
inf,
inf)},
124 {ComplexT(nan,
inf), ComplexT(
inf,
inf)},
125 {ComplexT(one, -
inf), ComplexT(
inf, -
inf)},
126 {ComplexT(nan, -
inf), ComplexT(
inf, -
inf)},
131 {ComplexT(-
inf, nan), ComplexT(nan,
inf)},
132 {ComplexT(
inf, nan), ComplexT(
inf, nan)},
133 {ComplexT(
zero, nan), ComplexT(nan, nan)},
134 {ComplexT(one, nan), ComplexT(nan, nan)},
135 {ComplexT(nan,
zero), ComplexT(nan, nan)},
136 {ComplexT(nan, one), ComplexT(nan, nan)},
137 {ComplexT(nan, -one), ComplexT(nan, nan)},
138 {ComplexT(nan, nan), ComplexT(nan, nan)},
141 for (
int i=0;
i<kNumCorners; ++
i) {
143 const ComplexT sqrtx =
corners[
i][1];
159 const T inf = std::numeric_limits<T>::infinity();
160 const T nan = std::numeric_limits<T>::quiet_NaN();
162 for (
int i=0;
i<1000; ++
i) {
165 const T invx = one /
x;
180 typedef typename std::complex<T> ComplexT;
183 const T inf = std::numeric_limits<T>::infinity();
184 const T nan = std::numeric_limits<T>::quiet_NaN();
186 for (
int i=0;
i<1000; ++
i) {
187 const ComplexT
x = internal::random<ComplexT>();
188 const ComplexT invx = ComplexT(one,
zero) /
x;
199 #if (EIGEN_COMP_GNUC)
201 const int kNumCorners = 20;
202 const ComplexT
corners[kNumCorners][2] = {
208 {ComplexT(one,
inf), ComplexT(
inf,
inf)},
209 {ComplexT(nan,
inf), ComplexT(
inf,
inf)},
210 {ComplexT(one, -
inf), ComplexT(
inf, -
inf)},
211 {ComplexT(nan, -
inf), ComplexT(
inf, -
inf)},
217 {ComplexT(-
inf, nan), ComplexT(nan,
inf)},
218 {ComplexT(
inf, nan), ComplexT(
inf, nan)},
219 {ComplexT(
zero, nan), ComplexT(nan, nan)},
220 {ComplexT(one, nan), ComplexT(nan, nan)},
221 {ComplexT(nan,
zero), ComplexT(nan, nan)},
222 {ComplexT(nan, one), ComplexT(nan, nan)},
223 {ComplexT(nan, -one), ComplexT(nan, nan)},
224 {ComplexT(nan, nan), ComplexT(nan, nan)},
227 for (
int i=0;
i<kNumCorners; ++
i) {
229 const ComplexT rsqrtx = ComplexT(one,
zero) /
corners[
i][1];