mirror of
https://github.com/TheAlgorithms/C
synced 2024-11-25 23:09:36 +03:00
remove timing calculation
This commit is contained in:
parent
eb84d85b20
commit
b12ac414d2
@ -5,7 +5,6 @@
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <complex.h>
|
||||
#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);
|
||||
|
@ -1,15 +1,15 @@
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <function_timer.h>
|
||||
|
||||
#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++)
|
||||
{
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <function_timer.h>
|
||||
|
||||
#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++)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user