File tree Expand file tree Collapse file tree
Libraries/oneMKL/binomial/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77#include < cmath>
88#include < cstdio>
99#include < vector>
10+ #include < iostream>
1011
1112#include " binomial.hpp"
1213
@@ -34,7 +35,8 @@ void BlackScholesRefImpl(double& callResult,
3435 callResult = (S * N_d1 - L * std::exp (-r * t) * N_d2);
3536}
3637
37- void Binomial::check () {
38+ template <typename DATA_TYPE>
39+ void Binomial<DATA_TYPE>::check() {
3840 if (VERBOSE) {
3941 std::printf (" Creating the reference result...\n " );
4042 std::vector<double > h_call_result_host (opt_n);
@@ -64,8 +66,16 @@ void Binomial::check() {
6466}
6567
6668int main (int argc, char ** argv) {
67- Binomial test;
68- test.run ();
69- test.check ();
69+ if (is_fp64 ()){
70+ Binomial<double > test;
71+ test.run ();
72+ test.check ();
73+ }
74+ else {
75+ std::cout<<" Warning: could not find a device with double precision support. Single precision is used." <<std::endl;
76+ Binomial<float > test;
77+ test.run ();
78+ test.check ();
79+ }
7080 return 0 ;
7181}
You can’t perform that action at this time.
0 commit comments