MCPcopy Create free account
hub / github.com/avaxman/Directional / test_array

Function test_array

external/eigen/test/bfloat16_float.cpp:329–347  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

EIGEN_DECLARE_TESTFunction · 0.70

Calls 6

bfloat16Class · 0.70
allMethod · 0.45
absMethod · 0.45
sqrtMethod · 0.45
minCoeffMethod · 0.45
maxCoeffMethod · 0.45

Tested by

no test coverage detected