| 300 | } |
| 301 | |
| 302 | void test_array() |
| 303 | { |
| 304 | typedef Array<half,1,Dynamic> ArrayXh; |
| 305 | Index size = internal::random<Index>(1,10); |
| 306 | Index i = internal::random<Index>(0,size-1); |
| 307 | ArrayXh a1 = ArrayXh::Random(size), a2 = ArrayXh::Random(size); |
| 308 | VERIFY_IS_APPROX( a1+a1, half(2)*a1 ); |
| 309 | VERIFY( (a1.abs() >= half(0)).all() ); |
| 310 | VERIFY_IS_APPROX( (a1*a1).sqrt(), a1.abs() ); |
| 311 | |
| 312 | VERIFY( ((a1.min)(a2) <= (a1.max)(a2)).all() ); |
| 313 | a1(i) = half(-10.); |
| 314 | VERIFY_IS_EQUAL( a1.minCoeff(), half(-10.) ); |
| 315 | a1(i) = half(10.); |
| 316 | VERIFY_IS_EQUAL( a1.maxCoeff(), half(10.) ); |
| 317 | |
| 318 | std::stringstream ss; |
| 319 | ss << a1; |
| 320 | } |
| 321 | |
| 322 | void test_product() |
| 323 | { |