| 329 | } |
| 330 | |
| 331 | void test_array() |
| 332 | { |
| 333 | typedef Array<bfloat16,1,Dynamic> ArrayXh; |
| 334 | Index size = internal::random<Index>(1,10); |
| 335 | Index i = internal::random<Index>(0,size-1); |
| 336 | ArrayXh a1 = ArrayXh::Random(size), a2 = ArrayXh::Random(size); |
| 337 | VERIFY_IS_APPROX( a1+a1, bfloat16(2)*a1 ); |
| 338 | VERIFY( (a1.abs() >= bfloat16(0)).all() ); |
| 339 | VERIFY_IS_APPROX( (a1*a1).sqrt(), a1.abs() ); |
| 340 | |
| 341 | VERIFY( ((a1.min)(a2) <= (a1.max)(a2)).all() ); |
| 342 | a1(i) = bfloat16(-10.); |
| 343 | VERIFY_IS_EQUAL( a1.minCoeff(), bfloat16(-10.) ); |
| 344 | a1(i) = bfloat16(10.); |
| 345 | VERIFY_IS_EQUAL( a1.maxCoeff(), bfloat16(10.) ); |
| 346 | |
| 347 | std::stringstream ss; |
| 348 | ss << a1; |
| 349 | } |
| 350 | |
| 351 | void test_product() |
| 352 | { |