From b12ac414d2b32b9bd60e624e1b2a04d77f35d8be Mon Sep 17 00:00:00 2001 From: Krishna Vedala Date: Mon, 20 Apr 2020 16:10:43 -0400 Subject: [PATCH] remove timing calculation --- numerical_methods/durand_kerner_roots.c | 7 ------- numerical_methods/qr_decomposition.c | 12 ++++-------- numerical_methods/qr_eigen_values.c | 5 ----- 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/numerical_methods/durand_kerner_roots.c b/numerical_methods/durand_kerner_roots.c index 6d7735a8..de0f79e0 100644 --- a/numerical_methods/durand_kerner_roots.c +++ b/numerical_methods/durand_kerner_roots.c @@ -5,7 +5,6 @@ #include #include #include -#include "function_timer.h" /*** * Try the highly unstable Wilkinson's polynomial: @@ -132,11 +131,8 @@ 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; @@ -187,8 +183,6 @@ int main(int argc, char **argv) } end: - dtime = end_timer_delete(timer); - #if defined(DEBUG) || !defined(NDEBUG) fclose(log_file); #endif @@ -197,7 +191,6 @@ 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); diff --git a/numerical_methods/qr_decomposition.c b/numerical_methods/qr_decomposition.c index a4fd58fb..a681bbf3 100644 --- a/numerical_methods/qr_decomposition.c +++ b/numerical_methods/qr_decomposition.c @@ -1,15 +1,15 @@ #include #include #include -#include #define ROWS 4 #define COLUMNS 3 double A[ROWS][COLUMNS] = { - {-3.44827586, -1.62068966, -3.03448276}, - {-1.03448276, -0.5862069, -1.31034483}, - {-1.55172414, -0.37931034, 0.03448276}}; + {1, 2, 3}, + {3, 6, 5}, + {5, 2, 8}, + {8, 9, 3}}; void print_matrix(double A[][COLUMNS], int M, int N) { @@ -137,14 +137,10 @@ int main(void) } } - function_timer *t1 = new_timer(); - start_timer(t1); qr_decompose(A, Q, R, ROWS, COLUMNS); - double dtime = end_timer_delete(t1); print_2d(R, ROWS, COLUMNS); print_2d(Q, ROWS, COLUMNS); - printf("Time taken to compute: %.4g sec\n", dtime); for (int i = 0; i < ROWS; i++) { diff --git a/numerical_methods/qr_eigen_values.c b/numerical_methods/qr_eigen_values.c index 5ed19c91..42183751 100644 --- a/numerical_methods/qr_eigen_values.c +++ b/numerical_methods/qr_eigen_values.c @@ -2,7 +2,6 @@ #include #include #include -#include #define LIMS 9 @@ -169,8 +168,6 @@ int main(int argc, char **argv) int counter = 0, num_eigs = rows - 1; double last_eig = 0; - function_timer *t1 = new_timer(); - start_timer(t1); while (num_eigs > 0) { while (fabs(A[num_eigs][num_eigs - 1]) > 1e-10) @@ -202,7 +199,6 @@ int main(int argc, char **argv) columns--; } eigen_vals[0] = A[0][0]; - double dtime = end_timer_delete(t1); #if defined(DEBUG) || !defined(NDEBUG) print_matrix(R, mat_size, mat_size); @@ -211,7 +207,6 @@ int main(int argc, char **argv) printf("Eigen vals: "); for (i = 0; i < mat_size; i++) printf("% 9.4g\t", eigen_vals[i]); - printf("\nTime taken to compute: % .4g sec\n", dtime); for (int i = 0; i < mat_size; i++) {