Prev Next time_det_by_minor_c

@(@\newcommand{\W}[1]{ \; #1 \; } \newcommand{\R}[1]{ {\rm #1} } \newcommand{\B}[1]{ {\bf #1} } \newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} } \newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} } \newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} } \newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }@)@
Determine Amount of Time to Execute det_by_minor

time = time_test(sizetime_min)

reports the amount of wall clock time for det_by_minor to compute the determinant of a square matrix. The size has prototype
It specifies the number of rows (and columns) in the square matrix that the determinant is being calculated for.

The argument time_min has prototype
It specifies the minimum amount of time in seconds that the test routine should take. The calculations is repeated the necessary number of times so that this amount of execution time (or more) is reached.

The return value time has prototype
and is the number of wall clock seconds that it took for det_by_minor to compute its determinant (plus overhead which includes choosing a random matrix).

Source Code
double time_det_by_minor(size_t size, double time_min)
{     size_t repeat;
     double s0, s1, time;
     repeat = 0;
     s0     = elapsed_seconds();
     s1     = s0;
     while( s1 - s0 < time_min )
     {     if( repeat == 0 )
               repeat = 1;
          else     repeat = 2 * repeat;
          s0     = elapsed_seconds();
          repeat_det_by_minor(repeat, size);
          s1     = elapsed_seconds();
     time = (s1 - s0) / (double) repeat;
     return time;

Input File: test_more/compare_c/det_by_minor.c