cpp_fun_speed

View page source

Determine C++ Execution Speed

Syntax

      # include <cmpad/fun_speed.hpp>
      y = fun_obj ( x )
      rate = cmpad::fun_speed ( fun_obj, option, min_time )

Prototype

template <class Fun_Obj> double fun_speed(
   Fun_Obj&         fun_obj    ,
   const option_t&  option     ,
   double           min_time   )

fun_obj

We are testing the speed of the evaluation of y by this function object.

x

This is a cmpad::vector<double> object with size equal to the dimension of the domain space for the function object.

y

This is a cmpad::vector<double> object with size equal to the dimension of the range space for the function object.

option

This is the option_t object used to setup the function object with the call

   fun_obj.setup(option)

time_setup

If option.time_setup is true (false) the setup function is (is not) included in the time for each function evaluation. If the setup time is not included, the only thing that changes between function evaluations is the argument vector x .

min_time

This is the minimum time in seconds for the timing of the computation. The computation of the function object will be repeated enough times so that this minimum time is reached.

rate

This is the speed of one computation of the function object; i.e., the number of times per second that the function object gets computed.

Example

xam_fun_speed.cpp is an example and test that uses this function.