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

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