diff options
author | Deven Desai <deven.desai.amd@gmail.com> | 2018-07-11 09:17:33 -0400 |
---|---|---|
committer | Deven Desai <deven.desai.amd@gmail.com> | 2018-07-11 09:17:33 -0400 |
commit | 38807a257500cd0746b819c994efab805b8a02e4 (patch) | |
tree | 0be837e16ad1dc2b09d8f2be2f752f074b169717 /test/half_float.cpp | |
parent | e2b2c61533cb923ddba41ba7bd64b87f30a25e29 (diff) | |
parent | f00d08cc0a987fa624209b920608b56638404f13 (diff) |
merging updates from upstream
Diffstat (limited to 'test/half_float.cpp')
-rw-r--r-- | test/half_float.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/test/half_float.cpp b/test/half_float.cpp index 1b0ea9482..5a881680a 100644 --- a/test/half_float.cpp +++ b/test/half_float.cpp @@ -257,13 +257,31 @@ void test_array() ss << a1; } +void test_product() +{ + typedef Matrix<half,Dynamic,Dynamic> MatrixXh; + Index rows = internal::random<Index>(1,EIGEN_TEST_MAX_SIZE); + Index cols = internal::random<Index>(1,EIGEN_TEST_MAX_SIZE); + Index depth = internal::random<Index>(1,EIGEN_TEST_MAX_SIZE); + MatrixXh Ah = MatrixXh::Random(rows,depth); + MatrixXh Bh = MatrixXh::Random(depth,cols); + MatrixXh Ch = MatrixXh::Random(rows,cols); + MatrixXf Af = Ah.cast<float>(); + MatrixXf Bf = Bh.cast<float>(); + MatrixXf Cf = Ch.cast<float>(); + VERIFY_IS_APPROX(Ch.noalias()+=Ah*Bh, (Cf.noalias()+=Af*Bf).cast<half>()); +} + void test_half_float() { - CALL_SUBTEST(test_conversion()); CALL_SUBTEST(test_numtraits()); - CALL_SUBTEST(test_arithmetic()); - CALL_SUBTEST(test_comparison()); - CALL_SUBTEST(test_basic_functions()); - CALL_SUBTEST(test_trigonometric_functions()); - CALL_SUBTEST(test_array()); + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST(test_conversion()); + CALL_SUBTEST(test_arithmetic()); + CALL_SUBTEST(test_comparison()); + CALL_SUBTEST(test_basic_functions()); + CALL_SUBTEST(test_trigonometric_functions()); + CALL_SUBTEST(test_array()); + CALL_SUBTEST(test_product()); + } } |