1 /* fft/compare_source.c
3 * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or (at
8 * your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
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)
29 double ticks, max_ticks = 0;
33 for (i = 0; i < n; i++)
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)
44 if (max_ticks < allowed_ticks)
49 printf ("\n%s vs %s : max_ticks = %f\n", name_a, name_b, max_ticks);
51 for (i = 0; i < n; i++)
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;
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);
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)
83 double ticks, max_ticks = 0;
87 for (i = 0; i < n; i++)
89 dr = b[stride*i] - a[stride*i];
90 ticks = fabs (dr) / BASE_EPSILON;
91 if (ticks > max_ticks)
97 if (max_ticks < allowed_ticks)
102 printf ("\n%s vs %s : max_ticks = %f\n", name_a, name_b, max_ticks);
104 for (i = 0; i < n; i++)
106 dr = b[stride*i] - a[stride*i];
107 ticks = fabs (dr) / BASE_EPSILON;
118 printf ("%15s: %d %.16f %s\n", name_a, (int)i,
120 printf ("%15s: %d %.16f %e %s\n", name_b, (int)i,
121 b[stride*i], ticks, flag);