void accuracy_dft(bench_problem *p, int rounds, int impulse_rounds, double t[6]) { dofft_dft_closure k; int n; C *a, *b; BENCH_ASSERT(p->kind == PROBLEM_COMPLEX); BENCH_ASSERT(p->sz->rnk == 1); BENCH_ASSERT(p->vecsz->rnk == 0); k.k.apply = dft_apply; k.k.recopy_input = 0; k.p = p; n = tensor_sz(p->sz); a = (C *) bench_malloc(n * sizeof(C)); b = (C *) bench_malloc(n * sizeof(C)); accuracy_test(&k.k, 0, p->sign, n, a, b, rounds, impulse_rounds, t); bench_free(b); bench_free(a); }
void accuracy_r2r(bench_problem *p, int rounds, int impulse_rounds, double t[6]) { dofft_r2r_closure k; int n, n0 = 1; C *a, *b; aconstrain constrain = 0; BENCH_ASSERT(p->kind == PROBLEM_R2R); BENCH_ASSERT(p->sz->rnk == 1); BENCH_ASSERT(p->vecsz->rnk == 0); k.k.apply = r2r_apply; k.k.recopy_input = 0; k.p = p; n = tensor_sz(p->sz); switch (p->k[0]) { case R2R_R2HC: constrain = mkreal; n0 = n; break; case R2R_HC2R: constrain = mkhermitian1; n0 = n; break; case R2R_REDFT00: constrain = mkre00; n0 = 2*(n-1); break; case R2R_RODFT00: constrain = mkro00; n0 = 2*(n+1); break; case R2R_REDFT01: constrain = mkre01; n0 = 4*n; break; case R2R_REDFT10: constrain = mkre10; n0 = 4*n; break; case R2R_RODFT01: constrain = mkro01; n0 = 4*n; break; case R2R_RODFT10: constrain = mkio10; n0 = 4*n; break; case R2R_REDFT11: constrain = mkre11; n0 = 8*n; break; case R2R_RODFT11: constrain = mkro11; n0 = 8*n; break; default: BENCH_ASSERT(0); /* not yet implemented */ } k.n0 = n0; a = (C *) bench_malloc(n0 * sizeof(C)); b = (C *) bench_malloc(n0 * sizeof(C)); accuracy_test(&k.k, constrain, -1, n0, a, b, rounds, impulse_rounds, t); bench_free(b); bench_free(a); }
void accuracy_rdft2(bench_problem *p, int rounds, int impulse_rounds, double t[6]) { dofft_rdft2_closure k; int n; C *a, *b; BENCH_ASSERT(p->kind == PROBLEM_REAL); BENCH_ASSERT(p->sz->rnk == 1); BENCH_ASSERT(p->vecsz->rnk == 0); k.k.apply = rdft2_apply; k.k.recopy_input = 0; k.p = p; n = tensor_sz(p->sz); a = (C *) bench_malloc(n * sizeof(C)); b = (C *) bench_malloc(n * sizeof(C)); accuracy_test(&k.k, p->sign < 0 ? mkreal : mkhermitian1, p->sign, n, a, b, rounds, impulse_rounds, t); bench_free(b); bench_free(a); }