| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
#include "gsl_fft__compare.h" |
| 21 |
|
| 22 |
int |
| 23 |
FUNCTION(compare_complex,results) (const char *name_a, const BASE a[], |
| 24 |
const char *name_b, const BASE b[], |
| 25 |
size_t stride, size_t n, |
| 26 |
const double allowed_ticks) |
| 27 |
{ |
| 28 |
size_t i; |
| 29 |
double ticks, max_ticks = 0; |
| 30 |
double dr, di; |
| 31 |
const char *flag; |
| 32 |
|
| 33 |
for (i = 0; i < n; i++) |
| 34 |
{ |
| 35 |
dr = b[2*stride*i] - a[2*stride*i]; |
| 36 |
di = b[2*stride*i+1] - a[2*stride*i+1]; |
| 37 |
ticks = (fabs (dr) + fabs (di)) / BASE_EPSILON; |
| 38 |
if (ticks > max_ticks) |
| 39 |
{ |
| 40 |
max_ticks = ticks; |
| 41 |
} |
| 42 |
} |
| 43 |
|
| 44 |
if (max_ticks < allowed_ticks) |
| 45 |
{ |
| 46 |
return 0; |
| 47 |
} |
| 48 |
|
| 49 |
printf ("\n%s vs %s : max_ticks = %f\n", name_a, name_b, max_ticks); |
| 50 |
|
| 51 |
for (i = 0; i < n; i++) |
| 52 |
{ |
| 53 |
dr = b[2*stride*i] - a[2*stride*i]; |
| 54 |
di = b[2*stride*i+1] - a[2*stride*i+1]; |
| 55 |
ticks = (fabs (dr) + fabs (di)) / BASE_EPSILON; |
| 56 |
|
| 57 |
if (ticks > 1000) |
| 58 |
{ |
| 59 |
flag = "***"; |
| 60 |
} |
| 61 |
else |
| 62 |
{ |
| 63 |
flag = ""; |
| 64 |
} |
| 65 |
|
| 66 |
printf ("%15s: %d %.16f %.16f %s\n", name_a, (int)i, |
| 67 |
a[2*stride*i], a[2*stride*i+1], flag); |
| 68 |
printf ("%15s: %d %.16f %.16f %e %s\n", name_b, (int)i, |
| 69 |
b[2*stride*i], b[2*stride*i+1], ticks, flag); |
| 70 |
} |
| 71 |
|
| 72 |
return -1; |
| 73 |
} |
| 74 |
|
| 75 |
|
| 76 |
int |
| 77 |
FUNCTION(compare_real,results) (const char *name_a, const BASE a[], |
| 78 |
const char *name_b, const BASE b[], |
| 79 |
size_t stride, size_t n, |
| 80 |
const double allowed_ticks) |
| 81 |
{ |
| 82 |
size_t i; |
| 83 |
double ticks, max_ticks = 0; |
| 84 |
double dr; |
| 85 |
const char *flag; |
| 86 |
|
| 87 |
for (i = 0; i < n; i++) |
| 88 |
{ |
| 89 |
dr = b[stride*i] - a[stride*i]; |
| 90 |
ticks = fabs (dr) / BASE_EPSILON; |
| 91 |
if (ticks > max_ticks) |
| 92 |
{ |
| 93 |
max_ticks = ticks; |
| 94 |
} |
| 95 |
} |
| 96 |
|
| 97 |
if (max_ticks < allowed_ticks) |
| 98 |
{ |
| 99 |
return 0; |
| 100 |
} |
| 101 |
|
| 102 |
printf ("\n%s vs %s : max_ticks = %f\n", name_a, name_b, max_ticks); |
| 103 |
|
| 104 |
for (i = 0; i < n; i++) |
| 105 |
{ |
| 106 |
dr = b[stride*i] - a[stride*i]; |
| 107 |
ticks = fabs (dr) / BASE_EPSILON; |
| 108 |
|
| 109 |
if (ticks > 1000) |
| 110 |
{ |
| 111 |
flag = "***"; |
| 112 |
} |
| 113 |
else |
| 114 |
{ |
| 115 |
flag = ""; |
| 116 |
} |
| 117 |
|
| 118 |
printf ("%15s: %d %.16f %s\n", name_a, (int)i, |
| 119 |
a[stride*i], flag); |
| 120 |
printf ("%15s: %d %.16f %e %s\n", name_b, (int)i, |
| 121 |
b[stride*i], ticks, flag); |
| 122 |
} |
| 123 |
|
| 124 |
return -1; |
| 125 |
} |