Chris@10: /* Chris@10: * Copyright (c) 2003, 2007-11 Matteo Frigo Chris@10: * Copyright (c) 2003, 2007-11 Massachusetts Institute of Technology Chris@10: * Chris@10: * This program is free software; you can redistribute it and/or modify Chris@10: * it under the terms of the GNU General Public License as published by Chris@10: * the Free Software Foundation; either version 2 of the License, or Chris@10: * (at your option) any later version. Chris@10: * Chris@10: * This program is distributed in the hope that it will be useful, Chris@10: * but WITHOUT ANY WARRANTY; without even the implied warranty of Chris@10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Chris@10: * GNU General Public License for more details. Chris@10: * Chris@10: * You should have received a copy of the GNU General Public License Chris@10: * along with this program; if not, write to the Free Software Chris@10: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Chris@10: * Chris@10: */ Chris@10: Chris@10: Chris@10: /* plans for vrank -infty RDFT2s (nothing to do), as well as in-place Chris@10: rank-0 HC2R. Note that in-place rank-0 R2HC is *not* a no-op, because Chris@10: we have to set the imaginary parts of the output to zero. */ Chris@10: Chris@10: #include "rdft.h" Chris@10: Chris@10: static void apply(const plan *ego_, R *r0, R *r1, R *cr, R *ci) Chris@10: { Chris@10: UNUSED(ego_); Chris@10: UNUSED(r0); Chris@10: UNUSED(r1); Chris@10: UNUSED(cr); Chris@10: UNUSED(ci); Chris@10: } Chris@10: Chris@10: static int applicable(const solver *ego_, const problem *p_) Chris@10: { Chris@10: const problem_rdft2 *p = (const problem_rdft2 *) p_; Chris@10: UNUSED(ego_); Chris@10: Chris@10: return(0 Chris@10: /* case 1 : -infty vector rank */ Chris@10: || (p->vecsz->rnk == RNK_MINFTY) Chris@10: Chris@10: /* case 2 : rank-0 in-place rdft, except that Chris@10: R2HC is not a no-op because it sets the imaginary Chris@10: part to 0 */ Chris@10: || (1 Chris@10: && p->kind != R2HC Chris@10: && p->sz->rnk == 0 Chris@10: && FINITE_RNK(p->vecsz->rnk) Chris@10: && (p->r0 == p->cr) Chris@10: && X(rdft2_inplace_strides)(p, RNK_MINFTY) Chris@10: )); Chris@10: } Chris@10: Chris@10: static void print(const plan *ego, printer *p) Chris@10: { Chris@10: UNUSED(ego); Chris@10: p->print(p, "(rdft2-nop)"); Chris@10: } Chris@10: Chris@10: static plan *mkplan(const solver *ego, const problem *p, planner *plnr) Chris@10: { Chris@10: static const plan_adt padt = { Chris@10: X(rdft2_solve), X(null_awake), print, X(plan_null_destroy) Chris@10: }; Chris@10: plan_rdft2 *pln; Chris@10: Chris@10: UNUSED(plnr); Chris@10: Chris@10: if (!applicable(ego, p)) Chris@10: return (plan *) 0; Chris@10: pln = MKPLAN_RDFT2(plan_rdft2, &padt, apply); Chris@10: X(ops_zero)(&pln->super.ops); Chris@10: Chris@10: return &(pln->super); Chris@10: } Chris@10: Chris@10: static solver *mksolver(void) Chris@10: { Chris@10: static const solver_adt sadt = { PROBLEM_RDFT2, mkplan, 0 }; Chris@10: return MKSOLVER(solver, &sadt); Chris@10: } Chris@10: Chris@10: void X(rdft2_nop_register)(planner *p) Chris@10: { Chris@10: REGISTER_SOLVER(p, mksolver()); Chris@10: }