Prev Next Index-> contents reference index search external Up-> CppAD Appendix compare_c time_det_by_minor_c CppAD-> Install Introduction AD ADFun preprocessor multi_thread utility ipopt_solve Example speed Appendix Appendix-> Faq directory Theory glossary Bib wish_list whats_new deprecated compare_c numeric_ad addon License compare_c-> det_of_minor_c det_by_minor_c uniform_01_c correct_det_by_minor_c repeat_det_by_minor_c elapsed_seconds_c time_det_by_minor_c main_compare_c time_det_by_minor_c Headings-> Syntax Purpose time_min time Source Code

Determine Amount of Time to Execute det_by_minor

Syntax
time = time_test(size, time_min)

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

time_min
The argument time_min has prototype       double time_min  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.

time
The return value time has prototype       double time  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