annotate src/fftw-3.3.8/libbench2/verify.c @ 84:08ae793730bd

Add null config files
author Chris Cannam
date Mon, 02 Mar 2020 14:03:47 +0000
parents d0c2a83c1364
children
rev   line source
Chris@82 1 /*
Chris@82 2 * Copyright (c) 2000 Matteo Frigo
Chris@82 3 * Copyright (c) 2000 Massachusetts Institute of Technology
Chris@82 4 *
Chris@82 5 * This program is free software; you can redistribute it and/or modify
Chris@82 6 * it under the terms of the GNU General Public License as published by
Chris@82 7 * the Free Software Foundation; either version 2 of the License, or
Chris@82 8 * (at your option) any later version.
Chris@82 9 *
Chris@82 10 * This program is distributed in the hope that it will be useful,
Chris@82 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@82 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@82 13 * GNU General Public License for more details.
Chris@82 14 *
Chris@82 15 * You should have received a copy of the GNU General Public License
Chris@82 16 * along with this program; if not, write to the Free Software
Chris@82 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Chris@82 18 *
Chris@82 19 */
Chris@82 20
Chris@82 21
Chris@82 22 #include <stdio.h>
Chris@82 23 #include <stdlib.h>
Chris@82 24
Chris@82 25 #include "verify.h"
Chris@82 26
Chris@82 27 void verify_problem(bench_problem *p, int rounds, double tol)
Chris@82 28 {
Chris@82 29 errors e;
Chris@82 30 const char *pstring = p->pstring ? p->pstring : "<unknown problem>";
Chris@82 31
Chris@82 32 switch (p->kind) {
Chris@82 33 case PROBLEM_COMPLEX: verify_dft(p, rounds, tol, &e); break;
Chris@82 34 case PROBLEM_REAL: verify_rdft2(p, rounds, tol, &e); break;
Chris@82 35 case PROBLEM_R2R: verify_r2r(p, rounds, tol, &e); break;
Chris@82 36 }
Chris@82 37
Chris@82 38 if (verbose)
Chris@82 39 ovtpvt("%s %g %g %g\n", pstring, e.l, e.i, e.s);
Chris@82 40 }
Chris@82 41
Chris@82 42 void verify(const char *param, int rounds, double tol)
Chris@82 43 {
Chris@82 44 bench_problem *p;
Chris@82 45
Chris@82 46 p = problem_parse(param);
Chris@82 47 problem_alloc(p);
Chris@82 48
Chris@82 49 if (!can_do(p)) {
Chris@82 50 ovtpvt_err("No can_do for %s\n", p->pstring);
Chris@82 51 BENCH_ASSERT(0);
Chris@82 52 }
Chris@82 53
Chris@82 54 problem_zero(p);
Chris@82 55 setup(p);
Chris@82 56
Chris@82 57 verify_problem(p, rounds, tol);
Chris@82 58
Chris@82 59 done(p);
Chris@82 60 problem_destroy(p);
Chris@82 61 }
Chris@82 62
Chris@82 63
Chris@82 64 static void do_accuracy(bench_problem *p, int rounds, int impulse_rounds)
Chris@82 65 {
Chris@82 66 double t[6];
Chris@82 67
Chris@82 68 switch (p->kind) {
Chris@82 69 case PROBLEM_COMPLEX:
Chris@82 70 accuracy_dft(p, rounds, impulse_rounds, t); break;
Chris@82 71 case PROBLEM_REAL:
Chris@82 72 accuracy_rdft2(p, rounds, impulse_rounds, t); break;
Chris@82 73 case PROBLEM_R2R:
Chris@82 74 accuracy_r2r(p, rounds, impulse_rounds, t); break;
Chris@82 75 }
Chris@82 76
Chris@82 77 /* t[0] : L1 error
Chris@82 78 t[1] : L2 error
Chris@82 79 t[2] : Linf error
Chris@82 80 t[3..5]: L1, L2, Linf backward error */
Chris@82 81 ovtpvt("%6.2e %6.2e %6.2e %6.2e %6.2e %6.2e\n",
Chris@82 82 t[0], t[1], t[2], t[3], t[4], t[5]);
Chris@82 83 }
Chris@82 84
Chris@82 85 void accuracy(const char *param, int rounds, int impulse_rounds)
Chris@82 86 {
Chris@82 87 bench_problem *p;
Chris@82 88 p = problem_parse(param);
Chris@82 89 BENCH_ASSERT(can_do(p));
Chris@82 90 problem_alloc(p);
Chris@82 91 problem_zero(p);
Chris@82 92 setup(p);
Chris@82 93 do_accuracy(p, rounds, impulse_rounds);
Chris@82 94 done(p);
Chris@82 95 problem_destroy(p);
Chris@82 96 }