TODO: first changes to add expf
This commit is contained in:
@@ -8,3 +8,5 @@ TEST_CASE("sinf") { test_sinf<MKLBackend>(1e-6f); }
|
||||
TEST_CASE("cosf") { test_cosf<MKLBackend>(1e-6f); }
|
||||
|
||||
TEST_CASE("sincosf") { test_sincosf<MKLBackend>(1e-6f); }
|
||||
|
||||
TEST_CASE("expf") { test_expf<MKLBackend>(1e-6f); }
|
||||
@@ -63,3 +63,19 @@ template <typename Backend> inline void test_sincosf(float tol) {
|
||||
REQUIRE_THAT(c[i], Catch::Matchers::WithinAbs(c_ref[i], tol));
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Backend> inline void test_expf(float tol) {
|
||||
std::vector<float> x(N), e_ref(N), e(N);
|
||||
init_x(x);
|
||||
|
||||
ReferenceBackend ref;
|
||||
Backend backend;
|
||||
backend.init(N);
|
||||
|
||||
ref.compute_expf(N, x.data(), e_ref.data());
|
||||
backend.compute_expf(N, x.data(), e.data());
|
||||
|
||||
for (size_t i = 0; i < N; ++i) {
|
||||
REQUIRE_THAT(e[i], Catch::Matchers::WithinAbs(e_ref[i], tol));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user