Beispiel #1
0
void run_exprtk_benchmark(T& x, T& y,
                          exprtk::expression<T>& expression,
                          const std::string& expr_string)
{
   T total = T(0);
   unsigned int count = 0;

   exprtk::timer timer;
   timer.start();

   for (x = lower_bound_x; x <= upper_bound_x; x += delta)
   {
      for (y = lower_bound_y; y <= upper_bound_y; y += delta)
      {
         total += expression.value();
         ++count;
      }
   }

   timer.stop();

   if (T(0) != total)
      printf("[exprtk] Total Time:%12.8f  Rate:%14.3fevals/sec Expression: %s\n",
             timer.time(),
             count / timer.time(),
             expr_string.c_str());
   else
      printf("run_exprtk_benchmark() - Error running benchmark for expression: %s\n",expr_string.c_str());
}
double CFunctionImpl::value(double x) {
    this->x = x;
    return expr.value();
}