~diresu/blender/blender-command-port

« back to all changes in this revision

Viewing changes to extern/fftw/rdft/nop2.c

  • Committer: theeth
  • Date: 2008-10-14 16:52:04 UTC
  • Revision ID: vcs-imports@canonical.com-20081014165204-r32w2gm6s0osvdhn
copy back trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2003, 2006 Matteo Frigo
 
3
 * Copyright (c) 2003, 2006 Massachusetts Institute of Technology
 
4
 *
 
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 2 of the License, or
 
8
 * (at your option) any later version.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
 *
 
19
 */
 
20
 
 
21
/* $Id: nop2.c,v 1.12 2006-01-05 03:04:27 stevenj Exp $ */
 
22
 
 
23
/* plans for vrank -infty RDFT2s (nothing to do), as well as in-place
 
24
   rank-0 HC2R.  Note that in-place rank-0 R2HC is *not* a no-op, because
 
25
   we have to set the imaginary parts of the output to zero. */
 
26
 
 
27
#include "rdft.h"
 
28
 
 
29
static void apply(const plan *ego_, R *r, R *rio, R *iio)
 
30
{
 
31
     UNUSED(ego_);
 
32
     UNUSED(r);
 
33
     UNUSED(rio);
 
34
     UNUSED(iio);
 
35
}
 
36
 
 
37
static int applicable(const solver *ego_, const problem *p_)
 
38
{
 
39
     const problem_rdft2 *p = (const problem_rdft2 *) p_;
 
40
     UNUSED(ego_);
 
41
 
 
42
     return(0
 
43
            /* case 1 : -infty vector rank */
 
44
            || (p->vecsz->rnk == RNK_MINFTY)
 
45
                 
 
46
            /* case 2 : rank-0 in-place HC2R rdft */
 
47
            || (1
 
48
                && p->kind == HC2R
 
49
                && p->sz->rnk == 0
 
50
                && FINITE_RNK(p->vecsz->rnk)
 
51
                && (p->r == p->rio || p->r == p->iio)
 
52
                && X(rdft2_inplace_strides)(p, RNK_MINFTY)
 
53
                 ));
 
54
}
 
55
 
 
56
static void print(const plan *ego, printer *p)
 
57
{
 
58
     UNUSED(ego);
 
59
     p->print(p, "(rdft2-nop)");
 
60
}
 
61
 
 
62
static plan *mkplan(const solver *ego, const problem *p, planner *plnr)
 
63
{
 
64
     static const plan_adt padt = {
 
65
          X(rdft2_solve), X(null_awake), print, X(plan_null_destroy)
 
66
     };
 
67
     plan_rdft2 *pln;
 
68
 
 
69
     UNUSED(plnr);
 
70
 
 
71
     if (!applicable(ego, p))
 
72
          return (plan *) 0;
 
73
     pln = MKPLAN_RDFT2(plan_rdft2, &padt, apply);
 
74
     X(ops_zero)(&pln->super.ops);
 
75
 
 
76
     return &(pln->super);
 
77
}
 
78
 
 
79
static solver *mksolver(void)
 
80
{
 
81
     static const solver_adt sadt = { PROBLEM_RDFT2, mkplan };
 
82
     return MKSOLVER(solver, &sadt);
 
83
}
 
84
 
 
85
void X(rdft2_nop_register)(planner *p)
 
86
{
 
87
     REGISTER_SOLVER(p, mksolver());
 
88
}