added timing for durand_kramer

This commit is contained in:
Krishna Vedala 2020-04-20 14:57:27 -04:00
parent 205bcdd9a1
commit 1cd50024b5
No known key found for this signature in database
GPG Key ID: BA19ACF8FC8792F7
1 changed files with 7 additions and 1 deletions

View File

@ -5,6 +5,7 @@
#include <string.h>
#include <limits.h>
#include <complex.h>
#include "function_timer.h"
/***
* Try the highly unstable Wilkinson's polynomial:
@ -131,8 +132,11 @@ int main(int argc, char **argv)
#endif
double tol_condition = 1;
double dtime;
unsigned long iter = 0;
function_timer *timer = new_timer();
start_timer(timer);
while (!check_termination(tol_condition) && iter < INT_MAX)
{
long double complex delta = 0;
@ -181,9 +185,10 @@ int main(int argc, char **argv)
fprintf(log_file, "%.4g", tol_condition);
#endif
}
end:
dtime = end_timer(timer);
#if defined(DEBUG) || !defined(NDEBUG)
fclose(log_file);
#endif
@ -192,6 +197,7 @@ end:
for (n = 0; n < degree - 1; n++)
printf("\t%s\n", complex_str(s0[n]));
printf("absolute average change: %.4g\n", tol_condition);
printf("Time taken: %.4g sec\n", dtime);
free(coeffs);
free(s0);