| 233 | } |
| 234 | |
| 235 | void test_array() |
| 236 | { |
| 237 | typedef Array<half,1,Dynamic> ArrayXh; |
| 238 | Index size = internal::random<Index>(1,10); |
| 239 | Index i = internal::random<Index>(0,size-1); |
| 240 | ArrayXh a1 = ArrayXh::Random(size), a2 = ArrayXh::Random(size); |
| 241 | VERIFY_IS_APPROX( a1+a1, half(2)*a1 ); |
| 242 | VERIFY( (a1.abs() >= half(0)).all() ); |
| 243 | VERIFY_IS_APPROX( (a1*a1).sqrt(), a1.abs() ); |
| 244 | |
| 245 | VERIFY( ((a1.min)(a2) <= (a1.max)(a2)).all() ); |
| 246 | a1(i) = half(-10.); |
| 247 | VERIFY_IS_EQUAL( a1.minCoeff(), half(-10.) ); |
| 248 | a1(i) = half(10.); |
| 249 | VERIFY_IS_EQUAL( a1.maxCoeff(), half(10.) ); |
| 250 | |
| 251 | std::stringstream ss; |
| 252 | ss << a1; |
| 253 | } |
| 254 | |
| 255 | void test_half_float() |
| 256 | { |