MCPcopy Create free account
hub / github.com/PX4/eigen / test_array

Function test_array

test/half_float.cpp:235–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233}
234
235void 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
255void test_half_float()
256{

Callers 1

test_half_floatFunction · 0.70

Calls 6

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

Tested by

no test coverage detected