MCPcopy Create free account
hub / github.com/Derious/cuMPC / test_array

Function test_array

dependence/eigen-3.4.0/test/bfloat16_float.cpp:331–349  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

329}
330
331void 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
351void test_product()
352{

Callers 1

EIGEN_DECLARE_TESTFunction · 0.70

Calls 6

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

Tested by

no test coverage detected