GUI: try using FFTW for per-chan osc wave center

not reliable yet
This commit is contained in:
tildearrow 2022-05-31 03:24:29 -05:00
parent c306b33603
commit 54e93db207
3504 changed files with 492683 additions and 21 deletions

59
extern/fftw/api/Makefile.am vendored Normal file
View file

@ -0,0 +1,59 @@
AM_CPPFLAGS = -I $(top_srcdir)
AM_CFLAGS = $(STACK_ALIGN_CFLAGS)
EXTRA_DIST = f03api.sh genf03.pl fftw3.f03.in
include_HEADERS = fftw3.h fftw3.f fftw3l.f03 fftw3q.f03
nodist_include_HEADERS = fftw3.f03
noinst_LTLIBRARIES = libapi.la
libapi_la_SOURCES = apiplan.c configure.c execute-dft-c2r.c \
execute-dft-r2c.c execute-dft.c execute-r2r.c execute-split-dft-c2r.c \
execute-split-dft-r2c.c execute-split-dft.c execute.c \
export-wisdom-to-file.c export-wisdom-to-string.c export-wisdom.c \
f77api.c flops.c forget-wisdom.c import-system-wisdom.c \
import-wisdom-from-file.c import-wisdom-from-string.c import-wisdom.c \
malloc.c map-r2r-kind.c mapflags.c mkprinter-file.c mkprinter-str.c \
mktensor-iodims.c mktensor-rowmajor.c plan-dft-1d.c plan-dft-2d.c \
plan-dft-3d.c plan-dft-c2r-1d.c plan-dft-c2r-2d.c plan-dft-c2r-3d.c \
plan-dft-c2r.c plan-dft-r2c-1d.c plan-dft-r2c-2d.c plan-dft-r2c-3d.c \
plan-dft-r2c.c plan-dft.c plan-guru-dft-c2r.c plan-guru-dft-r2c.c \
plan-guru-dft.c plan-guru-r2r.c plan-guru-split-dft-c2r.c \
plan-guru-split-dft-r2c.c plan-guru-split-dft.c plan-many-dft-c2r.c \
plan-many-dft-r2c.c plan-many-dft.c plan-many-r2r.c plan-r2r-1d.c \
plan-r2r-2d.c plan-r2r-3d.c plan-r2r.c print-plan.c rdft2-pad.c \
the-planner.c version.c api.h f77funcs.h fftw3.h x77.h guru.h \
guru64.h mktensor-iodims.h plan-guru-dft-c2r.h plan-guru-dft-r2c.h \
plan-guru-dft.h plan-guru-r2r.h plan-guru-split-dft-c2r.h \
plan-guru-split-dft-r2c.h plan-guru-split-dft.h plan-guru64-dft-c2r.c \
plan-guru64-dft-r2c.c plan-guru64-dft.c plan-guru64-r2r.c \
plan-guru64-split-dft-c2r.c plan-guru64-split-dft-r2c.c \
plan-guru64-split-dft.c mktensor-iodims64.c
BUILT_SOURCES = fftw3.f fftw3.f03.in fftw3.f03 fftw3l.f03 fftw3q.f03
CLEANFILES = fftw3.f03
fftw3.f03: fftw3.f03.in
(echo "! Generated automatically. DO NOT EDIT!"; echo; \
echo " integer, parameter :: C_FFTW_R2R_KIND = @C_FFTW_R2R_KIND@"; \
grep -v "Generated automatically" $(srcdir)/fftw3.f03.in) > $@
if MAINTAINER_MODE
# convert constants to F77 PARAMETER statements
fftw3.f: fftw3.h
rm -f $@
perl -pe 's/([A-Z0-9_]+)=([+-]?[0-9]+)/\n INTEGER \1\n PARAMETER (\1=\2)\n/g' $< |egrep 'PARAMETER|INTEGER' > $@
perl -pe 's/#define +([A-Z0-9_]+) +\(([+-]?[0-9]+)U?\)/\n INTEGER \1\n PARAMETER (\1=\2)\n/g' $< |egrep 'PARAMETER|INTEGER' >> $@
perl -pe 'if (/#define +([A-Z0-9_]+) +\(([0-9]+)U? *<< *([0-9]+)\)/) { print "\n INTEGER $$1\n PARAMETER ($$1=",$$2 << $$3,")\n"; }' $< |egrep 'PARAMETER|INTEGER' >> $@
fftw3.f03.in: fftw3.h f03api.sh genf03.pl
sh $(srcdir)/f03api.sh d f > $@
fftw3l.f03: fftw3.h f03api.sh genf03.pl
sh $(srcdir)/f03api.sh l | grep -v parameter > $@
fftw3q.f03: fftw3.h f03api.sh genf03.pl
sh $(srcdir)/f03api.sh q | grep -v parameter > $@
endif # MAINTAINER_MODE

1033
extern/fftw/api/Makefile.in vendored Normal file

File diff suppressed because it is too large Load diff

117
extern/fftw/api/api.h vendored Normal file
View file

@ -0,0 +1,117 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/* internal API definitions */
#ifndef __API_H__
#define __API_H__
#ifndef CALLING_FFTW /* defined in hook.c, when calling internal functions */
# define COMPILING_FFTW /* used for DLL symbol exporting in fftw3.h */
#endif
/* When compiling with GNU libtool on Windows, DLL_EXPORT is #defined
for compiling the shared-library code. In this case, we'll #define
FFTW_DLL to add dllexport attributes to the specified functions in
fftw3.h.
If we don't specify dllexport explicitly, then libtool
automatically exports all symbols. However, if we specify
dllexport explicitly for any functions, then libtool apparently
doesn't do any automatic exporting. (Not documented, grrr, but
this is the observed behavior with libtool 1.5.8.) Thus, using
this forces us to correctly dllexport every exported symbol, or
linking bench.exe will fail. This has the advantage of forcing
us to mark things correctly, which is necessary for other compilers
(such as MS VC++). */
#ifdef DLL_EXPORT
# define FFTW_DLL
#endif
/* just in case: force <fftw3.h> not to use C99 complex numbers
(we need this for IBM xlc because _Complex_I is treated specially
and is defined even if <complex.h> is not included) */
#define FFTW_NO_Complex
#include "api/fftw3.h"
#include "kernel/ifftw.h"
#include "rdft/rdft.h"
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/* the API ``plan'' contains both the kernel plan and problem */
struct X(plan_s) {
plan *pln;
problem *prb;
int sign;
};
/* shorthand */
typedef struct X(plan_s) apiplan;
/* complex type for internal use */
typedef R C[2];
#define EXTRACT_REIM(sign, c, r, i) X(extract_reim)(sign, (c)[0], r, i)
#define TAINT_UNALIGNED(p, flg) TAINT(p, ((flg) & FFTW_UNALIGNED) != 0)
tensor *X(mktensor_rowmajor)(int rnk, const int *n,
const int *niphys, const int *nophys,
int is, int os);
tensor *X(mktensor_iodims)(int rank, const X(iodim) *dims, int is, int os);
tensor *X(mktensor_iodims64)(int rank, const X(iodim64) *dims, int is, int os);
const int *X(rdft2_pad)(int rnk, const int *n, const int *nembed,
int inplace, int cmplx, int **nfree);
int X(many_kosherp)(int rnk, const int *n, int howmany);
int X(guru_kosherp)(int rank, const X(iodim) *dims,
int howmany_rank, const X(iodim) *howmany_dims);
int X(guru64_kosherp)(int rank, const X(iodim64) *dims,
int howmany_rank, const X(iodim64) *howmany_dims);
/* Note: FFTW_EXTERN is used for "internal" functions used in tests/hook.c */
FFTW_EXTERN printer *X(mkprinter_file)(FILE *f);
printer *X(mkprinter_cnt)(size_t *cnt);
printer *X(mkprinter_str)(char *s);
FFTW_EXTERN planner *X(the_planner)(void);
void X(configure_planner)(planner *plnr);
void X(mapflags)(planner *, unsigned);
apiplan *X(mkapiplan)(int sign, unsigned flags, problem *prb);
rdft_kind *X(map_r2r_kind)(int rank, const X(r2r_kind) * kind);
typedef void (*planner_hook_t)(void);
void X(set_planner_hooks)(planner_hook_t before, planner_hook_t after);
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif /* __API_H__ */

198
extern/fftw/api/apiplan.c vendored Normal file
View file

@ -0,0 +1,198 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
static planner_hook_t before_planner_hook = 0, after_planner_hook = 0;
void X(set_planner_hooks)(planner_hook_t before, planner_hook_t after)
{
before_planner_hook = before;
after_planner_hook = after;
}
static plan *mkplan0(planner *plnr, unsigned flags,
const problem *prb, unsigned hash_info,
wisdom_state_t wisdom_state)
{
/* map API flags into FFTW flags */
X(mapflags)(plnr, flags);
plnr->flags.hash_info = hash_info;
plnr->wisdom_state = wisdom_state;
/* create plan */
return plnr->adt->mkplan(plnr, prb);
}
static unsigned force_estimator(unsigned flags)
{
flags &= ~(FFTW_MEASURE | FFTW_PATIENT | FFTW_EXHAUSTIVE);
return (flags | FFTW_ESTIMATE);
}
static plan *mkplan(planner *plnr, unsigned flags,
const problem *prb, unsigned hash_info)
{
plan *pln;
pln = mkplan0(plnr, flags, prb, hash_info, WISDOM_NORMAL);
if (plnr->wisdom_state == WISDOM_NORMAL && !pln) {
/* maybe the planner failed because of inconsistent wisdom;
plan again ignoring infeasible wisdom */
pln = mkplan0(plnr, force_estimator(flags), prb,
hash_info, WISDOM_IGNORE_INFEASIBLE);
}
if (plnr->wisdom_state == WISDOM_IS_BOGUS) {
/* if the planner detected a wisdom inconsistency,
forget all wisdom and plan again */
plnr->adt->forget(plnr, FORGET_EVERYTHING);
A(!pln);
pln = mkplan0(plnr, flags, prb, hash_info, WISDOM_NORMAL);
if (plnr->wisdom_state == WISDOM_IS_BOGUS) {
/* if it still fails, plan without wisdom */
plnr->adt->forget(plnr, FORGET_EVERYTHING);
A(!pln);
pln = mkplan0(plnr, force_estimator(flags),
prb, hash_info, WISDOM_IGNORE_ALL);
}
}
return pln;
}
apiplan *X(mkapiplan)(int sign, unsigned flags, problem *prb)
{
apiplan *p = 0;
plan *pln;
unsigned flags_used_for_planning;
planner *plnr;
static const unsigned int pats[] = {FFTW_ESTIMATE, FFTW_MEASURE,
FFTW_PATIENT, FFTW_EXHAUSTIVE};
int pat, pat_max;
double pcost = 0;
if (before_planner_hook)
before_planner_hook();
plnr = X(the_planner)();
if (flags & FFTW_WISDOM_ONLY) {
/* Special mode that returns a plan only if wisdom is present,
and returns 0 otherwise. This is now documented in the manual,
as a way to detect whether wisdom is available for a problem. */
flags_used_for_planning = flags;
pln = mkplan0(plnr, flags, prb, 0, WISDOM_ONLY);
} else {
pat_max = flags & FFTW_ESTIMATE ? 0 :
(flags & FFTW_EXHAUSTIVE ? 3 :
(flags & FFTW_PATIENT ? 2 : 1));
pat = plnr->timelimit >= 0 ? 0 : pat_max;
flags &= ~(FFTW_ESTIMATE | FFTW_MEASURE |
FFTW_PATIENT | FFTW_EXHAUSTIVE);
plnr->start_time = X(get_crude_time)();
/* plan at incrementally increasing patience until we run
out of time */
for (pln = 0, flags_used_for_planning = 0; pat <= pat_max; ++pat) {
plan *pln1;
unsigned tmpflags = flags | pats[pat];
pln1 = mkplan(plnr, tmpflags, prb, 0u);
if (!pln1) {
/* don't bother continuing if planner failed or timed out */
A(!pln || plnr->timed_out);
break;
}
X(plan_destroy_internal)(pln);
pln = pln1;
flags_used_for_planning = tmpflags;
pcost = pln->pcost;
}
}
if (pln) {
/* build apiplan */
p = (apiplan *) MALLOC(sizeof(apiplan), PLANS);
p->prb = prb;
p->sign = sign; /* cache for execute_dft */
/* re-create plan from wisdom, adding blessing */
p->pln = mkplan(plnr, flags_used_for_planning, prb, BLESSING);
/* record pcost from most recent measurement for use in X(cost) */
p->pln->pcost = pcost;
if (sizeof(trigreal) > sizeof(R)) {
/* this is probably faster, and we have enough trigreal
bits to maintain accuracy */
X(plan_awake)(p->pln, AWAKE_SQRTN_TABLE);
} else {
/* more accurate */
X(plan_awake)(p->pln, AWAKE_SINCOS);
}
/* we don't use pln for p->pln, above, since by re-creating the
plan we might use more patient wisdom from a timed-out mkplan */
X(plan_destroy_internal)(pln);
} else
X(problem_destroy)(prb);
/* discard all information not necessary to reconstruct the plan */
plnr->adt->forget(plnr, FORGET_ACCURSED);
#ifdef FFTW_RANDOM_ESTIMATOR
X(random_estimate_seed)++; /* subsequent "random" plans are distinct */
#endif
if (after_planner_hook)
after_planner_hook();
return p;
}
void X(destroy_plan)(X(plan) p)
{
if (p) {
if (before_planner_hook)
before_planner_hook();
X(plan_awake)(p->pln, SLEEPY);
X(plan_destroy_internal)(p->pln);
X(problem_destroy)(p->prb);
X(ifree)(p);
if (after_planner_hook)
after_planner_hook();
}
}
int X(alignment_of)(R *p)
{
return X(ialignment_of(p));
}

31
extern/fftw/api/configure.c vendored Normal file
View file

@ -0,0 +1,31 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include "dft/dft.h"
#include "rdft/rdft.h"
#include "reodft/reodft.h"
void X(configure_planner)(planner *plnr)
{
X(dft_conf_standard)(plnr);
X(rdft_conf_standard)(plnr);
X(reodft_conf_standard)(plnr);
}

30
extern/fftw/api/execute-dft-c2r.c vendored Normal file
View file

@ -0,0 +1,30 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include "rdft/rdft.h"
/* guru interface: requires care in alignment, r - i, etcetera. */
void X(execute_dft_c2r)(const X(plan) p, C *in, R *out)
{
plan_rdft2 *pln = (plan_rdft2 *) p->pln;
problem_rdft2 *prb = (problem_rdft2 *) p->prb;
pln->apply((plan *) pln, out, out + (prb->r1 - prb->r0), in[0], in[0]+1);
}

30
extern/fftw/api/execute-dft-r2c.c vendored Normal file
View file

@ -0,0 +1,30 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include "rdft/rdft.h"
/* guru interface: requires care in alignment, r - i, etcetera. */
void X(execute_dft_r2c)(const X(plan) p, R *in, C *out)
{
plan_rdft2 *pln = (plan_rdft2 *) p->pln;
problem_rdft2 *prb = (problem_rdft2 *) p->prb;
pln->apply((plan *) pln, in, in + (prb->r1 - prb->r0), out[0], out[0]+1);
}

32
extern/fftw/api/execute-dft.c vendored Normal file
View file

@ -0,0 +1,32 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include "dft/dft.h"
/* guru interface: requires care in alignment etcetera. */
void X(execute_dft)(const X(plan) p, C *in, C *out)
{
plan_dft *pln = (plan_dft *) p->pln;
if (p->sign == FFT_SIGN)
pln->apply((plan *) pln, in[0], in[0]+1, out[0], out[0]+1);
else
pln->apply((plan *) pln, in[0]+1, in[0], out[0]+1, out[0]);
}

29
extern/fftw/api/execute-r2r.c vendored Normal file
View file

@ -0,0 +1,29 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include "rdft/rdft.h"
/* guru interface: requires care in alignment, etcetera. */
void X(execute_r2r)(const X(plan) p, R *in, R *out)
{
plan_rdft *pln = (plan_rdft *) p->pln;
pln->apply((plan *) pln, in, out);
}

30
extern/fftw/api/execute-split-dft-c2r.c vendored Normal file
View file

@ -0,0 +1,30 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include "rdft/rdft.h"
/* guru interface: requires care in alignment, r - i, etcetera. */
void X(execute_split_dft_c2r)(const X(plan) p, R *ri, R *ii, R *out)
{
plan_rdft2 *pln = (plan_rdft2 *) p->pln;
problem_rdft2 *prb = (problem_rdft2 *) p->prb;
pln->apply((plan *) pln, out, out + (prb->r1 - prb->r0), ri, ii);
}

30
extern/fftw/api/execute-split-dft-r2c.c vendored Normal file
View file

@ -0,0 +1,30 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include "rdft/rdft.h"
/* guru interface: requires care in alignment, r - i, etcetera. */
void X(execute_split_dft_r2c)(const X(plan) p, R *in, R *ro, R *io)
{
plan_rdft2 *pln = (plan_rdft2 *) p->pln;
problem_rdft2 *prb = (problem_rdft2 *) p->prb;
pln->apply((plan *) pln, in, in + (prb->r1 - prb->r0), ro, io);
}

29
extern/fftw/api/execute-split-dft.c vendored Normal file
View file

@ -0,0 +1,29 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include "dft/dft.h"
/* guru interface: requires care in alignment, r - i, etcetera. */
void X(execute_split_dft)(const X(plan) p, R *ri, R *ii, R *ro, R *io)
{
plan_dft *pln = (plan_dft *) p->pln;
pln->apply((plan *) pln, ri, ii, ro, io);
}

27
extern/fftw/api/execute.c vendored Normal file
View file

@ -0,0 +1,27 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
void X(execute)(const X(plan) p)
{
plan *pln = p->pln;
pln->adt->solve(pln, p->prb);
}

40
extern/fftw/api/export-wisdom-to-file.c vendored Normal file
View file

@ -0,0 +1,40 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
void X(export_wisdom_to_file)(FILE *output_file)
{
printer *p = X(mkprinter_file)(output_file);
planner *plnr = X(the_planner)();
plnr->adt->exprt(plnr, p);
X(printer_destroy)(p);
}
int X(export_wisdom_to_filename)(const char *filename)
{
FILE *f = fopen(filename, "w");
int ret;
if (!f) return 0; /* error opening file */
X(export_wisdom_to_file)(f);
ret = !ferror(f);
if (fclose(f)) ret = 0; /* error closing file */
return ret;
}

View file

@ -0,0 +1,42 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
char *X(export_wisdom_to_string)(void)
{
printer *p;
planner *plnr = X(the_planner)();
size_t cnt;
char *s;
p = X(mkprinter_cnt)(&cnt);
plnr->adt->exprt(plnr, p);
X(printer_destroy)(p);
s = (char *) malloc(sizeof(char) * (cnt + 1));
if (s) {
p = X(mkprinter_str)(s);
plnr->adt->exprt(plnr, p);
X(printer_destroy)(p);
}
return s;
}

44
extern/fftw/api/export-wisdom.c vendored Normal file
View file

@ -0,0 +1,44 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
typedef struct {
printer super;
void (*write_char)(char c, void *);
void *data;
} P;
static void putchr_generic(printer * p_, char c)
{
P *p = (P *) p_;
(p->write_char)(c, p->data);
}
void X(export_wisdom)(void (*write_char)(char c, void *), void *data)
{
P *p = (P *) X(mkprinter)(sizeof(P), putchr_generic, 0);
planner *plnr = X(the_planner)();
p->write_char = write_char;
p->data = data;
plnr->adt->exprt(plnr, (printer *) p);
X(printer_destroy)((printer *) p);
}

42
extern/fftw/api/f03api.sh vendored Executable file
View file

@ -0,0 +1,42 @@
#! /bin/sh
# Script to generate Fortran 2003 interface declarations for FFTW from
# the fftw3.h header file.
# This is designed so that the Fortran caller can do:
# use, intrinsic :: iso_c_binding
# implicit none
# include 'fftw3.f03'
# and then call the C FFTW functions directly, with type checking.
echo "! Generated automatically. DO NOT EDIT!"
echo
# C_FFTW_R2R_KIND is determined by configure and inserted by the Makefile
# echo " integer, parameter :: C_FFTW_R2R_KIND = @C_FFTW_R2R_KIND@"
# Extract constants
perl -pe 's/([A-Z0-9_]+)=([+-]?[0-9]+)/\n integer\(C_INT\), parameter :: \1 = \2\n/g' < fftw3.h | grep 'integer(C_INT)'
perl -pe 's/#define +([A-Z0-9_]+) +\(([+-]?[0-9]+)U?\)/\n integer\(C_INT\), parameter :: \1 = \2\n/g' < fftw3.h | grep 'integer(C_INT)'
perl -pe 'if (/#define +([A-Z0-9_]+) +\(([0-9]+)U? *<< *([0-9]+)\)/) { print "\n integer\(C_INT\), parameter :: $1 = ",$2 << $3,"\n"; }' < fftw3.h | grep 'integer(C_INT)'
# Extract function declarations
for p in $*; do
if test "$p" = "d"; then p=""; fi
echo
cat <<EOF
type, bind(C) :: fftw${p}_iodim
integer(C_INT) n, is, os
end type fftw${p}_iodim
type, bind(C) :: fftw${p}_iodim64
integer(C_INTPTR_T) n, is, os
end type fftw${p}_iodim64
EOF
echo
echo " interface"
gcc -D__GNUC__=5 -D__i386__ -E fftw3.h |grep "fftw${p}_plan_dft" |tr ';' '\n' | grep -v "fftw${p}_execute(" | perl genf03.pl
echo " end interface"
done

161
extern/fftw/api/f77api.c vendored Normal file
View file

@ -0,0 +1,161 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include "dft/dft.h"
#include "rdft/rdft.h"
#include "api/x77.h"
/* if F77_FUNC is not defined, then we don't know how to mangle identifiers
for the Fortran linker, and we must omit the f77 API. */
#if defined(F77_FUNC) || defined(WINDOWS_F77_MANGLING)
/*-----------------------------------------------------------------------*/
/* some internal functions used by the f77 api */
/* in fortran, the natural array ordering is column-major, which
corresponds to reversing the dimensions relative to C's row-major */
static int *reverse_n(int rnk, const int *n)
{
int *nrev;
int i;
A(FINITE_RNK(rnk));
nrev = (int *) MALLOC(sizeof(int) * (unsigned)rnk, PROBLEMS);
for (i = 0; i < rnk; ++i)
nrev[rnk - i - 1] = n[i];
return nrev;
}
/* f77 doesn't have data structures, so we have to pass iodims as
parallel arrays */
static X(iodim) *make_dims(int rnk, const int *n,
const int *is, const int *os)
{
X(iodim) *dims;
int i;
A(FINITE_RNK(rnk));
dims = (X(iodim) *) MALLOC(sizeof(X(iodim)) * (unsigned)rnk, PROBLEMS);
for (i = 0; i < rnk; ++i) {
dims[i].n = n[i];
dims[i].is = is[i];
dims[i].os = os[i];
}
return dims;
}
typedef struct {
void (*f77_write_char)(char *, void *);
void *data;
} write_char_data;
static void write_char(char c, void *d)
{
write_char_data *ad = (write_char_data *) d;
ad->f77_write_char(&c, ad->data);
}
typedef struct {
void (*f77_read_char)(int *, void *);
void *data;
} read_char_data;
static int read_char(void *d)
{
read_char_data *ed = (read_char_data *) d;
int c;
ed->f77_read_char(&c, ed->data);
return (c < 0 ? EOF : c);
}
static X(r2r_kind) *ints2kinds(int rnk, const int *ik)
{
if (!FINITE_RNK(rnk) || rnk == 0)
return 0;
else {
int i;
X(r2r_kind) *k;
k = (X(r2r_kind) *) MALLOC(sizeof(X(r2r_kind)) * (unsigned)rnk, PROBLEMS);
/* reverse order for Fortran -> C */
for (i = 0; i < rnk; ++i)
k[i] = (X(r2r_kind)) ik[rnk - 1 - i];
return k;
}
}
/*-----------------------------------------------------------------------*/
#define F77(a, A) F77x(x77(a), X77(A))
#ifndef WINDOWS_F77_MANGLING
#if defined(F77_FUNC)
# define F77x(a, A) F77_FUNC(a, A)
# include "f77funcs.h"
#endif
/* If identifiers with underscores are mangled differently than those
without underscores, then we include *both* mangling versions. The
reason is that the only Fortran compiler that does such differing
mangling is currently g77 (which adds an extra underscore to names
with underscores), whereas other compilers running on the same
machine are likely to use non-underscored mangling. (I'm sick
of users complaining that FFTW works with g77 but not with e.g.
pgf77 or ifc on the same machine.) Note that all FFTW identifiers
contain underscores, and configure picks g77 by default. */
#if defined(F77_FUNC_) && !defined(F77_FUNC_EQUIV)
# undef F77x
# define F77x(a, A) F77_FUNC_(a, A)
# include "f77funcs.h"
#endif
#else /* WINDOWS_F77_MANGLING */
/* Various mangling conventions common (?) under Windows. */
/* g77 */
# define WINDOWS_F77_FUNC(a, A) a ## __
# define F77x(a, A) WINDOWS_F77_FUNC(a, A)
# include "f77funcs.h"
/* Intel, etc. */
# undef WINDOWS_F77_FUNC
# define WINDOWS_F77_FUNC(a, A) a ## _
# include "f77funcs.h"
/* Digital/Compaq/HP Visual Fortran, Intel Fortran. stdcall attribute
is apparently required to adjust for calling conventions (callee
pops stack in stdcall). See also:
http://msdn.microsoft.com/library/en-us/vccore98/html/_core_mixed.2d.language_programming.3a_.overview.asp
*/
# undef WINDOWS_F77_FUNC
# if defined(__GNUC__)
# define WINDOWS_F77_FUNC(a, A) __attribute__((stdcall)) A
# elif defined(_MSC_VER) || defined(_ICC) || defined(_STDCALL_SUPPORTED)
# define WINDOWS_F77_FUNC(a, A) __stdcall A
# else
# define WINDOWS_F77_FUNC(a, A) A /* oh well */
# endif
# include "f77funcs.h"
#endif /* WINDOWS_F77_MANGLING */
#endif /* F77_FUNC */

458
extern/fftw/api/f77funcs.h vendored Normal file
View file

@ -0,0 +1,458 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/* Functions in the FFTW Fortran API, mangled according to the
F77(...) macro. This file is designed to be #included by
f77api.c, possibly multiple times in order to support multiple
compiler manglings (via redefinition of F77). */
FFTW_VOIDFUNC F77(execute, EXECUTE)(X(plan) * const p)
{
plan *pln = (*p)->pln;
pln->adt->solve(pln, (*p)->prb);
}
FFTW_VOIDFUNC F77(destroy_plan, DESTROY_PLAN)(X(plan) *p)
{
X(destroy_plan)(*p);
}
FFTW_VOIDFUNC F77(cleanup, CLEANUP)(void)
{
X(cleanup)();
}
FFTW_VOIDFUNC F77(forget_wisdom, FORGET_WISDOM)(void)
{
X(forget_wisdom)();
}
FFTW_VOIDFUNC F77(export_wisdom, EXPORT_WISDOM)(void (*f77_write_char)(char *, void *),
void *data)
{
write_char_data ad;
ad.f77_write_char = f77_write_char;
ad.data = data;
X(export_wisdom)(write_char, (void *) &ad);
}
FFTW_VOIDFUNC F77(import_wisdom, IMPORT_WISDOM)(int *isuccess,
void (*f77_read_char)(int *, void *),
void *data)
{
read_char_data ed;
ed.f77_read_char = f77_read_char;
ed.data = data;
*isuccess = X(import_wisdom)(read_char, (void *) &ed);
}
FFTW_VOIDFUNC F77(import_system_wisdom, IMPORT_SYSTEM_WISDOM)(int *isuccess)
{
*isuccess = X(import_system_wisdom)();
}
FFTW_VOIDFUNC F77(print_plan, PRINT_PLAN)(X(plan) * const p)
{
X(print_plan)(*p);
fflush(stdout);
}
FFTW_VOIDFUNC F77(flops,FLOPS)(X(plan) *p, double *add, double *mul, double *fma)
{
X(flops)(*p, add, mul, fma);
}
FFTW_VOIDFUNC F77(estimate_cost,ESTIMATE_COST)(double *cost, X(plan) * const p)
{
*cost = X(estimate_cost)(*p);
}
FFTW_VOIDFUNC F77(cost,COST)(double *cost, X(plan) * const p)
{
*cost = X(cost)(*p);
}
FFTW_VOIDFUNC F77(set_timelimit,SET_TIMELIMIT)(double *t)
{
X(set_timelimit)(*t);
}
/******************************** DFT ***********************************/
FFTW_VOIDFUNC F77(plan_dft, PLAN_DFT)(X(plan) *p, int *rank, const int *n,
C *in, C *out, int *sign, int *flags)
{
int *nrev = reverse_n(*rank, n);
*p = X(plan_dft)(*rank, nrev, in, out, *sign, *flags);
X(ifree0)(nrev);
}
FFTW_VOIDFUNC F77(plan_dft_1d, PLAN_DFT_1D)(X(plan) *p, int *n, C *in, C *out,
int *sign, int *flags)
{
*p = X(plan_dft_1d)(*n, in, out, *sign, *flags);
}
FFTW_VOIDFUNC F77(plan_dft_2d, PLAN_DFT_2D)(X(plan) *p, int *nx, int *ny,
C *in, C *out, int *sign, int *flags)
{
*p = X(plan_dft_2d)(*ny, *nx, in, out, *sign, *flags);
}
FFTW_VOIDFUNC F77(plan_dft_3d, PLAN_DFT_3D)(X(plan) *p, int *nx, int *ny, int *nz,
C *in, C *out,
int *sign, int *flags)
{
*p = X(plan_dft_3d)(*nz, *ny, *nx, in, out, *sign, *flags);
}
FFTW_VOIDFUNC F77(plan_many_dft, PLAN_MANY_DFT)(X(plan) *p, int *rank, const int *n,
int *howmany,
C *in, const int *inembed,
int *istride, int *idist,
C *out, const int *onembed,
int *ostride, int *odist,
int *sign, int *flags)
{
int *nrev = reverse_n(*rank, n);
int *inembedrev = reverse_n(*rank, inembed);
int *onembedrev = reverse_n(*rank, onembed);
*p = X(plan_many_dft)(*rank, nrev, *howmany,
in, inembedrev, *istride, *idist,
out, onembedrev, *ostride, *odist,
*sign, *flags);
X(ifree0)(onembedrev);
X(ifree0)(inembedrev);
X(ifree0)(nrev);
}
FFTW_VOIDFUNC F77(plan_guru_dft, PLAN_GURU_DFT)(X(plan) *p, int *rank, const int *n,
const int *is, const int *os,
int *howmany_rank, const int *h_n,
const int *h_is, const int *h_os,
C *in, C *out, int *sign, int *flags)
{
X(iodim) *dims = make_dims(*rank, n, is, os);
X(iodim) *howmany_dims = make_dims(*howmany_rank, h_n, h_is, h_os);
*p = X(plan_guru_dft)(*rank, dims, *howmany_rank, howmany_dims,
in, out, *sign, *flags);
X(ifree0)(howmany_dims);
X(ifree0)(dims);
}
FFTW_VOIDFUNC F77(plan_guru_split_dft, PLAN_GURU_SPLIT_DFT)(X(plan) *p, int *rank, const int *n,
const int *is, const int *os,
int *howmany_rank, const int *h_n,
const int *h_is, const int *h_os,
R *ri, R *ii, R *ro, R *io, int *flags)
{
X(iodim) *dims = make_dims(*rank, n, is, os);
X(iodim) *howmany_dims = make_dims(*howmany_rank, h_n, h_is, h_os);
*p = X(plan_guru_split_dft)(*rank, dims, *howmany_rank, howmany_dims,
ri, ii, ro, io, *flags);
X(ifree0)(howmany_dims);
X(ifree0)(dims);
}
FFTW_VOIDFUNC F77(execute_dft, EXECUTE_DFT)(X(plan) * const p, C *in, C *out)
{
plan_dft *pln = (plan_dft *) (*p)->pln;
if ((*p)->sign == FFT_SIGN)
pln->apply((plan *) pln, in[0], in[0]+1, out[0], out[0]+1);
else
pln->apply((plan *) pln, in[0]+1, in[0], out[0]+1, out[0]);
}
FFTW_VOIDFUNC F77(execute_split_dft, EXECUTE_SPLIT_DFT)(X(plan) * const p,
R *ri, R *ii, R *ro, R *io)
{
plan_dft *pln = (plan_dft *) (*p)->pln;
pln->apply((plan *) pln, ri, ii, ro, io);
}
/****************************** DFT r2c *********************************/
FFTW_VOIDFUNC F77(plan_dft_r2c, PLAN_DFT_R2C)(X(plan) *p, int *rank, const int *n,
R *in, C *out, int *flags)
{
int *nrev = reverse_n(*rank, n);
*p = X(plan_dft_r2c)(*rank, nrev, in, out, *flags);
X(ifree0)(nrev);
}
FFTW_VOIDFUNC F77(plan_dft_r2c_1d, PLAN_DFT_R2C_1D)(X(plan) *p, int *n, R *in, C *out,
int *flags)
{
*p = X(plan_dft_r2c_1d)(*n, in, out, *flags);
}
FFTW_VOIDFUNC F77(plan_dft_r2c_2d, PLAN_DFT_R2C_2D)(X(plan) *p, int *nx, int *ny,
R *in, C *out, int *flags)
{
*p = X(plan_dft_r2c_2d)(*ny, *nx, in, out, *flags);
}
FFTW_VOIDFUNC F77(plan_dft_r2c_3d, PLAN_DFT_R2C_3D)(X(plan) *p,
int *nx, int *ny, int *nz,
R *in, C *out,
int *flags)
{
*p = X(plan_dft_r2c_3d)(*nz, *ny, *nx, in, out, *flags);
}
FFTW_VOIDFUNC F77(plan_many_dft_r2c, PLAN_MANY_DFT_R2C)(
X(plan) *p, int *rank, const int *n,
int *howmany,
R *in, const int *inembed, int *istride, int *idist,
C *out, const int *onembed, int *ostride, int *odist,
int *flags)
{
int *nrev = reverse_n(*rank, n);
int *inembedrev = reverse_n(*rank, inembed);
int *onembedrev = reverse_n(*rank, onembed);
*p = X(plan_many_dft_r2c)(*rank, nrev, *howmany,
in, inembedrev, *istride, *idist,
out, onembedrev, *ostride, *odist,
*flags);
X(ifree0)(onembedrev);
X(ifree0)(inembedrev);
X(ifree0)(nrev);
}
FFTW_VOIDFUNC F77(plan_guru_dft_r2c, PLAN_GURU_DFT_R2C)(
X(plan) *p, int *rank, const int *n,
const int *is, const int *os,
int *howmany_rank, const int *h_n,
const int *h_is, const int *h_os,
R *in, C *out, int *flags)
{
X(iodim) *dims = make_dims(*rank, n, is, os);
X(iodim) *howmany_dims = make_dims(*howmany_rank, h_n, h_is, h_os);
*p = X(plan_guru_dft_r2c)(*rank, dims, *howmany_rank, howmany_dims,
in, out, *flags);
X(ifree0)(howmany_dims);
X(ifree0)(dims);
}
FFTW_VOIDFUNC F77(plan_guru_split_dft_r2c, PLAN_GURU_SPLIT_DFT_R2C)(
X(plan) *p, int *rank, const int *n,
const int *is, const int *os,
int *howmany_rank, const int *h_n,
const int *h_is, const int *h_os,
R *in, R *ro, R *io, int *flags)
{
X(iodim) *dims = make_dims(*rank, n, is, os);
X(iodim) *howmany_dims = make_dims(*howmany_rank, h_n, h_is, h_os);
*p = X(plan_guru_split_dft_r2c)(*rank, dims, *howmany_rank, howmany_dims,
in, ro, io, *flags);
X(ifree0)(howmany_dims);
X(ifree0)(dims);
}
FFTW_VOIDFUNC F77(execute_dft_r2c, EXECUTE_DFT_R2C)(X(plan) * const p, R *in, C *out)
{
plan_rdft2 *pln = (plan_rdft2 *) (*p)->pln;
problem_rdft2 *prb = (problem_rdft2 *) (*p)->prb;
pln->apply((plan *) pln, in, in + (prb->r1 - prb->r0), out[0], out[0]+1);
}
FFTW_VOIDFUNC F77(execute_split_dft_r2c, EXECUTE_SPLIT_DFT_R2C)(X(plan) * const p,
R *in, R *ro, R *io)
{
plan_rdft2 *pln = (plan_rdft2 *) (*p)->pln;
problem_rdft2 *prb = (problem_rdft2 *) (*p)->prb;
pln->apply((plan *) pln, in, in + (prb->r1 - prb->r0), ro, io);
}
/****************************** DFT c2r *********************************/
FFTW_VOIDFUNC F77(plan_dft_c2r, PLAN_DFT_C2R)(X(plan) *p, int *rank, const int *n,
C *in, R *out, int *flags)
{
int *nrev = reverse_n(*rank, n);
*p = X(plan_dft_c2r)(*rank, nrev, in, out, *flags);
X(ifree0)(nrev);
}
FFTW_VOIDFUNC F77(plan_dft_c2r_1d, PLAN_DFT_C2R_1D)(X(plan) *p, int *n, C *in, R *out,
int *flags)
{
*p = X(plan_dft_c2r_1d)(*n, in, out, *flags);
}
FFTW_VOIDFUNC F77(plan_dft_c2r_2d, PLAN_DFT_C2R_2D)(X(plan) *p, int *nx, int *ny,
C *in, R *out, int *flags)
{
*p = X(plan_dft_c2r_2d)(*ny, *nx, in, out, *flags);
}
FFTW_VOIDFUNC F77(plan_dft_c2r_3d, PLAN_DFT_C2R_3D)(X(plan) *p,
int *nx, int *ny, int *nz,
C *in, R *out,
int *flags)
{
*p = X(plan_dft_c2r_3d)(*nz, *ny, *nx, in, out, *flags);
}
FFTW_VOIDFUNC F77(plan_many_dft_c2r, PLAN_MANY_DFT_C2R)(
X(plan) *p, int *rank, const int *n,
int *howmany,
C *in, const int *inembed, int *istride, int *idist,
R *out, const int *onembed, int *ostride, int *odist,
int *flags)
{
int *nrev = reverse_n(*rank, n);
int *inembedrev = reverse_n(*rank, inembed);
int *onembedrev = reverse_n(*rank, onembed);
*p = X(plan_many_dft_c2r)(*rank, nrev, *howmany,
in, inembedrev, *istride, *idist,
out, onembedrev, *ostride, *odist,
*flags);
X(ifree0)(onembedrev);
X(ifree0)(inembedrev);
X(ifree0)(nrev);
}
FFTW_VOIDFUNC F77(plan_guru_dft_c2r, PLAN_GURU_DFT_C2R)(
X(plan) *p, int *rank, const int *n,
const int *is, const int *os,
int *howmany_rank, const int *h_n,
const int *h_is, const int *h_os,
C *in, R *out, int *flags)
{
X(iodim) *dims = make_dims(*rank, n, is, os);
X(iodim) *howmany_dims = make_dims(*howmany_rank, h_n, h_is, h_os);
*p = X(plan_guru_dft_c2r)(*rank, dims, *howmany_rank, howmany_dims,
in, out, *flags);
X(ifree0)(howmany_dims);
X(ifree0)(dims);
}
FFTW_VOIDFUNC F77(plan_guru_split_dft_c2r, PLAN_GURU_SPLIT_DFT_C2R)(
X(plan) *p, int *rank, const int *n,
const int *is, const int *os,
int *howmany_rank, const int *h_n,
const int *h_is, const int *h_os,
R *ri, R *ii, R *out, int *flags)
{
X(iodim) *dims = make_dims(*rank, n, is, os);
X(iodim) *howmany_dims = make_dims(*howmany_rank, h_n, h_is, h_os);
*p = X(plan_guru_split_dft_c2r)(*rank, dims, *howmany_rank, howmany_dims,
ri, ii, out, *flags);
X(ifree0)(howmany_dims);
X(ifree0)(dims);
}
FFTW_VOIDFUNC F77(execute_dft_c2r, EXECUTE_DFT_C2R)(X(plan) * const p, C *in, R *out)
{
plan_rdft2 *pln = (plan_rdft2 *) (*p)->pln;
problem_rdft2 *prb = (problem_rdft2 *) (*p)->prb;
pln->apply((plan *) pln, out, out + (prb->r1 - prb->r0), in[0], in[0]+1);
}
FFTW_VOIDFUNC F77(execute_split_dft_c2r, EXECUTE_SPLIT_DFT_C2R)(X(plan) * const p,
R *ri, R *ii, R *out)
{
plan_rdft2 *pln = (plan_rdft2 *) (*p)->pln;
problem_rdft2 *prb = (problem_rdft2 *) (*p)->prb;
pln->apply((plan *) pln, out, out + (prb->r1 - prb->r0), ri, ii);
}
/****************************** r2r *********************************/
FFTW_VOIDFUNC F77(plan_r2r, PLAN_R2R)(X(plan) *p, int *rank, const int *n,
R *in, R *out,
int *kind, int *flags)
{
int *nrev = reverse_n(*rank, n);
X(r2r_kind) *k = ints2kinds(*rank, kind);
*p = X(plan_r2r)(*rank, nrev, in, out, k, *flags);
X(ifree0)(k);
X(ifree0)(nrev);
}
FFTW_VOIDFUNC F77(plan_r2r_1d, PLAN_R2R_1D)(X(plan) *p, int *n, R *in, R *out,
int *kind, int *flags)
{
*p = X(plan_r2r_1d)(*n, in, out, (X(r2r_kind)) *kind, *flags);
}
FFTW_VOIDFUNC F77(plan_r2r_2d, PLAN_R2R_2D)(X(plan) *p, int *nx, int *ny,
R *in, R *out,
int *kindx, int *kindy, int *flags)
{
*p = X(plan_r2r_2d)(*ny, *nx, in, out,
(X(r2r_kind)) *kindy, (X(r2r_kind)) *kindx, *flags);
}
FFTW_VOIDFUNC F77(plan_r2r_3d, PLAN_R2R_3D)(X(plan) *p,
int *nx, int *ny, int *nz,
R *in, R *out,
int *kindx, int *kindy, int *kindz,
int *flags)
{
*p = X(plan_r2r_3d)(*nz, *ny, *nx, in, out,
(X(r2r_kind)) *kindz, (X(r2r_kind)) *kindy,
(X(r2r_kind)) *kindx, *flags);
}
FFTW_VOIDFUNC F77(plan_many_r2r, PLAN_MANY_R2R)(
X(plan) *p, int *rank, const int *n,
int *howmany,
R *in, const int *inembed, int *istride, int *idist,
R *out, const int *onembed, int *ostride, int *odist,
int *kind, int *flags)
{
int *nrev = reverse_n(*rank, n);
int *inembedrev = reverse_n(*rank, inembed);
int *onembedrev = reverse_n(*rank, onembed);
X(r2r_kind) *k = ints2kinds(*rank, kind);
*p = X(plan_many_r2r)(*rank, nrev, *howmany,
in, inembedrev, *istride, *idist,
out, onembedrev, *ostride, *odist,
k, *flags);
X(ifree0)(k);
X(ifree0)(onembedrev);
X(ifree0)(inembedrev);
X(ifree0)(nrev);
}
FFTW_VOIDFUNC F77(plan_guru_r2r, PLAN_GURU_R2R)(
X(plan) *p, int *rank, const int *n,
const int *is, const int *os,
int *howmany_rank, const int *h_n,
const int *h_is, const int *h_os,
R *in, R *out, int *kind, int *flags)
{
X(iodim) *dims = make_dims(*rank, n, is, os);
X(iodim) *howmany_dims = make_dims(*howmany_rank, h_n, h_is, h_os);
X(r2r_kind) *k = ints2kinds(*rank, kind);
*p = X(plan_guru_r2r)(*rank, dims, *howmany_rank, howmany_dims,
in, out, k, *flags);
X(ifree0)(k);
X(ifree0)(howmany_dims);
X(ifree0)(dims);
}
FFTW_VOIDFUNC F77(execute_r2r, EXECUTE_R2R)(X(plan) * const p, R *in, R *out)
{
plan_rdft *pln = (plan_rdft *) (*p)->pln;
pln->apply((plan *) pln, in, out);
}

72
extern/fftw/api/fftw3.f vendored Normal file
View file

@ -0,0 +1,72 @@
INTEGER FFTW_R2HC
PARAMETER (FFTW_R2HC=0)
INTEGER FFTW_HC2R
PARAMETER (FFTW_HC2R=1)
INTEGER FFTW_DHT
PARAMETER (FFTW_DHT=2)
INTEGER FFTW_REDFT00
PARAMETER (FFTW_REDFT00=3)
INTEGER FFTW_REDFT01
PARAMETER (FFTW_REDFT01=4)
INTEGER FFTW_REDFT10
PARAMETER (FFTW_REDFT10=5)
INTEGER FFTW_REDFT11
PARAMETER (FFTW_REDFT11=6)
INTEGER FFTW_RODFT00
PARAMETER (FFTW_RODFT00=7)
INTEGER FFTW_RODFT01
PARAMETER (FFTW_RODFT01=8)
INTEGER FFTW_RODFT10
PARAMETER (FFTW_RODFT10=9)
INTEGER FFTW_RODFT11
PARAMETER (FFTW_RODFT11=10)
INTEGER FFTW_FORWARD
PARAMETER (FFTW_FORWARD=-1)
INTEGER FFTW_BACKWARD
PARAMETER (FFTW_BACKWARD=+1)
INTEGER FFTW_MEASURE
PARAMETER (FFTW_MEASURE=0)
INTEGER FFTW_DESTROY_INPUT
PARAMETER (FFTW_DESTROY_INPUT=1)
INTEGER FFTW_UNALIGNED
PARAMETER (FFTW_UNALIGNED=2)
INTEGER FFTW_CONSERVE_MEMORY
PARAMETER (FFTW_CONSERVE_MEMORY=4)
INTEGER FFTW_EXHAUSTIVE
PARAMETER (FFTW_EXHAUSTIVE=8)
INTEGER FFTW_PRESERVE_INPUT
PARAMETER (FFTW_PRESERVE_INPUT=16)
INTEGER FFTW_PATIENT
PARAMETER (FFTW_PATIENT=32)
INTEGER FFTW_ESTIMATE
PARAMETER (FFTW_ESTIMATE=64)
INTEGER FFTW_WISDOM_ONLY
PARAMETER (FFTW_WISDOM_ONLY=2097152)
INTEGER FFTW_ESTIMATE_PATIENT
PARAMETER (FFTW_ESTIMATE_PATIENT=128)
INTEGER FFTW_BELIEVE_PCOST
PARAMETER (FFTW_BELIEVE_PCOST=256)
INTEGER FFTW_NO_DFT_R2HC
PARAMETER (FFTW_NO_DFT_R2HC=512)
INTEGER FFTW_NO_NONTHREADED
PARAMETER (FFTW_NO_NONTHREADED=1024)
INTEGER FFTW_NO_BUFFERING
PARAMETER (FFTW_NO_BUFFERING=2048)
INTEGER FFTW_NO_INDIRECT_OP
PARAMETER (FFTW_NO_INDIRECT_OP=4096)
INTEGER FFTW_ALLOW_LARGE_GENERIC
PARAMETER (FFTW_ALLOW_LARGE_GENERIC=8192)
INTEGER FFTW_NO_RANK_SPLITS
PARAMETER (FFTW_NO_RANK_SPLITS=16384)
INTEGER FFTW_NO_VRANK_SPLITS
PARAMETER (FFTW_NO_VRANK_SPLITS=32768)
INTEGER FFTW_NO_VRECURSE
PARAMETER (FFTW_NO_VRECURSE=65536)
INTEGER FFTW_NO_SIMD
PARAMETER (FFTW_NO_SIMD=131072)
INTEGER FFTW_NO_SLOW
PARAMETER (FFTW_NO_SLOW=262144)
INTEGER FFTW_NO_FIXED_RADIX_LARGE_N
PARAMETER (FFTW_NO_FIXED_RADIX_LARGE_N=524288)
INTEGER FFTW_ALLOW_PRUNING
PARAMETER (FFTW_ALLOW_PRUNING=1048576)

1262
extern/fftw/api/fftw3.f03.in vendored Normal file

File diff suppressed because it is too large Load diff

522
extern/fftw/api/fftw3.h vendored Normal file
View file

@ -0,0 +1,522 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* The following statement of license applies *only* to this header file,
* and *not* to the other files distributed with FFTW or derived therefrom:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/***************************** NOTE TO USERS *********************************
*
* THIS IS A HEADER FILE, NOT A MANUAL
*
* If you want to know how to use FFTW, please read the manual,
* online at http://www.fftw.org/doc/ and also included with FFTW.
* For a quick start, see the manual's tutorial section.
*
* (Reading header files to learn how to use a library is a habit
* stemming from code lacking a proper manual. Arguably, it's a
* *bad* habit in most cases, because header files can contain
* interfaces that are not part of the public, stable API.)
*
****************************************************************************/
#ifndef FFTW3_H
#define FFTW3_H
#include <stdio.h>
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/* If <complex.h> is included, use the C99 complex type. Otherwise
define a type bit-compatible with C99 complex */
#if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex) && defined(I)
# define FFTW_DEFINE_COMPLEX(R, C) typedef R _Complex C
#else
# define FFTW_DEFINE_COMPLEX(R, C) typedef R C[2]
#endif
#define FFTW_CONCAT(prefix, name) prefix ## name
#define FFTW_MANGLE_DOUBLE(name) FFTW_CONCAT(fftw_, name)
#define FFTW_MANGLE_FLOAT(name) FFTW_CONCAT(fftwf_, name)
#define FFTW_MANGLE_LONG_DOUBLE(name) FFTW_CONCAT(fftwl_, name)
#define FFTW_MANGLE_QUAD(name) FFTW_CONCAT(fftwq_, name)
/* IMPORTANT: for Windows compilers, you should add a line
#define FFTW_DLL
here and in kernel/ifftw.h if you are compiling/using FFTW as a
DLL, in order to do the proper importing/exporting, or
alternatively compile with -DFFTW_DLL or the equivalent
command-line flag. This is not necessary under MinGW/Cygwin, where
libtool does the imports/exports automatically. */
#if defined(FFTW_DLL) && (defined(_WIN32) || defined(__WIN32__))
/* annoying Windows syntax for shared-library declarations */
# if defined(COMPILING_FFTW) /* defined in api.h when compiling FFTW */
# define FFTW_EXTERN extern __declspec(dllexport)
# else /* user is calling FFTW; import symbol */
# define FFTW_EXTERN extern __declspec(dllimport)
# endif
#else
# define FFTW_EXTERN extern
#endif
/* specify calling convention (Windows only) */
#if defined(_WIN32) || defined(__WIN32__)
# define FFTW_CDECL __cdecl
#else
# define FFTW_CDECL
#endif
enum fftw_r2r_kind_do_not_use_me {
FFTW_R2HC=0, FFTW_HC2R=1, FFTW_DHT=2,
FFTW_REDFT00=3, FFTW_REDFT01=4, FFTW_REDFT10=5, FFTW_REDFT11=6,
FFTW_RODFT00=7, FFTW_RODFT01=8, FFTW_RODFT10=9, FFTW_RODFT11=10
};
struct fftw_iodim_do_not_use_me {
int n; /* dimension size */
int is; /* input stride */
int os; /* output stride */
};
#include <stddef.h> /* for ptrdiff_t */
struct fftw_iodim64_do_not_use_me {
ptrdiff_t n; /* dimension size */
ptrdiff_t is; /* input stride */
ptrdiff_t os; /* output stride */
};
typedef void (FFTW_CDECL *fftw_write_char_func_do_not_use_me)(char c, void *);
typedef int (FFTW_CDECL *fftw_read_char_func_do_not_use_me)(void *);
/*
huge second-order macro that defines prototypes for all API
functions. We expand this macro for each supported precision
X: name-mangling macro
R: real data type
C: complex data type
*/
#define FFTW_DEFINE_API(X, R, C) \
\
FFTW_DEFINE_COMPLEX(R, C); \
\
typedef struct X(plan_s) *X(plan); \
\
typedef struct fftw_iodim_do_not_use_me X(iodim); \
typedef struct fftw_iodim64_do_not_use_me X(iodim64); \
\
typedef enum fftw_r2r_kind_do_not_use_me X(r2r_kind); \
\
typedef fftw_write_char_func_do_not_use_me X(write_char_func); \
typedef fftw_read_char_func_do_not_use_me X(read_char_func); \
\
FFTW_EXTERN void \
FFTW_CDECL X(execute)(const X(plan) p); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_dft)(int rank, const int *n, \
C *in, C *out, int sign, unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_dft_1d)(int n, C *in, C *out, int sign, \
unsigned flags); \
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_dft_2d)(int n0, int n1, \
C *in, C *out, int sign, unsigned flags); \
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_dft_3d)(int n0, int n1, int n2, \
C *in, C *out, int sign, unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_many_dft)(int rank, const int *n, \
int howmany, \
C *in, const int *inembed, \
int istride, int idist, \
C *out, const int *onembed, \
int ostride, int odist, \
int sign, unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_guru_dft)(int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
C *in, C *out, \
int sign, unsigned flags); \
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_guru_split_dft)(int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
R *ri, R *ii, R *ro, R *io, \
unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_guru64_dft)(int rank, \
const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
C *in, C *out, \
int sign, unsigned flags); \
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_guru64_split_dft)(int rank, \
const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
R *ri, R *ii, R *ro, R *io, \
unsigned flags); \
\
FFTW_EXTERN void \
FFTW_CDECL X(execute_dft)(const X(plan) p, C *in, C *out); \
\
FFTW_EXTERN void \
FFTW_CDECL X(execute_split_dft)(const X(plan) p, R *ri, R *ii, \
R *ro, R *io); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_many_dft_r2c)(int rank, const int *n, \
int howmany, \
R *in, const int *inembed, \
int istride, int idist, \
C *out, const int *onembed, \
int ostride, int odist, \
unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_dft_r2c)(int rank, const int *n, \
R *in, C *out, unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_dft_r2c_1d)(int n,R *in,C *out,unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_dft_r2c_2d)(int n0, int n1, \
R *in, C *out, unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_dft_r2c_3d)(int n0, int n1, \
int n2, \
R *in, C *out, unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_many_dft_c2r)(int rank, const int *n, \
int howmany, \
C *in, const int *inembed, \
int istride, int idist, \
R *out, const int *onembed, \
int ostride, int odist, \
unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_dft_c2r)(int rank, const int *n, \
C *in, R *out, unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_dft_c2r_1d)(int n,C *in,R *out,unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_dft_c2r_2d)(int n0, int n1, \
C *in, R *out, unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_dft_c2r_3d)(int n0, int n1, \
int n2, \
C *in, R *out, unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_guru_dft_r2c)(int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
R *in, C *out, \
unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_guru_dft_c2r)(int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
C *in, R *out, \
unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_guru_split_dft_r2c)(int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
R *in, R *ro, R *io, \
unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_guru_split_dft_c2r)(int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
R *ri, R *ii, R *out, \
unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_guru64_dft_r2c)(int rank, \
const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
R *in, C *out, \
unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_guru64_dft_c2r)(int rank, \
const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
C *in, R *out, \
unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_guru64_split_dft_r2c)(int rank, const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
R *in, R *ro, R *io, \
unsigned flags); \
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_guru64_split_dft_c2r)(int rank, const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
R *ri, R *ii, R *out, \
unsigned flags); \
\
FFTW_EXTERN void \
FFTW_CDECL X(execute_dft_r2c)(const X(plan) p, R *in, C *out); \
\
FFTW_EXTERN void \
FFTW_CDECL X(execute_dft_c2r)(const X(plan) p, C *in, R *out); \
\
FFTW_EXTERN void \
FFTW_CDECL X(execute_split_dft_r2c)(const X(plan) p, \
R *in, R *ro, R *io); \
\
FFTW_EXTERN void \
FFTW_CDECL X(execute_split_dft_c2r)(const X(plan) p, \
R *ri, R *ii, R *out); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_many_r2r)(int rank, const int *n, \
int howmany, \
R *in, const int *inembed, \
int istride, int idist, \
R *out, const int *onembed, \
int ostride, int odist, \
const X(r2r_kind) *kind, unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_r2r)(int rank, const int *n, R *in, R *out, \
const X(r2r_kind) *kind, unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_r2r_1d)(int n, R *in, R *out, \
X(r2r_kind) kind, unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_r2r_2d)(int n0, int n1, R *in, R *out, \
X(r2r_kind) kind0, X(r2r_kind) kind1, \
unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_r2r_3d)(int n0, int n1, int n2, \
R *in, R *out, X(r2r_kind) kind0, \
X(r2r_kind) kind1, X(r2r_kind) kind2, \
unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_guru_r2r)(int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
R *in, R *out, \
const X(r2r_kind) *kind, unsigned flags); \
\
FFTW_EXTERN X(plan) \
FFTW_CDECL X(plan_guru64_r2r)(int rank, const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
R *in, R *out, \
const X(r2r_kind) *kind, unsigned flags); \
\
FFTW_EXTERN void \
FFTW_CDECL X(execute_r2r)(const X(plan) p, R *in, R *out); \
\
FFTW_EXTERN void \
FFTW_CDECL X(destroy_plan)(X(plan) p); \
\
FFTW_EXTERN void \
FFTW_CDECL X(forget_wisdom)(void); \
FFTW_EXTERN void \
FFTW_CDECL X(cleanup)(void); \
\
FFTW_EXTERN void \
FFTW_CDECL X(set_timelimit)(double t); \
\
FFTW_EXTERN void \
FFTW_CDECL X(plan_with_nthreads)(int nthreads); \
\
FFTW_EXTERN int \
FFTW_CDECL X(planner_nthreads)(void); \
\
FFTW_EXTERN int \
FFTW_CDECL X(init_threads)(void); \
\
FFTW_EXTERN void \
FFTW_CDECL X(cleanup_threads)(void); \
\
FFTW_EXTERN void \
FFTW_CDECL X(threads_set_callback)( \
void (*parallel_loop)(void *(*work)(char *), \
char *jobdata, size_t elsize, int njobs, void *data), void *data); \
\
FFTW_EXTERN void \
FFTW_CDECL X(make_planner_thread_safe)(void); \
\
FFTW_EXTERN int \
FFTW_CDECL X(export_wisdom_to_filename)(const char *filename); \
\
FFTW_EXTERN void \
FFTW_CDECL X(export_wisdom_to_file)(FILE *output_file); \
\
FFTW_EXTERN char * \
FFTW_CDECL X(export_wisdom_to_string)(void); \
\
FFTW_EXTERN void \
FFTW_CDECL X(export_wisdom)(X(write_char_func) write_char, \
void *data); \
FFTW_EXTERN int \
FFTW_CDECL X(import_system_wisdom)(void); \
\
FFTW_EXTERN int \
FFTW_CDECL X(import_wisdom_from_filename)(const char *filename); \
\
FFTW_EXTERN int \
FFTW_CDECL X(import_wisdom_from_file)(FILE *input_file); \
\
FFTW_EXTERN int \
FFTW_CDECL X(import_wisdom_from_string)(const char *input_string); \
\
FFTW_EXTERN int \
FFTW_CDECL X(import_wisdom)(X(read_char_func) read_char, void *data); \
\
FFTW_EXTERN void \
FFTW_CDECL X(fprint_plan)(const X(plan) p, FILE *output_file); \
\
FFTW_EXTERN void \
FFTW_CDECL X(print_plan)(const X(plan) p); \
\
FFTW_EXTERN char * \
FFTW_CDECL X(sprint_plan)(const X(plan) p); \
\
FFTW_EXTERN void * \
FFTW_CDECL X(malloc)(size_t n); \
\
FFTW_EXTERN R * \
FFTW_CDECL X(alloc_real)(size_t n); \
FFTW_EXTERN C * \
FFTW_CDECL X(alloc_complex)(size_t n); \
\
FFTW_EXTERN void \
FFTW_CDECL X(free)(void *p); \
\
FFTW_EXTERN void \
FFTW_CDECL X(flops)(const X(plan) p, \
double *add, double *mul, double *fmas); \
FFTW_EXTERN double \
FFTW_CDECL X(estimate_cost)(const X(plan) p); \
\
FFTW_EXTERN double \
FFTW_CDECL X(cost)(const X(plan) p); \
\
FFTW_EXTERN int \
FFTW_CDECL X(alignment_of)(R *p); \
\
FFTW_EXTERN const char X(version)[]; \
FFTW_EXTERN const char X(cc)[]; \
FFTW_EXTERN const char X(codelet_optim)[];
/* end of FFTW_DEFINE_API macro */
FFTW_DEFINE_API(FFTW_MANGLE_DOUBLE, double, fftw_complex)
FFTW_DEFINE_API(FFTW_MANGLE_FLOAT, float, fftwf_complex)
FFTW_DEFINE_API(FFTW_MANGLE_LONG_DOUBLE, long double, fftwl_complex)
/* __float128 (quad precision) is a gcc extension on i386, x86_64, and ia64
for gcc >= 4.6 (compiled in FFTW with --enable-quad-precision) */
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) \
&& !(defined(__ICC) || defined(__INTEL_COMPILER) || defined(__CUDACC__) || defined(__PGI)) \
&& (defined(__i386__) || defined(__x86_64__) || defined(__ia64__))
# if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex) && defined(I)
/* note: __float128 is a typedef, which is not supported with the _Complex
keyword in gcc, so instead we use this ugly __attribute__ version.
However, we can't simply pass the __attribute__ version to
FFTW_DEFINE_API because the __attribute__ confuses gcc in pointer
types. Hence redefining FFTW_DEFINE_COMPLEX. Ugh. */
# undef FFTW_DEFINE_COMPLEX
# define FFTW_DEFINE_COMPLEX(R, C) typedef _Complex float __attribute__((mode(TC))) C
# endif
FFTW_DEFINE_API(FFTW_MANGLE_QUAD, __float128, fftwq_complex)
#endif
#define FFTW_FORWARD (-1)
#define FFTW_BACKWARD (+1)
#define FFTW_NO_TIMELIMIT (-1.0)
/* documented flags */
#define FFTW_MEASURE (0U)
#define FFTW_DESTROY_INPUT (1U << 0)
#define FFTW_UNALIGNED (1U << 1)
#define FFTW_CONSERVE_MEMORY (1U << 2)
#define FFTW_EXHAUSTIVE (1U << 3) /* NO_EXHAUSTIVE is default */
#define FFTW_PRESERVE_INPUT (1U << 4) /* cancels FFTW_DESTROY_INPUT */
#define FFTW_PATIENT (1U << 5) /* IMPATIENT is default */
#define FFTW_ESTIMATE (1U << 6)
#define FFTW_WISDOM_ONLY (1U << 21)
/* undocumented beyond-guru flags */
#define FFTW_ESTIMATE_PATIENT (1U << 7)
#define FFTW_BELIEVE_PCOST (1U << 8)
#define FFTW_NO_DFT_R2HC (1U << 9)
#define FFTW_NO_NONTHREADED (1U << 10)
#define FFTW_NO_BUFFERING (1U << 11)
#define FFTW_NO_INDIRECT_OP (1U << 12)
#define FFTW_ALLOW_LARGE_GENERIC (1U << 13) /* NO_LARGE_GENERIC is default */
#define FFTW_NO_RANK_SPLITS (1U << 14)
#define FFTW_NO_VRANK_SPLITS (1U << 15)
#define FFTW_NO_VRECURSE (1U << 16)
#define FFTW_NO_SIMD (1U << 17)
#define FFTW_NO_SLOW (1U << 18)
#define FFTW_NO_FIXED_RADIX_LARGE_N (1U << 19)
#define FFTW_ALLOW_PRUNING (1U << 20)
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif /* FFTW3_H */

614
extern/fftw/api/fftw3l.f03 vendored Normal file
View file

@ -0,0 +1,614 @@
! Generated automatically. DO NOT EDIT!
type, bind(C) :: fftwl_iodim
integer(C_INT) n, is, os
end type fftwl_iodim
type, bind(C) :: fftwl_iodim64
integer(C_INTPTR_T) n, is, os
end type fftwl_iodim64
interface
type(C_PTR) function fftwl_plan_dft(rank,n,in,out,sign,flags) bind(C, name='fftwl_plan_dft')
import
integer(C_INT), value :: rank
integer(C_INT), dimension(*), intent(in) :: n
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: in
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: out
integer(C_INT), value :: sign
integer(C_INT), value :: flags
end function fftwl_plan_dft
type(C_PTR) function fftwl_plan_dft_1d(n,in,out,sign,flags) bind(C, name='fftwl_plan_dft_1d')
import
integer(C_INT), value :: n
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: in
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: out
integer(C_INT), value :: sign
integer(C_INT), value :: flags
end function fftwl_plan_dft_1d
type(C_PTR) function fftwl_plan_dft_2d(n0,n1,in,out,sign,flags) bind(C, name='fftwl_plan_dft_2d')
import
integer(C_INT), value :: n0
integer(C_INT), value :: n1
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: in
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: out
integer(C_INT), value :: sign
integer(C_INT), value :: flags
end function fftwl_plan_dft_2d
type(C_PTR) function fftwl_plan_dft_3d(n0,n1,n2,in,out,sign,flags) bind(C, name='fftwl_plan_dft_3d')
import
integer(C_INT), value :: n0
integer(C_INT), value :: n1
integer(C_INT), value :: n2
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: in
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: out
integer(C_INT), value :: sign
integer(C_INT), value :: flags
end function fftwl_plan_dft_3d
type(C_PTR) function fftwl_plan_many_dft(rank,n,howmany,in,inembed,istride,idist,out,onembed,ostride,odist,sign,flags) &
bind(C, name='fftwl_plan_many_dft')
import
integer(C_INT), value :: rank
integer(C_INT), dimension(*), intent(in) :: n
integer(C_INT), value :: howmany
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: in
integer(C_INT), dimension(*), intent(in) :: inembed
integer(C_INT), value :: istride
integer(C_INT), value :: idist
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: out
integer(C_INT), dimension(*), intent(in) :: onembed
integer(C_INT), value :: ostride
integer(C_INT), value :: odist
integer(C_INT), value :: sign
integer(C_INT), value :: flags
end function fftwl_plan_many_dft
type(C_PTR) function fftwl_plan_guru_dft(rank,dims,howmany_rank,howmany_dims,in,out,sign,flags) &
bind(C, name='fftwl_plan_guru_dft')
import
integer(C_INT), value :: rank
type(fftwl_iodim), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwl_iodim), dimension(*), intent(in) :: howmany_dims
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: in
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: out
integer(C_INT), value :: sign
integer(C_INT), value :: flags
end function fftwl_plan_guru_dft
type(C_PTR) function fftwl_plan_guru_split_dft(rank,dims,howmany_rank,howmany_dims,ri,ii,ro,io,flags) &
bind(C, name='fftwl_plan_guru_split_dft')
import
integer(C_INT), value :: rank
type(fftwl_iodim), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwl_iodim), dimension(*), intent(in) :: howmany_dims
real(C_LONG_DOUBLE), dimension(*), intent(out) :: ri
real(C_LONG_DOUBLE), dimension(*), intent(out) :: ii
real(C_LONG_DOUBLE), dimension(*), intent(out) :: ro
real(C_LONG_DOUBLE), dimension(*), intent(out) :: io
integer(C_INT), value :: flags
end function fftwl_plan_guru_split_dft
type(C_PTR) function fftwl_plan_guru64_dft(rank,dims,howmany_rank,howmany_dims,in,out,sign,flags) &
bind(C, name='fftwl_plan_guru64_dft')
import
integer(C_INT), value :: rank
type(fftwl_iodim64), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwl_iodim64), dimension(*), intent(in) :: howmany_dims
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: in
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: out
integer(C_INT), value :: sign
integer(C_INT), value :: flags
end function fftwl_plan_guru64_dft
type(C_PTR) function fftwl_plan_guru64_split_dft(rank,dims,howmany_rank,howmany_dims,ri,ii,ro,io,flags) &
bind(C, name='fftwl_plan_guru64_split_dft')
import
integer(C_INT), value :: rank
type(fftwl_iodim64), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwl_iodim64), dimension(*), intent(in) :: howmany_dims
real(C_LONG_DOUBLE), dimension(*), intent(out) :: ri
real(C_LONG_DOUBLE), dimension(*), intent(out) :: ii
real(C_LONG_DOUBLE), dimension(*), intent(out) :: ro
real(C_LONG_DOUBLE), dimension(*), intent(out) :: io
integer(C_INT), value :: flags
end function fftwl_plan_guru64_split_dft
subroutine fftwl_execute_dft(p,in,out) bind(C, name='fftwl_execute_dft')
import
type(C_PTR), value :: p
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(inout) :: in
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: out
end subroutine fftwl_execute_dft
subroutine fftwl_execute_split_dft(p,ri,ii,ro,io) bind(C, name='fftwl_execute_split_dft')
import
type(C_PTR), value :: p
real(C_LONG_DOUBLE), dimension(*), intent(inout) :: ri
real(C_LONG_DOUBLE), dimension(*), intent(inout) :: ii
real(C_LONG_DOUBLE), dimension(*), intent(out) :: ro
real(C_LONG_DOUBLE), dimension(*), intent(out) :: io
end subroutine fftwl_execute_split_dft
type(C_PTR) function fftwl_plan_many_dft_r2c(rank,n,howmany,in,inembed,istride,idist,out,onembed,ostride,odist,flags) &
bind(C, name='fftwl_plan_many_dft_r2c')
import
integer(C_INT), value :: rank
integer(C_INT), dimension(*), intent(in) :: n
integer(C_INT), value :: howmany
real(C_LONG_DOUBLE), dimension(*), intent(out) :: in
integer(C_INT), dimension(*), intent(in) :: inembed
integer(C_INT), value :: istride
integer(C_INT), value :: idist
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: out
integer(C_INT), dimension(*), intent(in) :: onembed
integer(C_INT), value :: ostride
integer(C_INT), value :: odist
integer(C_INT), value :: flags
end function fftwl_plan_many_dft_r2c
type(C_PTR) function fftwl_plan_dft_r2c(rank,n,in,out,flags) bind(C, name='fftwl_plan_dft_r2c')
import
integer(C_INT), value :: rank
integer(C_INT), dimension(*), intent(in) :: n
real(C_LONG_DOUBLE), dimension(*), intent(out) :: in
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwl_plan_dft_r2c
type(C_PTR) function fftwl_plan_dft_r2c_1d(n,in,out,flags) bind(C, name='fftwl_plan_dft_r2c_1d')
import
integer(C_INT), value :: n
real(C_LONG_DOUBLE), dimension(*), intent(out) :: in
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwl_plan_dft_r2c_1d
type(C_PTR) function fftwl_plan_dft_r2c_2d(n0,n1,in,out,flags) bind(C, name='fftwl_plan_dft_r2c_2d')
import
integer(C_INT), value :: n0
integer(C_INT), value :: n1
real(C_LONG_DOUBLE), dimension(*), intent(out) :: in
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwl_plan_dft_r2c_2d
type(C_PTR) function fftwl_plan_dft_r2c_3d(n0,n1,n2,in,out,flags) bind(C, name='fftwl_plan_dft_r2c_3d')
import
integer(C_INT), value :: n0
integer(C_INT), value :: n1
integer(C_INT), value :: n2
real(C_LONG_DOUBLE), dimension(*), intent(out) :: in
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwl_plan_dft_r2c_3d
type(C_PTR) function fftwl_plan_many_dft_c2r(rank,n,howmany,in,inembed,istride,idist,out,onembed,ostride,odist,flags) &
bind(C, name='fftwl_plan_many_dft_c2r')
import
integer(C_INT), value :: rank
integer(C_INT), dimension(*), intent(in) :: n
integer(C_INT), value :: howmany
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: in
integer(C_INT), dimension(*), intent(in) :: inembed
integer(C_INT), value :: istride
integer(C_INT), value :: idist
real(C_LONG_DOUBLE), dimension(*), intent(out) :: out
integer(C_INT), dimension(*), intent(in) :: onembed
integer(C_INT), value :: ostride
integer(C_INT), value :: odist
integer(C_INT), value :: flags
end function fftwl_plan_many_dft_c2r
type(C_PTR) function fftwl_plan_dft_c2r(rank,n,in,out,flags) bind(C, name='fftwl_plan_dft_c2r')
import
integer(C_INT), value :: rank
integer(C_INT), dimension(*), intent(in) :: n
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: in
real(C_LONG_DOUBLE), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwl_plan_dft_c2r
type(C_PTR) function fftwl_plan_dft_c2r_1d(n,in,out,flags) bind(C, name='fftwl_plan_dft_c2r_1d')
import
integer(C_INT), value :: n
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: in
real(C_LONG_DOUBLE), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwl_plan_dft_c2r_1d
type(C_PTR) function fftwl_plan_dft_c2r_2d(n0,n1,in,out,flags) bind(C, name='fftwl_plan_dft_c2r_2d')
import
integer(C_INT), value :: n0
integer(C_INT), value :: n1
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: in
real(C_LONG_DOUBLE), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwl_plan_dft_c2r_2d
type(C_PTR) function fftwl_plan_dft_c2r_3d(n0,n1,n2,in,out,flags) bind(C, name='fftwl_plan_dft_c2r_3d')
import
integer(C_INT), value :: n0
integer(C_INT), value :: n1
integer(C_INT), value :: n2
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: in
real(C_LONG_DOUBLE), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwl_plan_dft_c2r_3d
type(C_PTR) function fftwl_plan_guru_dft_r2c(rank,dims,howmany_rank,howmany_dims,in,out,flags) &
bind(C, name='fftwl_plan_guru_dft_r2c')
import
integer(C_INT), value :: rank
type(fftwl_iodim), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwl_iodim), dimension(*), intent(in) :: howmany_dims
real(C_LONG_DOUBLE), dimension(*), intent(out) :: in
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwl_plan_guru_dft_r2c
type(C_PTR) function fftwl_plan_guru_dft_c2r(rank,dims,howmany_rank,howmany_dims,in,out,flags) &
bind(C, name='fftwl_plan_guru_dft_c2r')
import
integer(C_INT), value :: rank
type(fftwl_iodim), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwl_iodim), dimension(*), intent(in) :: howmany_dims
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: in
real(C_LONG_DOUBLE), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwl_plan_guru_dft_c2r
type(C_PTR) function fftwl_plan_guru_split_dft_r2c(rank,dims,howmany_rank,howmany_dims,in,ro,io,flags) &
bind(C, name='fftwl_plan_guru_split_dft_r2c')
import
integer(C_INT), value :: rank
type(fftwl_iodim), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwl_iodim), dimension(*), intent(in) :: howmany_dims
real(C_LONG_DOUBLE), dimension(*), intent(out) :: in
real(C_LONG_DOUBLE), dimension(*), intent(out) :: ro
real(C_LONG_DOUBLE), dimension(*), intent(out) :: io
integer(C_INT), value :: flags
end function fftwl_plan_guru_split_dft_r2c
type(C_PTR) function fftwl_plan_guru_split_dft_c2r(rank,dims,howmany_rank,howmany_dims,ri,ii,out,flags) &
bind(C, name='fftwl_plan_guru_split_dft_c2r')
import
integer(C_INT), value :: rank
type(fftwl_iodim), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwl_iodim), dimension(*), intent(in) :: howmany_dims
real(C_LONG_DOUBLE), dimension(*), intent(out) :: ri
real(C_LONG_DOUBLE), dimension(*), intent(out) :: ii
real(C_LONG_DOUBLE), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwl_plan_guru_split_dft_c2r
type(C_PTR) function fftwl_plan_guru64_dft_r2c(rank,dims,howmany_rank,howmany_dims,in,out,flags) &
bind(C, name='fftwl_plan_guru64_dft_r2c')
import
integer(C_INT), value :: rank
type(fftwl_iodim64), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwl_iodim64), dimension(*), intent(in) :: howmany_dims
real(C_LONG_DOUBLE), dimension(*), intent(out) :: in
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwl_plan_guru64_dft_r2c
type(C_PTR) function fftwl_plan_guru64_dft_c2r(rank,dims,howmany_rank,howmany_dims,in,out,flags) &
bind(C, name='fftwl_plan_guru64_dft_c2r')
import
integer(C_INT), value :: rank
type(fftwl_iodim64), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwl_iodim64), dimension(*), intent(in) :: howmany_dims
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: in
real(C_LONG_DOUBLE), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwl_plan_guru64_dft_c2r
type(C_PTR) function fftwl_plan_guru64_split_dft_r2c(rank,dims,howmany_rank,howmany_dims,in,ro,io,flags) &
bind(C, name='fftwl_plan_guru64_split_dft_r2c')
import
integer(C_INT), value :: rank
type(fftwl_iodim64), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwl_iodim64), dimension(*), intent(in) :: howmany_dims
real(C_LONG_DOUBLE), dimension(*), intent(out) :: in
real(C_LONG_DOUBLE), dimension(*), intent(out) :: ro
real(C_LONG_DOUBLE), dimension(*), intent(out) :: io
integer(C_INT), value :: flags
end function fftwl_plan_guru64_split_dft_r2c
type(C_PTR) function fftwl_plan_guru64_split_dft_c2r(rank,dims,howmany_rank,howmany_dims,ri,ii,out,flags) &
bind(C, name='fftwl_plan_guru64_split_dft_c2r')
import
integer(C_INT), value :: rank
type(fftwl_iodim64), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwl_iodim64), dimension(*), intent(in) :: howmany_dims
real(C_LONG_DOUBLE), dimension(*), intent(out) :: ri
real(C_LONG_DOUBLE), dimension(*), intent(out) :: ii
real(C_LONG_DOUBLE), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwl_plan_guru64_split_dft_c2r
subroutine fftwl_execute_dft_r2c(p,in,out) bind(C, name='fftwl_execute_dft_r2c')
import
type(C_PTR), value :: p
real(C_LONG_DOUBLE), dimension(*), intent(inout) :: in
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out) :: out
end subroutine fftwl_execute_dft_r2c
subroutine fftwl_execute_dft_c2r(p,in,out) bind(C, name='fftwl_execute_dft_c2r')
import
type(C_PTR), value :: p
complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(inout) :: in
real(C_LONG_DOUBLE), dimension(*), intent(out) :: out
end subroutine fftwl_execute_dft_c2r
subroutine fftwl_execute_split_dft_r2c(p,in,ro,io) bind(C, name='fftwl_execute_split_dft_r2c')
import
type(C_PTR), value :: p
real(C_LONG_DOUBLE), dimension(*), intent(inout) :: in
real(C_LONG_DOUBLE), dimension(*), intent(out) :: ro
real(C_LONG_DOUBLE), dimension(*), intent(out) :: io
end subroutine fftwl_execute_split_dft_r2c
subroutine fftwl_execute_split_dft_c2r(p,ri,ii,out) bind(C, name='fftwl_execute_split_dft_c2r')
import
type(C_PTR), value :: p
real(C_LONG_DOUBLE), dimension(*), intent(inout) :: ri
real(C_LONG_DOUBLE), dimension(*), intent(inout) :: ii
real(C_LONG_DOUBLE), dimension(*), intent(out) :: out
end subroutine fftwl_execute_split_dft_c2r
type(C_PTR) function fftwl_plan_many_r2r(rank,n,howmany,in,inembed,istride,idist,out,onembed,ostride,odist,kind,flags) &
bind(C, name='fftwl_plan_many_r2r')
import
integer(C_INT), value :: rank
integer(C_INT), dimension(*), intent(in) :: n
integer(C_INT), value :: howmany
real(C_LONG_DOUBLE), dimension(*), intent(out) :: in
integer(C_INT), dimension(*), intent(in) :: inembed
integer(C_INT), value :: istride
integer(C_INT), value :: idist
real(C_LONG_DOUBLE), dimension(*), intent(out) :: out
integer(C_INT), dimension(*), intent(in) :: onembed
integer(C_INT), value :: ostride
integer(C_INT), value :: odist
integer(C_FFTW_R2R_KIND), dimension(*), intent(in) :: kind
integer(C_INT), value :: flags
end function fftwl_plan_many_r2r
type(C_PTR) function fftwl_plan_r2r(rank,n,in,out,kind,flags) bind(C, name='fftwl_plan_r2r')
import
integer(C_INT), value :: rank
integer(C_INT), dimension(*), intent(in) :: n
real(C_LONG_DOUBLE), dimension(*), intent(out) :: in
real(C_LONG_DOUBLE), dimension(*), intent(out) :: out
integer(C_FFTW_R2R_KIND), dimension(*), intent(in) :: kind
integer(C_INT), value :: flags
end function fftwl_plan_r2r
type(C_PTR) function fftwl_plan_r2r_1d(n,in,out,kind,flags) bind(C, name='fftwl_plan_r2r_1d')
import
integer(C_INT), value :: n
real(C_LONG_DOUBLE), dimension(*), intent(out) :: in
real(C_LONG_DOUBLE), dimension(*), intent(out) :: out
integer(C_FFTW_R2R_KIND), value :: kind
integer(C_INT), value :: flags
end function fftwl_plan_r2r_1d
type(C_PTR) function fftwl_plan_r2r_2d(n0,n1,in,out,kind0,kind1,flags) bind(C, name='fftwl_plan_r2r_2d')
import
integer(C_INT), value :: n0
integer(C_INT), value :: n1
real(C_LONG_DOUBLE), dimension(*), intent(out) :: in
real(C_LONG_DOUBLE), dimension(*), intent(out) :: out
integer(C_FFTW_R2R_KIND), value :: kind0
integer(C_FFTW_R2R_KIND), value :: kind1
integer(C_INT), value :: flags
end function fftwl_plan_r2r_2d
type(C_PTR) function fftwl_plan_r2r_3d(n0,n1,n2,in,out,kind0,kind1,kind2,flags) bind(C, name='fftwl_plan_r2r_3d')
import
integer(C_INT), value :: n0
integer(C_INT), value :: n1
integer(C_INT), value :: n2
real(C_LONG_DOUBLE), dimension(*), intent(out) :: in
real(C_LONG_DOUBLE), dimension(*), intent(out) :: out
integer(C_FFTW_R2R_KIND), value :: kind0
integer(C_FFTW_R2R_KIND), value :: kind1
integer(C_FFTW_R2R_KIND), value :: kind2
integer(C_INT), value :: flags
end function fftwl_plan_r2r_3d
type(C_PTR) function fftwl_plan_guru_r2r(rank,dims,howmany_rank,howmany_dims,in,out,kind,flags) &
bind(C, name='fftwl_plan_guru_r2r')
import
integer(C_INT), value :: rank
type(fftwl_iodim), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwl_iodim), dimension(*), intent(in) :: howmany_dims
real(C_LONG_DOUBLE), dimension(*), intent(out) :: in
real(C_LONG_DOUBLE), dimension(*), intent(out) :: out
integer(C_FFTW_R2R_KIND), dimension(*), intent(in) :: kind
integer(C_INT), value :: flags
end function fftwl_plan_guru_r2r
type(C_PTR) function fftwl_plan_guru64_r2r(rank,dims,howmany_rank,howmany_dims,in,out,kind,flags) &
bind(C, name='fftwl_plan_guru64_r2r')
import
integer(C_INT), value :: rank
type(fftwl_iodim64), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwl_iodim64), dimension(*), intent(in) :: howmany_dims
real(C_LONG_DOUBLE), dimension(*), intent(out) :: in
real(C_LONG_DOUBLE), dimension(*), intent(out) :: out
integer(C_FFTW_R2R_KIND), dimension(*), intent(in) :: kind
integer(C_INT), value :: flags
end function fftwl_plan_guru64_r2r
subroutine fftwl_execute_r2r(p,in,out) bind(C, name='fftwl_execute_r2r')
import
type(C_PTR), value :: p
real(C_LONG_DOUBLE), dimension(*), intent(inout) :: in
real(C_LONG_DOUBLE), dimension(*), intent(out) :: out
end subroutine fftwl_execute_r2r
subroutine fftwl_destroy_plan(p) bind(C, name='fftwl_destroy_plan')
import
type(C_PTR), value :: p
end subroutine fftwl_destroy_plan
subroutine fftwl_forget_wisdom() bind(C, name='fftwl_forget_wisdom')
import
end subroutine fftwl_forget_wisdom
subroutine fftwl_cleanup() bind(C, name='fftwl_cleanup')
import
end subroutine fftwl_cleanup
subroutine fftwl_set_timelimit(t) bind(C, name='fftwl_set_timelimit')
import
real(C_DOUBLE), value :: t
end subroutine fftwl_set_timelimit
subroutine fftwl_plan_with_nthreads(nthreads) bind(C, name='fftwl_plan_with_nthreads')
import
integer(C_INT), value :: nthreads
end subroutine fftwl_plan_with_nthreads
integer(C_INT) function fftwl_planner_nthreads() bind(C, name='fftwl_planner_nthreads')
import
end function fftwl_planner_nthreads
integer(C_INT) function fftwl_init_threads() bind(C, name='fftwl_init_threads')
import
end function fftwl_init_threads
subroutine fftwl_cleanup_threads() bind(C, name='fftwl_cleanup_threads')
import
end subroutine fftwl_cleanup_threads
! Unable to generate Fortran interface for fftwl_threads_set_callback
subroutine fftwl_make_planner_thread_safe() bind(C, name='fftwl_make_planner_thread_safe')
import
end subroutine fftwl_make_planner_thread_safe
integer(C_INT) function fftwl_export_wisdom_to_filename(filename) bind(C, name='fftwl_export_wisdom_to_filename')
import
character(C_CHAR), dimension(*), intent(in) :: filename
end function fftwl_export_wisdom_to_filename
subroutine fftwl_export_wisdom_to_file(output_file) bind(C, name='fftwl_export_wisdom_to_file')
import
type(C_PTR), value :: output_file
end subroutine fftwl_export_wisdom_to_file
type(C_PTR) function fftwl_export_wisdom_to_string() bind(C, name='fftwl_export_wisdom_to_string')
import
end function fftwl_export_wisdom_to_string
subroutine fftwl_export_wisdom(write_char,data) bind(C, name='fftwl_export_wisdom')
import
type(C_FUNPTR), value :: write_char
type(C_PTR), value :: data
end subroutine fftwl_export_wisdom
integer(C_INT) function fftwl_import_system_wisdom() bind(C, name='fftwl_import_system_wisdom')
import
end function fftwl_import_system_wisdom
integer(C_INT) function fftwl_import_wisdom_from_filename(filename) bind(C, name='fftwl_import_wisdom_from_filename')
import
character(C_CHAR), dimension(*), intent(in) :: filename
end function fftwl_import_wisdom_from_filename
integer(C_INT) function fftwl_import_wisdom_from_file(input_file) bind(C, name='fftwl_import_wisdom_from_file')
import
type(C_PTR), value :: input_file
end function fftwl_import_wisdom_from_file
integer(C_INT) function fftwl_import_wisdom_from_string(input_string) bind(C, name='fftwl_import_wisdom_from_string')
import
character(C_CHAR), dimension(*), intent(in) :: input_string
end function fftwl_import_wisdom_from_string
integer(C_INT) function fftwl_import_wisdom(read_char,data) bind(C, name='fftwl_import_wisdom')
import
type(C_FUNPTR), value :: read_char
type(C_PTR), value :: data
end function fftwl_import_wisdom
subroutine fftwl_fprint_plan(p,output_file) bind(C, name='fftwl_fprint_plan')
import
type(C_PTR), value :: p
type(C_PTR), value :: output_file
end subroutine fftwl_fprint_plan
subroutine fftwl_print_plan(p) bind(C, name='fftwl_print_plan')
import
type(C_PTR), value :: p
end subroutine fftwl_print_plan
type(C_PTR) function fftwl_sprint_plan(p) bind(C, name='fftwl_sprint_plan')
import
type(C_PTR), value :: p
end function fftwl_sprint_plan
type(C_PTR) function fftwl_malloc(n) bind(C, name='fftwl_malloc')
import
integer(C_SIZE_T), value :: n
end function fftwl_malloc
type(C_PTR) function fftwl_alloc_real(n) bind(C, name='fftwl_alloc_real')
import
integer(C_SIZE_T), value :: n
end function fftwl_alloc_real
type(C_PTR) function fftwl_alloc_complex(n) bind(C, name='fftwl_alloc_complex')
import
integer(C_SIZE_T), value :: n
end function fftwl_alloc_complex
subroutine fftwl_free(p) bind(C, name='fftwl_free')
import
type(C_PTR), value :: p
end subroutine fftwl_free
subroutine fftwl_flops(p,add,mul,fmas) bind(C, name='fftwl_flops')
import
type(C_PTR), value :: p
real(C_DOUBLE), intent(out) :: add
real(C_DOUBLE), intent(out) :: mul
real(C_DOUBLE), intent(out) :: fmas
end subroutine fftwl_flops
real(C_DOUBLE) function fftwl_estimate_cost(p) bind(C, name='fftwl_estimate_cost')
import
type(C_PTR), value :: p
end function fftwl_estimate_cost
real(C_DOUBLE) function fftwl_cost(p) bind(C, name='fftwl_cost')
import
type(C_PTR), value :: p
end function fftwl_cost
integer(C_INT) function fftwl_alignment_of(p) bind(C, name='fftwl_alignment_of')
import
real(C_LONG_DOUBLE), dimension(*), intent(out) :: p
end function fftwl_alignment_of
end interface

614
extern/fftw/api/fftw3q.f03 vendored Normal file
View file

@ -0,0 +1,614 @@
! Generated automatically. DO NOT EDIT!
type, bind(C) :: fftwq_iodim
integer(C_INT) n, is, os
end type fftwq_iodim
type, bind(C) :: fftwq_iodim64
integer(C_INTPTR_T) n, is, os
end type fftwq_iodim64
interface
type(C_PTR) function fftwq_plan_dft(rank,n,in,out,sign,flags) bind(C, name='fftwq_plan_dft')
import
integer(C_INT), value :: rank
integer(C_INT), dimension(*), intent(in) :: n
complex(16), dimension(*), intent(out) :: in
complex(16), dimension(*), intent(out) :: out
integer(C_INT), value :: sign
integer(C_INT), value :: flags
end function fftwq_plan_dft
type(C_PTR) function fftwq_plan_dft_1d(n,in,out,sign,flags) bind(C, name='fftwq_plan_dft_1d')
import
integer(C_INT), value :: n
complex(16), dimension(*), intent(out) :: in
complex(16), dimension(*), intent(out) :: out
integer(C_INT), value :: sign
integer(C_INT), value :: flags
end function fftwq_plan_dft_1d
type(C_PTR) function fftwq_plan_dft_2d(n0,n1,in,out,sign,flags) bind(C, name='fftwq_plan_dft_2d')
import
integer(C_INT), value :: n0
integer(C_INT), value :: n1
complex(16), dimension(*), intent(out) :: in
complex(16), dimension(*), intent(out) :: out
integer(C_INT), value :: sign
integer(C_INT), value :: flags
end function fftwq_plan_dft_2d
type(C_PTR) function fftwq_plan_dft_3d(n0,n1,n2,in,out,sign,flags) bind(C, name='fftwq_plan_dft_3d')
import
integer(C_INT), value :: n0
integer(C_INT), value :: n1
integer(C_INT), value :: n2
complex(16), dimension(*), intent(out) :: in
complex(16), dimension(*), intent(out) :: out
integer(C_INT), value :: sign
integer(C_INT), value :: flags
end function fftwq_plan_dft_3d
type(C_PTR) function fftwq_plan_many_dft(rank,n,howmany,in,inembed,istride,idist,out,onembed,ostride,odist,sign,flags) &
bind(C, name='fftwq_plan_many_dft')
import
integer(C_INT), value :: rank
integer(C_INT), dimension(*), intent(in) :: n
integer(C_INT), value :: howmany
complex(16), dimension(*), intent(out) :: in
integer(C_INT), dimension(*), intent(in) :: inembed
integer(C_INT), value :: istride
integer(C_INT), value :: idist
complex(16), dimension(*), intent(out) :: out
integer(C_INT), dimension(*), intent(in) :: onembed
integer(C_INT), value :: ostride
integer(C_INT), value :: odist
integer(C_INT), value :: sign
integer(C_INT), value :: flags
end function fftwq_plan_many_dft
type(C_PTR) function fftwq_plan_guru_dft(rank,dims,howmany_rank,howmany_dims,in,out,sign,flags) &
bind(C, name='fftwq_plan_guru_dft')
import
integer(C_INT), value :: rank
type(fftwq_iodim), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwq_iodim), dimension(*), intent(in) :: howmany_dims
complex(16), dimension(*), intent(out) :: in
complex(16), dimension(*), intent(out) :: out
integer(C_INT), value :: sign
integer(C_INT), value :: flags
end function fftwq_plan_guru_dft
type(C_PTR) function fftwq_plan_guru_split_dft(rank,dims,howmany_rank,howmany_dims,ri,ii,ro,io,flags) &
bind(C, name='fftwq_plan_guru_split_dft')
import
integer(C_INT), value :: rank
type(fftwq_iodim), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwq_iodim), dimension(*), intent(in) :: howmany_dims
real(16), dimension(*), intent(out) :: ri
real(16), dimension(*), intent(out) :: ii
real(16), dimension(*), intent(out) :: ro
real(16), dimension(*), intent(out) :: io
integer(C_INT), value :: flags
end function fftwq_plan_guru_split_dft
type(C_PTR) function fftwq_plan_guru64_dft(rank,dims,howmany_rank,howmany_dims,in,out,sign,flags) &
bind(C, name='fftwq_plan_guru64_dft')
import
integer(C_INT), value :: rank
type(fftwq_iodim64), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwq_iodim64), dimension(*), intent(in) :: howmany_dims
complex(16), dimension(*), intent(out) :: in
complex(16), dimension(*), intent(out) :: out
integer(C_INT), value :: sign
integer(C_INT), value :: flags
end function fftwq_plan_guru64_dft
type(C_PTR) function fftwq_plan_guru64_split_dft(rank,dims,howmany_rank,howmany_dims,ri,ii,ro,io,flags) &
bind(C, name='fftwq_plan_guru64_split_dft')
import
integer(C_INT), value :: rank
type(fftwq_iodim64), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwq_iodim64), dimension(*), intent(in) :: howmany_dims
real(16), dimension(*), intent(out) :: ri
real(16), dimension(*), intent(out) :: ii
real(16), dimension(*), intent(out) :: ro
real(16), dimension(*), intent(out) :: io
integer(C_INT), value :: flags
end function fftwq_plan_guru64_split_dft
subroutine fftwq_execute_dft(p,in,out) bind(C, name='fftwq_execute_dft')
import
type(C_PTR), value :: p
complex(16), dimension(*), intent(inout) :: in
complex(16), dimension(*), intent(out) :: out
end subroutine fftwq_execute_dft
subroutine fftwq_execute_split_dft(p,ri,ii,ro,io) bind(C, name='fftwq_execute_split_dft')
import
type(C_PTR), value :: p
real(16), dimension(*), intent(inout) :: ri
real(16), dimension(*), intent(inout) :: ii
real(16), dimension(*), intent(out) :: ro
real(16), dimension(*), intent(out) :: io
end subroutine fftwq_execute_split_dft
type(C_PTR) function fftwq_plan_many_dft_r2c(rank,n,howmany,in,inembed,istride,idist,out,onembed,ostride,odist,flags) &
bind(C, name='fftwq_plan_many_dft_r2c')
import
integer(C_INT), value :: rank
integer(C_INT), dimension(*), intent(in) :: n
integer(C_INT), value :: howmany
real(16), dimension(*), intent(out) :: in
integer(C_INT), dimension(*), intent(in) :: inembed
integer(C_INT), value :: istride
integer(C_INT), value :: idist
complex(16), dimension(*), intent(out) :: out
integer(C_INT), dimension(*), intent(in) :: onembed
integer(C_INT), value :: ostride
integer(C_INT), value :: odist
integer(C_INT), value :: flags
end function fftwq_plan_many_dft_r2c
type(C_PTR) function fftwq_plan_dft_r2c(rank,n,in,out,flags) bind(C, name='fftwq_plan_dft_r2c')
import
integer(C_INT), value :: rank
integer(C_INT), dimension(*), intent(in) :: n
real(16), dimension(*), intent(out) :: in
complex(16), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwq_plan_dft_r2c
type(C_PTR) function fftwq_plan_dft_r2c_1d(n,in,out,flags) bind(C, name='fftwq_plan_dft_r2c_1d')
import
integer(C_INT), value :: n
real(16), dimension(*), intent(out) :: in
complex(16), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwq_plan_dft_r2c_1d
type(C_PTR) function fftwq_plan_dft_r2c_2d(n0,n1,in,out,flags) bind(C, name='fftwq_plan_dft_r2c_2d')
import
integer(C_INT), value :: n0
integer(C_INT), value :: n1
real(16), dimension(*), intent(out) :: in
complex(16), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwq_plan_dft_r2c_2d
type(C_PTR) function fftwq_plan_dft_r2c_3d(n0,n1,n2,in,out,flags) bind(C, name='fftwq_plan_dft_r2c_3d')
import
integer(C_INT), value :: n0
integer(C_INT), value :: n1
integer(C_INT), value :: n2
real(16), dimension(*), intent(out) :: in
complex(16), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwq_plan_dft_r2c_3d
type(C_PTR) function fftwq_plan_many_dft_c2r(rank,n,howmany,in,inembed,istride,idist,out,onembed,ostride,odist,flags) &
bind(C, name='fftwq_plan_many_dft_c2r')
import
integer(C_INT), value :: rank
integer(C_INT), dimension(*), intent(in) :: n
integer(C_INT), value :: howmany
complex(16), dimension(*), intent(out) :: in
integer(C_INT), dimension(*), intent(in) :: inembed
integer(C_INT), value :: istride
integer(C_INT), value :: idist
real(16), dimension(*), intent(out) :: out
integer(C_INT), dimension(*), intent(in) :: onembed
integer(C_INT), value :: ostride
integer(C_INT), value :: odist
integer(C_INT), value :: flags
end function fftwq_plan_many_dft_c2r
type(C_PTR) function fftwq_plan_dft_c2r(rank,n,in,out,flags) bind(C, name='fftwq_plan_dft_c2r')
import
integer(C_INT), value :: rank
integer(C_INT), dimension(*), intent(in) :: n
complex(16), dimension(*), intent(out) :: in
real(16), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwq_plan_dft_c2r
type(C_PTR) function fftwq_plan_dft_c2r_1d(n,in,out,flags) bind(C, name='fftwq_plan_dft_c2r_1d')
import
integer(C_INT), value :: n
complex(16), dimension(*), intent(out) :: in
real(16), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwq_plan_dft_c2r_1d
type(C_PTR) function fftwq_plan_dft_c2r_2d(n0,n1,in,out,flags) bind(C, name='fftwq_plan_dft_c2r_2d')
import
integer(C_INT), value :: n0
integer(C_INT), value :: n1
complex(16), dimension(*), intent(out) :: in
real(16), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwq_plan_dft_c2r_2d
type(C_PTR) function fftwq_plan_dft_c2r_3d(n0,n1,n2,in,out,flags) bind(C, name='fftwq_plan_dft_c2r_3d')
import
integer(C_INT), value :: n0
integer(C_INT), value :: n1
integer(C_INT), value :: n2
complex(16), dimension(*), intent(out) :: in
real(16), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwq_plan_dft_c2r_3d
type(C_PTR) function fftwq_plan_guru_dft_r2c(rank,dims,howmany_rank,howmany_dims,in,out,flags) &
bind(C, name='fftwq_plan_guru_dft_r2c')
import
integer(C_INT), value :: rank
type(fftwq_iodim), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwq_iodim), dimension(*), intent(in) :: howmany_dims
real(16), dimension(*), intent(out) :: in
complex(16), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwq_plan_guru_dft_r2c
type(C_PTR) function fftwq_plan_guru_dft_c2r(rank,dims,howmany_rank,howmany_dims,in,out,flags) &
bind(C, name='fftwq_plan_guru_dft_c2r')
import
integer(C_INT), value :: rank
type(fftwq_iodim), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwq_iodim), dimension(*), intent(in) :: howmany_dims
complex(16), dimension(*), intent(out) :: in
real(16), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwq_plan_guru_dft_c2r
type(C_PTR) function fftwq_plan_guru_split_dft_r2c(rank,dims,howmany_rank,howmany_dims,in,ro,io,flags) &
bind(C, name='fftwq_plan_guru_split_dft_r2c')
import
integer(C_INT), value :: rank
type(fftwq_iodim), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwq_iodim), dimension(*), intent(in) :: howmany_dims
real(16), dimension(*), intent(out) :: in
real(16), dimension(*), intent(out) :: ro
real(16), dimension(*), intent(out) :: io
integer(C_INT), value :: flags
end function fftwq_plan_guru_split_dft_r2c
type(C_PTR) function fftwq_plan_guru_split_dft_c2r(rank,dims,howmany_rank,howmany_dims,ri,ii,out,flags) &
bind(C, name='fftwq_plan_guru_split_dft_c2r')
import
integer(C_INT), value :: rank
type(fftwq_iodim), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwq_iodim), dimension(*), intent(in) :: howmany_dims
real(16), dimension(*), intent(out) :: ri
real(16), dimension(*), intent(out) :: ii
real(16), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwq_plan_guru_split_dft_c2r
type(C_PTR) function fftwq_plan_guru64_dft_r2c(rank,dims,howmany_rank,howmany_dims,in,out,flags) &
bind(C, name='fftwq_plan_guru64_dft_r2c')
import
integer(C_INT), value :: rank
type(fftwq_iodim64), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwq_iodim64), dimension(*), intent(in) :: howmany_dims
real(16), dimension(*), intent(out) :: in
complex(16), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwq_plan_guru64_dft_r2c
type(C_PTR) function fftwq_plan_guru64_dft_c2r(rank,dims,howmany_rank,howmany_dims,in,out,flags) &
bind(C, name='fftwq_plan_guru64_dft_c2r')
import
integer(C_INT), value :: rank
type(fftwq_iodim64), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwq_iodim64), dimension(*), intent(in) :: howmany_dims
complex(16), dimension(*), intent(out) :: in
real(16), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwq_plan_guru64_dft_c2r
type(C_PTR) function fftwq_plan_guru64_split_dft_r2c(rank,dims,howmany_rank,howmany_dims,in,ro,io,flags) &
bind(C, name='fftwq_plan_guru64_split_dft_r2c')
import
integer(C_INT), value :: rank
type(fftwq_iodim64), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwq_iodim64), dimension(*), intent(in) :: howmany_dims
real(16), dimension(*), intent(out) :: in
real(16), dimension(*), intent(out) :: ro
real(16), dimension(*), intent(out) :: io
integer(C_INT), value :: flags
end function fftwq_plan_guru64_split_dft_r2c
type(C_PTR) function fftwq_plan_guru64_split_dft_c2r(rank,dims,howmany_rank,howmany_dims,ri,ii,out,flags) &
bind(C, name='fftwq_plan_guru64_split_dft_c2r')
import
integer(C_INT), value :: rank
type(fftwq_iodim64), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwq_iodim64), dimension(*), intent(in) :: howmany_dims
real(16), dimension(*), intent(out) :: ri
real(16), dimension(*), intent(out) :: ii
real(16), dimension(*), intent(out) :: out
integer(C_INT), value :: flags
end function fftwq_plan_guru64_split_dft_c2r
subroutine fftwq_execute_dft_r2c(p,in,out) bind(C, name='fftwq_execute_dft_r2c')
import
type(C_PTR), value :: p
real(16), dimension(*), intent(inout) :: in
complex(16), dimension(*), intent(out) :: out
end subroutine fftwq_execute_dft_r2c
subroutine fftwq_execute_dft_c2r(p,in,out) bind(C, name='fftwq_execute_dft_c2r')
import
type(C_PTR), value :: p
complex(16), dimension(*), intent(inout) :: in
real(16), dimension(*), intent(out) :: out
end subroutine fftwq_execute_dft_c2r
subroutine fftwq_execute_split_dft_r2c(p,in,ro,io) bind(C, name='fftwq_execute_split_dft_r2c')
import
type(C_PTR), value :: p
real(16), dimension(*), intent(inout) :: in
real(16), dimension(*), intent(out) :: ro
real(16), dimension(*), intent(out) :: io
end subroutine fftwq_execute_split_dft_r2c
subroutine fftwq_execute_split_dft_c2r(p,ri,ii,out) bind(C, name='fftwq_execute_split_dft_c2r')
import
type(C_PTR), value :: p
real(16), dimension(*), intent(inout) :: ri
real(16), dimension(*), intent(inout) :: ii
real(16), dimension(*), intent(out) :: out
end subroutine fftwq_execute_split_dft_c2r
type(C_PTR) function fftwq_plan_many_r2r(rank,n,howmany,in,inembed,istride,idist,out,onembed,ostride,odist,kind,flags) &
bind(C, name='fftwq_plan_many_r2r')
import
integer(C_INT), value :: rank
integer(C_INT), dimension(*), intent(in) :: n
integer(C_INT), value :: howmany
real(16), dimension(*), intent(out) :: in
integer(C_INT), dimension(*), intent(in) :: inembed
integer(C_INT), value :: istride
integer(C_INT), value :: idist
real(16), dimension(*), intent(out) :: out
integer(C_INT), dimension(*), intent(in) :: onembed
integer(C_INT), value :: ostride
integer(C_INT), value :: odist
integer(C_FFTW_R2R_KIND), dimension(*), intent(in) :: kind
integer(C_INT), value :: flags
end function fftwq_plan_many_r2r
type(C_PTR) function fftwq_plan_r2r(rank,n,in,out,kind,flags) bind(C, name='fftwq_plan_r2r')
import
integer(C_INT), value :: rank
integer(C_INT), dimension(*), intent(in) :: n
real(16), dimension(*), intent(out) :: in
real(16), dimension(*), intent(out) :: out
integer(C_FFTW_R2R_KIND), dimension(*), intent(in) :: kind
integer(C_INT), value :: flags
end function fftwq_plan_r2r
type(C_PTR) function fftwq_plan_r2r_1d(n,in,out,kind,flags) bind(C, name='fftwq_plan_r2r_1d')
import
integer(C_INT), value :: n
real(16), dimension(*), intent(out) :: in
real(16), dimension(*), intent(out) :: out
integer(C_FFTW_R2R_KIND), value :: kind
integer(C_INT), value :: flags
end function fftwq_plan_r2r_1d
type(C_PTR) function fftwq_plan_r2r_2d(n0,n1,in,out,kind0,kind1,flags) bind(C, name='fftwq_plan_r2r_2d')
import
integer(C_INT), value :: n0
integer(C_INT), value :: n1
real(16), dimension(*), intent(out) :: in
real(16), dimension(*), intent(out) :: out
integer(C_FFTW_R2R_KIND), value :: kind0
integer(C_FFTW_R2R_KIND), value :: kind1
integer(C_INT), value :: flags
end function fftwq_plan_r2r_2d
type(C_PTR) function fftwq_plan_r2r_3d(n0,n1,n2,in,out,kind0,kind1,kind2,flags) bind(C, name='fftwq_plan_r2r_3d')
import
integer(C_INT), value :: n0
integer(C_INT), value :: n1
integer(C_INT), value :: n2
real(16), dimension(*), intent(out) :: in
real(16), dimension(*), intent(out) :: out
integer(C_FFTW_R2R_KIND), value :: kind0
integer(C_FFTW_R2R_KIND), value :: kind1
integer(C_FFTW_R2R_KIND), value :: kind2
integer(C_INT), value :: flags
end function fftwq_plan_r2r_3d
type(C_PTR) function fftwq_plan_guru_r2r(rank,dims,howmany_rank,howmany_dims,in,out,kind,flags) &
bind(C, name='fftwq_plan_guru_r2r')
import
integer(C_INT), value :: rank
type(fftwq_iodim), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwq_iodim), dimension(*), intent(in) :: howmany_dims
real(16), dimension(*), intent(out) :: in
real(16), dimension(*), intent(out) :: out
integer(C_FFTW_R2R_KIND), dimension(*), intent(in) :: kind
integer(C_INT), value :: flags
end function fftwq_plan_guru_r2r
type(C_PTR) function fftwq_plan_guru64_r2r(rank,dims,howmany_rank,howmany_dims,in,out,kind,flags) &
bind(C, name='fftwq_plan_guru64_r2r')
import
integer(C_INT), value :: rank
type(fftwq_iodim64), dimension(*), intent(in) :: dims
integer(C_INT), value :: howmany_rank
type(fftwq_iodim64), dimension(*), intent(in) :: howmany_dims
real(16), dimension(*), intent(out) :: in
real(16), dimension(*), intent(out) :: out
integer(C_FFTW_R2R_KIND), dimension(*), intent(in) :: kind
integer(C_INT), value :: flags
end function fftwq_plan_guru64_r2r
subroutine fftwq_execute_r2r(p,in,out) bind(C, name='fftwq_execute_r2r')
import
type(C_PTR), value :: p
real(16), dimension(*), intent(inout) :: in
real(16), dimension(*), intent(out) :: out
end subroutine fftwq_execute_r2r
subroutine fftwq_destroy_plan(p) bind(C, name='fftwq_destroy_plan')
import
type(C_PTR), value :: p
end subroutine fftwq_destroy_plan
subroutine fftwq_forget_wisdom() bind(C, name='fftwq_forget_wisdom')
import
end subroutine fftwq_forget_wisdom
subroutine fftwq_cleanup() bind(C, name='fftwq_cleanup')
import
end subroutine fftwq_cleanup
subroutine fftwq_set_timelimit(t) bind(C, name='fftwq_set_timelimit')
import
real(C_DOUBLE), value :: t
end subroutine fftwq_set_timelimit
subroutine fftwq_plan_with_nthreads(nthreads) bind(C, name='fftwq_plan_with_nthreads')
import
integer(C_INT), value :: nthreads
end subroutine fftwq_plan_with_nthreads
integer(C_INT) function fftwq_planner_nthreads() bind(C, name='fftwq_planner_nthreads')
import
end function fftwq_planner_nthreads
integer(C_INT) function fftwq_init_threads() bind(C, name='fftwq_init_threads')
import
end function fftwq_init_threads
subroutine fftwq_cleanup_threads() bind(C, name='fftwq_cleanup_threads')
import
end subroutine fftwq_cleanup_threads
! Unable to generate Fortran interface for fftwq_threads_set_callback
subroutine fftwq_make_planner_thread_safe() bind(C, name='fftwq_make_planner_thread_safe')
import
end subroutine fftwq_make_planner_thread_safe
integer(C_INT) function fftwq_export_wisdom_to_filename(filename) bind(C, name='fftwq_export_wisdom_to_filename')
import
character(C_CHAR), dimension(*), intent(in) :: filename
end function fftwq_export_wisdom_to_filename
subroutine fftwq_export_wisdom_to_file(output_file) bind(C, name='fftwq_export_wisdom_to_file')
import
type(C_PTR), value :: output_file
end subroutine fftwq_export_wisdom_to_file
type(C_PTR) function fftwq_export_wisdom_to_string() bind(C, name='fftwq_export_wisdom_to_string')
import
end function fftwq_export_wisdom_to_string
subroutine fftwq_export_wisdom(write_char,data) bind(C, name='fftwq_export_wisdom')
import
type(C_FUNPTR), value :: write_char
type(C_PTR), value :: data
end subroutine fftwq_export_wisdom
integer(C_INT) function fftwq_import_system_wisdom() bind(C, name='fftwq_import_system_wisdom')
import
end function fftwq_import_system_wisdom
integer(C_INT) function fftwq_import_wisdom_from_filename(filename) bind(C, name='fftwq_import_wisdom_from_filename')
import
character(C_CHAR), dimension(*), intent(in) :: filename
end function fftwq_import_wisdom_from_filename
integer(C_INT) function fftwq_import_wisdom_from_file(input_file) bind(C, name='fftwq_import_wisdom_from_file')
import
type(C_PTR), value :: input_file
end function fftwq_import_wisdom_from_file
integer(C_INT) function fftwq_import_wisdom_from_string(input_string) bind(C, name='fftwq_import_wisdom_from_string')
import
character(C_CHAR), dimension(*), intent(in) :: input_string
end function fftwq_import_wisdom_from_string
integer(C_INT) function fftwq_import_wisdom(read_char,data) bind(C, name='fftwq_import_wisdom')
import
type(C_FUNPTR), value :: read_char
type(C_PTR), value :: data
end function fftwq_import_wisdom
subroutine fftwq_fprint_plan(p,output_file) bind(C, name='fftwq_fprint_plan')
import
type(C_PTR), value :: p
type(C_PTR), value :: output_file
end subroutine fftwq_fprint_plan
subroutine fftwq_print_plan(p) bind(C, name='fftwq_print_plan')
import
type(C_PTR), value :: p
end subroutine fftwq_print_plan
type(C_PTR) function fftwq_sprint_plan(p) bind(C, name='fftwq_sprint_plan')
import
type(C_PTR), value :: p
end function fftwq_sprint_plan
type(C_PTR) function fftwq_malloc(n) bind(C, name='fftwq_malloc')
import
integer(C_SIZE_T), value :: n
end function fftwq_malloc
type(C_PTR) function fftwq_alloc_real(n) bind(C, name='fftwq_alloc_real')
import
integer(C_SIZE_T), value :: n
end function fftwq_alloc_real
type(C_PTR) function fftwq_alloc_complex(n) bind(C, name='fftwq_alloc_complex')
import
integer(C_SIZE_T), value :: n
end function fftwq_alloc_complex
subroutine fftwq_free(p) bind(C, name='fftwq_free')
import
type(C_PTR), value :: p
end subroutine fftwq_free
subroutine fftwq_flops(p,add,mul,fmas) bind(C, name='fftwq_flops')
import
type(C_PTR), value :: p
real(C_DOUBLE), intent(out) :: add
real(C_DOUBLE), intent(out) :: mul
real(C_DOUBLE), intent(out) :: fmas
end subroutine fftwq_flops
real(C_DOUBLE) function fftwq_estimate_cost(p) bind(C, name='fftwq_estimate_cost')
import
type(C_PTR), value :: p
end function fftwq_estimate_cost
real(C_DOUBLE) function fftwq_cost(p) bind(C, name='fftwq_cost')
import
type(C_PTR), value :: p
end function fftwq_cost
integer(C_INT) function fftwq_alignment_of(p) bind(C, name='fftwq_alignment_of')
import
real(16), dimension(*), intent(out) :: p
end function fftwq_alignment_of
end interface

43
extern/fftw/api/flops.c vendored Normal file
View file

@ -0,0 +1,43 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
void X(flops)(const X(plan) p, double *add, double *mul, double *fma)
{
planner *plnr = X(the_planner)();
opcnt *o = &p->pln->ops;
*add = o->add; *mul = o->mul; *fma = o->fma;
if (plnr->cost_hook) {
*add = plnr->cost_hook(p->prb, *add, COST_SUM);
*mul = plnr->cost_hook(p->prb, *mul, COST_SUM);
*fma = plnr->cost_hook(p->prb, *fma, COST_SUM);
}
}
double X(estimate_cost)(const X(plan) p)
{
return X(iestimate_cost)(X(the_planner)(), p->pln, p->prb);
}
double X(cost)(const X(plan) p)
{
return p->pln->pcost;
}

27
extern/fftw/api/forget-wisdom.c vendored Normal file
View file

@ -0,0 +1,27 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
void X(forget_wisdom)(void)
{
planner *plnr = X(the_planner)();
plnr->adt->forget(plnr, FORGET_EVERYTHING);
}

213
extern/fftw/api/genf03.pl vendored Executable file
View file

@ -0,0 +1,213 @@
#!/usr/bin/perl -w
# Generate Fortran 2003 interfaces from a sequence of C function declarations
# of the form (one per line):
# extern <type> <name>(...args...)
# extern <type> <name>(...args...)
# ...
# with no line breaks within a given function. (It's too much work to
# write a general parser, since we just have to handle FFTW's header files.)
sub canonicalize_type {
my($type);
($type) = @_;
$type =~ s/ +/ /g;
$type =~ s/^ //;
$type =~ s/ $//;
$type =~ s/([^\* ])\*/$1 \*/g;
return $type;
}
# C->Fortran map of supported return types
%return_types = (
"int" => "integer(C_INT)",
"ptrdiff_t" => "integer(C_INTPTR_T)",
"size_t" => "integer(C_SIZE_T)",
"double" => "real(C_DOUBLE)",
"float" => "real(C_FLOAT)",
"long double" => "real(C_LONG_DOUBLE)",
"__float128" => "real(16)",
"fftw_plan" => "type(C_PTR)",
"fftwf_plan" => "type(C_PTR)",
"fftwl_plan" => "type(C_PTR)",
"fftwq_plan" => "type(C_PTR)",
"void *" => "type(C_PTR)",
"char *" => "type(C_PTR)",
"double *" => "type(C_PTR)",
"float *" => "type(C_PTR)",
"long double *" => "type(C_PTR)",
"__float128 *" => "type(C_PTR)",
"fftw_complex *" => "type(C_PTR)",
"fftwf_complex *" => "type(C_PTR)",
"fftwl_complex *" => "type(C_PTR)",
"fftwq_complex *" => "type(C_PTR)",
);
# C->Fortran map of supported argument types
%arg_types = (
"int" => "integer(C_INT), value",
"unsigned" => "integer(C_INT), value",
"size_t" => "integer(C_SIZE_T), value",
"ptrdiff_t" => "integer(C_INTPTR_T), value",
"fftw_r2r_kind" => "integer(C_FFTW_R2R_KIND), value",
"fftwf_r2r_kind" => "integer(C_FFTW_R2R_KIND), value",
"fftwl_r2r_kind" => "integer(C_FFTW_R2R_KIND), value",
"fftwq_r2r_kind" => "integer(C_FFTW_R2R_KIND), value",
"double" => "real(C_DOUBLE), value",
"float" => "real(C_FLOAT), value",
"long double" => "real(C_LONG_DOUBLE), value",
"__float128" => "real(16), value",
"fftw_complex" => "complex(C_DOUBLE_COMPLEX), value",
"fftwf_complex" => "complex(C_DOUBLE_COMPLEX), value",
"fftwl_complex" => "complex(C_LONG_DOUBLE), value",
"fftwq_complex" => "complex(16), value",
"fftw_plan" => "type(C_PTR), value",
"fftwf_plan" => "type(C_PTR), value",
"fftwl_plan" => "type(C_PTR), value",
"fftwq_plan" => "type(C_PTR), value",
"const fftw_plan" => "type(C_PTR), value",
"const fftwf_plan" => "type(C_PTR), value",
"const fftwl_plan" => "type(C_PTR), value",
"const fftwq_plan" => "type(C_PTR), value",
"const int *" => "integer(C_INT), dimension(*), intent(in)",
"ptrdiff_t *" => "integer(C_INTPTR_T), intent(out)",
"const ptrdiff_t *" => "integer(C_INTPTR_T), dimension(*), intent(in)",
"const fftw_r2r_kind *" => "integer(C_FFTW_R2R_KIND), dimension(*), intent(in)",
"const fftwf_r2r_kind *" => "integer(C_FFTW_R2R_KIND), dimension(*), intent(in)",
"const fftwl_r2r_kind *" => "integer(C_FFTW_R2R_KIND), dimension(*), intent(in)",
"const fftwq_r2r_kind *" => "integer(C_FFTW_R2R_KIND), dimension(*), intent(in)",
"double *" => "real(C_DOUBLE), dimension(*), intent(out)",
"float *" => "real(C_FLOAT), dimension(*), intent(out)",
"long double *" => "real(C_LONG_DOUBLE), dimension(*), intent(out)",
"__float128 *" => "real(16), dimension(*), intent(out)",
"fftw_complex *" => "complex(C_DOUBLE_COMPLEX), dimension(*), intent(out)",
"fftwf_complex *" => "complex(C_FLOAT_COMPLEX), dimension(*), intent(out)",
"fftwl_complex *" => "complex(C_LONG_DOUBLE_COMPLEX), dimension(*), intent(out)",
"fftwq_complex *" => "complex(16), dimension(*), intent(out)",
"const fftw_iodim *" => "type(fftw_iodim), dimension(*), intent(in)",
"const fftwf_iodim *" => "type(fftwf_iodim), dimension(*), intent(in)",
"const fftwl_iodim *" => "type(fftwl_iodim), dimension(*), intent(in)",
"const fftwq_iodim *" => "type(fftwq_iodim), dimension(*), intent(in)",
"const fftw_iodim64 *" => "type(fftw_iodim64), dimension(*), intent(in)",
"const fftwf_iodim64 *" => "type(fftwf_iodim64), dimension(*), intent(in)",
"const fftwl_iodim64 *" => "type(fftwl_iodim64), dimension(*), intent(in)",
"const fftwq_iodim64 *" => "type(fftwq_iodim64), dimension(*), intent(in)",
"void *" => "type(C_PTR), value",
"FILE *" => "type(C_PTR), value",
"const char *" => "character(C_CHAR), dimension(*), intent(in)",
"fftw_write_char_func" => "type(C_FUNPTR), value",
"fftwf_write_char_func" => "type(C_FUNPTR), value",
"fftwl_write_char_func" => "type(C_FUNPTR), value",
"fftwq_write_char_func" => "type(C_FUNPTR), value",
"fftw_read_char_func" => "type(C_FUNPTR), value",
"fftwf_read_char_func" => "type(C_FUNPTR), value",
"fftwl_read_char_func" => "type(C_FUNPTR), value",
"fftwq_read_char_func" => "type(C_FUNPTR), value",
# Although the MPI standard defines this type as simply "integer",
# if we use integer without a 'C_' kind in a bind(C) interface then
# gfortran complains. Instead, since MPI also requires the C type
# MPI_Fint to match Fortran integers, we use the size of this type
# (extracted by configure and substituted by the Makefile).
"MPI_Comm" => "integer(C_MPI_FINT), value"
);
while (<>) {
next if /^ *$/;
if (/^ *extern +([a-zA-Z_0-9 ]+[ \*]) *([a-zA-Z_0-9]+) *\((.*)\) *$/) {
$ret = &canonicalize_type($1);
$name = $2;
$args = $3;
$args =~ s/^ *void *$//;
$bad = ($ret ne "void") && !exists($return_types{$ret});
foreach $arg (split(/ *, */, $args)) {
$arg =~ /^([a-zA-Z_0-9 ]+[ \*]) *([a-zA-Z_0-9]+) *$/;
$argtype = &canonicalize_type($1);
$bad = 1 if !exists($arg_types{$argtype});
}
if ($bad) {
print "! Unable to generate Fortran interface for $name\n";
next;
}
# any function taking an MPI_Comm arg needs a C wrapper (grr).
if ($args =~ /MPI_Comm/) {
$cname = $name . "_f03";
}
else {
$cname = $name;
}
# Fortran has a 132-character line-length limit by default (grr)
$len = 0;
print " "; $len = $len + length(" ");
if ($ret eq "void") {
$kind = "subroutine"
}
else {
print "$return_types{$ret} ";
$len = $len + length("$return_types{$ret} ");
$kind = "function"
}
print "$kind $name("; $len = $len + length("$kind $name(");
$len0 = $len;
$argnames = $args;
$argnames =~ s/([a-zA-Z_0-9 ]+[ \*]) *([a-zA-Z_0-9]+) */$2/g;
$comma = "";
foreach $argname (split(/ *, */, $argnames)) {
if ($len + length("$comma$argname") + 3 > 132) {
printf ", &\n%*s", $len0, "";
$len = $len0;
$comma = "";
}
print "$comma$argname";
$len = $len + length("$comma$argname");
$comma = ",";
}
print ") "; $len = $len + 2;
if ($len + length("bind(C, name='$cname')") > 132) {
printf "&\n%*s", $len0 - length("$name("), "";
}
print "bind(C, name='$cname')\n";
print " import\n";
foreach $arg (split(/ *, */, $args)) {
$arg =~ /^([a-zA-Z_0-9 ]+[ \*]) *([a-zA-Z_0-9]+) *$/;
$argtype = &canonicalize_type($1);
$argname = $2;
$ftype = $arg_types{$argtype};
# Various special cases for argument types:
if ($name =~ /_flops$/ && $argtype eq "double *") {
$ftype = "real(C_DOUBLE), intent(out)"
}
if ($name =~ /_execute/ && ($argname eq "ri" ||
$argname eq "ii" ||
$argname eq "in")) {
$ftype =~ s/intent\(out\)/intent(inout)/;
}
print " $ftype :: $argname\n"
}
print " end $kind $name\n";
print " \n";
}
}

4
extern/fftw/api/guru.h vendored Normal file
View file

@ -0,0 +1,4 @@
#define XGURU(name) X(plan_guru_ ## name)
#define IODIM X(iodim)
#define MKTENSOR_IODIMS X(mktensor_iodims)
#define GURU_KOSHERP X(guru_kosherp)

4
extern/fftw/api/guru64.h vendored Normal file
View file

@ -0,0 +1,4 @@
#define XGURU(name) X(plan_guru64_ ## name)
#define IODIM X(iodim64)
#define MKTENSOR_IODIMS X(mktensor_iodims64)
#define GURU_KOSHERP X(guru64_kosherp)

53
extern/fftw/api/import-system-wisdom.c vendored Normal file
View file

@ -0,0 +1,53 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#if defined(FFTW_SINGLE)
# define WISDOM_NAME "wisdomf"
#elif defined(FFTW_LDOUBLE)
# define WISDOM_NAME "wisdoml"
#else
# define WISDOM_NAME "wisdom"
#endif
/* OS-specific configuration-file directory */
#if defined(__DJGPP__)
# define WISDOM_DIR "/dev/env/DJDIR/etc/fftw/"
#else
# define WISDOM_DIR "/etc/fftw/"
#endif
int X(import_system_wisdom)(void)
{
#if defined(__WIN32__) || defined(WIN32) || defined(_WINDOWS)
return 0; /* TODO? */
#else
FILE *f;
f = fopen(WISDOM_DIR WISDOM_NAME, "r");
if (f) {
int ret = X(import_wisdom_from_file)(f);
fclose(f);
return ret;
} else
return 0;
#endif
}

View file

@ -0,0 +1,81 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include <stdio.h>
/* getc()/putc() are *unbelievably* slow on linux. Looks like glibc
is grabbing a lock for each call to getc()/putc(), or something
like that. You pay the price for these idiotic posix threads
whether you use them or not.
So, we do our own buffering. This completely defeats the purpose
of having stdio in the first place, of course.
*/
#define BUFSZ 256
typedef struct {
scanner super;
FILE *f;
char buf[BUFSZ];
char *bufr, *bufw;
} S;
static int getchr_file(scanner * sc_)
{
S *sc = (S *) sc_;
if (sc->bufr >= sc->bufw) {
sc->bufr = sc->buf;
sc->bufw = sc->buf + fread(sc->buf, 1, BUFSZ, sc->f);
if (sc->bufr >= sc->bufw)
return EOF;
}
return *(sc->bufr++);
}
static scanner *mkscanner_file(FILE *f)
{
S *sc = (S *) X(mkscanner)(sizeof(S), getchr_file);
sc->f = f;
sc->bufr = sc->bufw = sc->buf;
return &sc->super;
}
int X(import_wisdom_from_file)(FILE *input_file)
{
scanner *s = mkscanner_file(input_file);
planner *plnr = X(the_planner)();
int ret = plnr->adt->imprt(plnr, s);
X(scanner_destroy)(s);
return ret;
}
int X(import_wisdom_from_filename)(const char *filename)
{
FILE *f = fopen(filename, "r");
int ret;
if (!f) return 0; /* error opening file */
ret = X(import_wisdom_from_file)(f);
if (fclose(f)) ret = 0; /* error closing file */
return ret;
}

View file

@ -0,0 +1,50 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
typedef struct {
scanner super;
const char *s;
} S_str;
static int getchr_str(scanner * sc_)
{
S_str *sc = (S_str *) sc_;
if (!*sc->s)
return EOF;
return *sc->s++;
}
static scanner *mkscanner_str(const char *s)
{
S_str *sc = (S_str *) X(mkscanner)(sizeof(S_str), getchr_str);
sc->s = s;
return &sc->super;
}
int X(import_wisdom_from_string)(const char *input_string)
{
scanner *s = mkscanner_str(input_string);
planner *plnr = X(the_planner)();
int ret = plnr->adt->imprt(plnr, s);
X(scanner_destroy)(s);
return ret;
}

46
extern/fftw/api/import-wisdom.c vendored Normal file
View file

@ -0,0 +1,46 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
typedef struct {
scanner super;
int (*read_char)(void *);
void *data;
} S;
static int getchr_generic(scanner * s_)
{
S *s = (S *) s_;
return (s->read_char)(s->data);
}
int X(import_wisdom)(int (*read_char)(void *), void *data)
{
S *s = (S *) X(mkscanner)(sizeof(S), getchr_generic);
planner *plnr = X(the_planner)();
int ret;
s->read_char = read_char;
s->data = data;
ret = plnr->adt->imprt(plnr, (scanner *) s);
X(scanner_destroy)((scanner *) s);
return ret;
}

50
extern/fftw/api/malloc.c vendored Normal file
View file

@ -0,0 +1,50 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
void *X(malloc)(size_t n)
{
return X(kernel_malloc)(n);
}
void X(free)(void *p)
{
X(kernel_free)(p);
}
/* The following two routines are mainly for the convenience of
the Fortran 2003 API, although C users may find them convienent
as well. The problem is that, although Fortran 2003 has a
c_sizeof intrinsic that is equivalent to sizeof, it is broken
in some gfortran versions, and in any case is a bit unnatural
in a Fortran context. So we provide routines to allocate real
and complex arrays, which are all that are really needed by FFTW. */
R *X(alloc_real)(size_t n)
{
return (R *) X(malloc)(sizeof(R) * n);
}
C *X(alloc_complex)(size_t n)
{
return (C *) X(malloc)(sizeof(C) * n);
}

50
extern/fftw/api/map-r2r-kind.c vendored Normal file
View file

@ -0,0 +1,50 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include "rdft/rdft.h"
rdft_kind *X(map_r2r_kind)(int rank, const X(r2r_kind) * kind)
{
int i;
rdft_kind *k;
A(FINITE_RNK(rank));
k = (rdft_kind *) MALLOC((unsigned)rank * sizeof(rdft_kind), PROBLEMS);
for (i = 0; i < rank; ++i) {
rdft_kind m;
switch (kind[i]) {
case FFTW_R2HC: m = R2HC; break;
case FFTW_HC2R: m = HC2R; break;
case FFTW_DHT: m = DHT; break;
case FFTW_REDFT00: m = REDFT00; break;
case FFTW_REDFT01: m = REDFT01; break;
case FFTW_REDFT10: m = REDFT10; break;
case FFTW_REDFT11: m = REDFT11; break;
case FFTW_RODFT00: m = RODFT00; break;
case FFTW_RODFT01: m = RODFT01; break;
case FFTW_RODFT10: m = RODFT10; break;
case FFTW_RODFT11: m = RODFT11; break;
default: m = R2HC; A(0);
}
k[i] = m;
}
return k;
}

166
extern/fftw/api/mapflags.c vendored Normal file
View file

@ -0,0 +1,166 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include <math.h>
/* a flag operation: x is either a flag, in which case xm == 0, or
a mask, in which case xm == x; using this we can compactly code
the various bit operations via (flags & x) ^ xm or (flags | x) ^ xm. */
typedef struct {
unsigned x, xm;
} flagmask;
typedef struct {
flagmask flag;
flagmask op;
} flagop;
#define FLAGP(f, msk)(((f) & (msk).x) ^ (msk).xm)
#define OP(f, msk)(((f) | (msk).x) ^ (msk).xm)
#define YES(x) {x, 0}
#define NO(x) {x, x}
#define IMPLIES(predicate, consequence) { predicate, consequence }
#define EQV(a, b) IMPLIES(YES(a), YES(b)), IMPLIES(NO(a), NO(b))
#define NEQV(a, b) IMPLIES(YES(a), NO(b)), IMPLIES(NO(a), YES(b))
static void map_flags(unsigned *iflags, unsigned *oflags,
const flagop flagmap[], size_t nmap)
{
size_t i;
for (i = 0; i < nmap; ++i)
if (FLAGP(*iflags, flagmap[i].flag))
*oflags = OP(*oflags, flagmap[i].op);
}
/* encoding of the planner timelimit into a BITS_FOR_TIMELIMIT-bits
nonnegative integer, such that we can still view the integer as
``impatience'': higher means *lower* time limit, and 0 is the
highest possible value (about 1 year of calendar time) */
static unsigned timelimit_to_flags(double timelimit)
{
const double tmax = 365 * 24 * 3600;
const double tstep = 1.05;
const int nsteps = (1 << BITS_FOR_TIMELIMIT);
int x;
if (timelimit < 0 || timelimit >= tmax)
return 0;
if (timelimit <= 1.0e-10)
return nsteps - 1;
x = (int) (0.5 + (log(tmax / timelimit) / log(tstep)));
if (x < 0) x = 0;
if (x >= nsteps) x = nsteps - 1;
return x;
}
void X(mapflags)(planner *plnr, unsigned flags)
{
unsigned l, u, t;
/* map of api flags -> api flags, to implement consistency rules
and combination flags */
const flagop self_flagmap[] = {
/* in some cases (notably for halfcomplex->real transforms),
DESTROY_INPUT is the default, so we need to support
an inverse flag to disable it.
(PRESERVE, DESTROY) -> (PRESERVE, DESTROY)
(0, 0) (1, 0)
(0, 1) (0, 1)
(1, 0) (1, 0)
(1, 1) (1, 0)
*/
IMPLIES(YES(FFTW_PRESERVE_INPUT), NO(FFTW_DESTROY_INPUT)),
IMPLIES(NO(FFTW_DESTROY_INPUT), YES(FFTW_PRESERVE_INPUT)),
IMPLIES(YES(FFTW_EXHAUSTIVE), YES(FFTW_PATIENT)),
IMPLIES(YES(FFTW_ESTIMATE), NO(FFTW_PATIENT)),
IMPLIES(YES(FFTW_ESTIMATE),
YES(FFTW_ESTIMATE_PATIENT
| FFTW_NO_INDIRECT_OP
| FFTW_ALLOW_PRUNING)),
IMPLIES(NO(FFTW_EXHAUSTIVE),
YES(FFTW_NO_SLOW)),
/* a canonical set of fftw2-like impatience flags */
IMPLIES(NO(FFTW_PATIENT),
YES(FFTW_NO_VRECURSE
| FFTW_NO_RANK_SPLITS
| FFTW_NO_VRANK_SPLITS
| FFTW_NO_NONTHREADED
| FFTW_NO_DFT_R2HC
| FFTW_NO_FIXED_RADIX_LARGE_N
| FFTW_BELIEVE_PCOST))
};
/* map of (processed) api flags to internal problem/planner flags */
const flagop l_flagmap[] = {
EQV(FFTW_PRESERVE_INPUT, NO_DESTROY_INPUT),
EQV(FFTW_NO_SIMD, NO_SIMD),
EQV(FFTW_CONSERVE_MEMORY, CONSERVE_MEMORY),
EQV(FFTW_NO_BUFFERING, NO_BUFFERING),
NEQV(FFTW_ALLOW_LARGE_GENERIC, NO_LARGE_GENERIC)
};
const flagop u_flagmap[] = {
IMPLIES(YES(FFTW_EXHAUSTIVE), NO(0xFFFFFFFF)),
IMPLIES(NO(FFTW_EXHAUSTIVE), YES(NO_UGLY)),
/* the following are undocumented, "beyond-guru" flags that
require some understanding of FFTW internals */
EQV(FFTW_ESTIMATE_PATIENT, ESTIMATE),
EQV(FFTW_ALLOW_PRUNING, ALLOW_PRUNING),
EQV(FFTW_BELIEVE_PCOST, BELIEVE_PCOST),
EQV(FFTW_NO_DFT_R2HC, NO_DFT_R2HC),
EQV(FFTW_NO_NONTHREADED, NO_NONTHREADED),
EQV(FFTW_NO_INDIRECT_OP, NO_INDIRECT_OP),
EQV(FFTW_NO_RANK_SPLITS, NO_RANK_SPLITS),
EQV(FFTW_NO_VRANK_SPLITS, NO_VRANK_SPLITS),
EQV(FFTW_NO_VRECURSE, NO_VRECURSE),
EQV(FFTW_NO_SLOW, NO_SLOW),
EQV(FFTW_NO_FIXED_RADIX_LARGE_N, NO_FIXED_RADIX_LARGE_N)
};
map_flags(&flags, &flags, self_flagmap, NELEM(self_flagmap));
l = u = 0;
map_flags(&flags, &l, l_flagmap, NELEM(l_flagmap));
map_flags(&flags, &u, u_flagmap, NELEM(u_flagmap));
/* enforce l <= u */
PLNR_L(plnr) = l;
PLNR_U(plnr) = u | l;
/* assert that the conversion didn't lose bits */
A(PLNR_L(plnr) == l);
A(PLNR_U(plnr) == (u | l));
/* compute flags representation of the timelimit */
t = timelimit_to_flags(plnr->timelimit);
PLNR_TIMELIMIT_IMPATIENCE(plnr) = t;
A(PLNR_TIMELIMIT_IMPATIENCE(plnr) == t);
}

59
extern/fftw/api/mkprinter-file.c vendored Normal file
View file

@ -0,0 +1,59 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include <stdio.h>
#define BUFSZ 256
typedef struct {
printer super;
FILE *f;
char buf[BUFSZ];
char *bufw;
} P;
static void myflush(P *p)
{
fwrite(p->buf, 1, p->bufw - p->buf, p->f);
p->bufw = p->buf;
}
static void myputchr(printer *p_, char c)
{
P *p = (P *) p_;
if (p->bufw >= p->buf + BUFSZ)
myflush(p);
*p->bufw++ = c;
}
static void mycleanup(printer *p_)
{
P *p = (P *) p_;
myflush(p);
}
printer *X(mkprinter_file)(FILE *f)
{
P *p = (P *) X(mkprinter)(sizeof(P), myputchr, mycleanup);
p->f = f;
p->bufw = p->buf;
return &p->super;
}

61
extern/fftw/api/mkprinter-str.c vendored Normal file
View file

@ -0,0 +1,61 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
typedef struct {
printer super;
size_t *cnt;
} P_cnt;
static void putchr_cnt(printer * p_, char c)
{
P_cnt *p = (P_cnt *) p_;
UNUSED(c);
++*p->cnt;
}
printer *X(mkprinter_cnt)(size_t *cnt)
{
P_cnt *p = (P_cnt *) X(mkprinter)(sizeof(P_cnt), putchr_cnt, 0);
p->cnt = cnt;
*cnt = 0;
return &p->super;
}
typedef struct {
printer super;
char *s;
} P_str;
static void putchr_str(printer * p_, char c)
{
P_str *p = (P_str *) p_;
*p->s++ = c;
*p->s = 0;
}
printer *X(mkprinter_str)(char *s)
{
P_str *p = (P_str *) X(mkprinter)(sizeof(P_str), putchr_str, 0);
p->s = s;
*s = 0;
return &p->super;
}

2
extern/fftw/api/mktensor-iodims.c vendored Normal file
View file

@ -0,0 +1,2 @@
#include "guru.h"
#include "mktensor-iodims.h"

62
extern/fftw/api/mktensor-iodims.h vendored Normal file
View file

@ -0,0 +1,62 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
tensor *MKTENSOR_IODIMS(int rank, const IODIM *dims, int is, int os)
{
int i;
tensor *x = X(mktensor)(rank);
if (FINITE_RNK(rank)) {
for (i = 0; i < rank; ++i) {
x->dims[i].n = dims[i].n;
x->dims[i].is = dims[i].is * is;
x->dims[i].os = dims[i].os * os;
}
}
return x;
}
static int iodims_kosherp(int rank, const IODIM *dims, int allow_minfty)
{
int i;
if (rank < 0) return 0;
if (allow_minfty) {
if (!FINITE_RNK(rank)) return 1;
for (i = 0; i < rank; ++i)
if (dims[i].n < 0) return 0;
} else {
if (!FINITE_RNK(rank)) return 0;
for (i = 0; i < rank; ++i)
if (dims[i].n <= 0) return 0;
}
return 1;
}
int GURU_KOSHERP(int rank, const IODIM *dims,
int howmany_rank, const IODIM *howmany_dims)
{
return (iodims_kosherp(rank, dims, 0) &&
iodims_kosherp(howmany_rank, howmany_dims, 1));
}

2
extern/fftw/api/mktensor-iodims64.c vendored Normal file
View file

@ -0,0 +1,2 @@
#include "guru64.h"
#include "mktensor-iodims.h"

61
extern/fftw/api/mktensor-rowmajor.c vendored Normal file
View file

@ -0,0 +1,61 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
tensor *X(mktensor_rowmajor)(int rnk, const int *n,
const int *niphys, const int *nophys,
int is, int os)
{
tensor *x = X(mktensor)(rnk);
if (FINITE_RNK(rnk) && rnk > 0) {
int i;
A(n && niphys && nophys);
x->dims[rnk - 1].is = is;
x->dims[rnk - 1].os = os;
x->dims[rnk - 1].n = n[rnk - 1];
for (i = rnk - 1; i > 0; --i) {
x->dims[i - 1].is = x->dims[i].is * niphys[i];
x->dims[i - 1].os = x->dims[i].os * nophys[i];
x->dims[i - 1].n = n[i - 1];
}
}
return x;
}
static int rowmajor_kosherp(int rnk, const int *n)
{
int i;
if (!FINITE_RNK(rnk)) return 0;
if (rnk < 0) return 0;
for (i = 0; i < rnk; ++i)
if (n[i] <= 0) return 0;
return 1;
}
int X(many_kosherp)(int rnk, const int *n, int howmany)
{
return (howmany >= 0) && rowmajor_kosherp(rnk, n);
}

27
extern/fftw/api/plan-dft-1d.c vendored Normal file
View file

@ -0,0 +1,27 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include "dft/dft.h"
X(plan) X(plan_dft_1d)(int n, C *in, C *out, int sign, unsigned flags)
{
return X(plan_dft)(1, &n, in, out, sign, flags);
}

30
extern/fftw/api/plan-dft-2d.c vendored Normal file
View file

@ -0,0 +1,30 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include "dft/dft.h"
X(plan) X(plan_dft_2d)(int nx, int ny, C *in, C *out, int sign, unsigned flags)
{
int n[2];
n[0] = nx;
n[1] = ny;
return X(plan_dft)(2, n, in, out, sign, flags);
}

32
extern/fftw/api/plan-dft-3d.c vendored Normal file
View file

@ -0,0 +1,32 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include "dft/dft.h"
X(plan) X(plan_dft_3d)(int nx, int ny, int nz,
C *in, C *out, int sign, unsigned flags)
{
int n[3];
n[0] = nx;
n[1] = ny;
n[2] = nz;
return X(plan_dft)(3, n, in, out, sign, flags);
}

26
extern/fftw/api/plan-dft-c2r-1d.c vendored Normal file
View file

@ -0,0 +1,26 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
X(plan) X(plan_dft_c2r_1d)(int n, C *in, R *out, unsigned flags)
{
return X(plan_dft_c2r)(1, &n, in, out, flags);
}

29
extern/fftw/api/plan-dft-c2r-2d.c vendored Normal file
View file

@ -0,0 +1,29 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
X(plan) X(plan_dft_c2r_2d)(int nx, int ny, C *in, R *out, unsigned flags)
{
int n[2];
n[0] = nx;
n[1] = ny;
return X(plan_dft_c2r)(2, n, in, out, flags);
}

31
extern/fftw/api/plan-dft-c2r-3d.c vendored Normal file
View file

@ -0,0 +1,31 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
X(plan) X(plan_dft_c2r_3d)(int nx, int ny, int nz,
C *in, R *out, unsigned flags)
{
int n[3];
n[0] = nx;
n[1] = ny;
n[2] = nz;
return X(plan_dft_c2r)(3, n, in, out, flags);
}

27
extern/fftw/api/plan-dft-c2r.c vendored Normal file
View file

@ -0,0 +1,27 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
X(plan) X(plan_dft_c2r)(int rank, const int *n, C *in, R *out, unsigned flags)
{
return X(plan_many_dft_c2r)(rank, n, 1,
in, 0, 1, 1, out, 0, 1, 1, flags);
}

26
extern/fftw/api/plan-dft-r2c-1d.c vendored Normal file
View file

@ -0,0 +1,26 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
X(plan) X(plan_dft_r2c_1d)(int n, R *in, C *out, unsigned flags)
{
return X(plan_dft_r2c)(1, &n, in, out, flags);
}

29
extern/fftw/api/plan-dft-r2c-2d.c vendored Normal file
View file

@ -0,0 +1,29 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
X(plan) X(plan_dft_r2c_2d)(int nx, int ny, R *in, C *out, unsigned flags)
{
int n[2];
n[0] = nx;
n[1] = ny;
return X(plan_dft_r2c)(2, n, in, out, flags);
}

31
extern/fftw/api/plan-dft-r2c-3d.c vendored Normal file
View file

@ -0,0 +1,31 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
X(plan) X(plan_dft_r2c_3d)(int nx, int ny, int nz,
R *in, C *out, unsigned flags)
{
int n[3];
n[0] = nx;
n[1] = ny;
n[2] = nz;
return X(plan_dft_r2c)(3, n, in, out, flags);
}

29
extern/fftw/api/plan-dft-r2c.c vendored Normal file
View file

@ -0,0 +1,29 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
X(plan) X(plan_dft_r2c)(int rank, const int *n, R *in, C *out, unsigned flags)
{
return X(plan_many_dft_r2c)(rank, n, 1,
in, 0, 1, 1,
out, 0, 1, 1,
flags);
}

30
extern/fftw/api/plan-dft.c vendored Normal file
View file

@ -0,0 +1,30 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
X(plan) X(plan_dft)(int rank, const int *n,
C *in, C *out, int sign, unsigned flags)
{
return X(plan_many_dft)(rank, n, 1,
in, 0, 1, 1,
out, 0, 1, 1,
sign, flags);
}

2
extern/fftw/api/plan-guru-dft-c2r.c vendored Normal file
View file

@ -0,0 +1,2 @@
#include "guru.h"
#include "plan-guru-dft-c2r.h"

44
extern/fftw/api/plan-guru-dft-c2r.h vendored Normal file
View file

@ -0,0 +1,44 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include "rdft/rdft.h"
X(plan) XGURU(dft_c2r)(int rank, const IODIM *dims,
int howmany_rank, const IODIM *howmany_dims,
C *in, R *out, unsigned flags)
{
R *ri, *ii;
if (!GURU_KOSHERP(rank, dims, howmany_rank, howmany_dims)) return 0;
EXTRACT_REIM(FFT_SIGN, in, &ri, &ii);
if (out != ri)
flags |= FFTW_DESTROY_INPUT;
return X(mkapiplan)(
0, flags,
X(mkproblem_rdft2_d_3pointers)(
MKTENSOR_IODIMS(rank, dims, 2, 1),
MKTENSOR_IODIMS(howmany_rank, howmany_dims, 2, 1),
TAINT_UNALIGNED(out, flags),
TAINT_UNALIGNED(ri, flags),
TAINT_UNALIGNED(ii, flags), HC2R));
}

2
extern/fftw/api/plan-guru-dft-r2c.c vendored Normal file
View file

@ -0,0 +1,2 @@
#include "guru.h"
#include "plan-guru-dft-r2c.h"

43
extern/fftw/api/plan-guru-dft-r2c.h vendored Normal file
View file

@ -0,0 +1,43 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include "rdft/rdft.h"
X(plan) XGURU(dft_r2c)(int rank, const IODIM *dims,
int howmany_rank,
const IODIM *howmany_dims,
R *in, C *out, unsigned flags)
{
R *ro, *io;
if (!GURU_KOSHERP(rank, dims, howmany_rank, howmany_dims)) return 0;
EXTRACT_REIM(FFT_SIGN, out, &ro, &io);
return X(mkapiplan)(
0, flags,
X(mkproblem_rdft2_d_3pointers)(
MKTENSOR_IODIMS(rank, dims, 1, 2),
MKTENSOR_IODIMS(howmany_rank, howmany_dims, 1, 2),
TAINT_UNALIGNED(in, flags),
TAINT_UNALIGNED(ro, flags),
TAINT_UNALIGNED(io, flags), R2HC));
}

2
extern/fftw/api/plan-guru-dft.c vendored Normal file
View file

@ -0,0 +1,2 @@
#include "guru.h"
#include "plan-guru-dft.h"

44
extern/fftw/api/plan-guru-dft.h vendored Normal file
View file

@ -0,0 +1,44 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include "dft/dft.h"
X(plan) XGURU(dft)(int rank, const IODIM *dims,
int howmany_rank, const IODIM *howmany_dims,
C *in, C *out, int sign, unsigned flags)
{
R *ri, *ii, *ro, *io;
if (!GURU_KOSHERP(rank, dims, howmany_rank, howmany_dims)) return 0;
EXTRACT_REIM(sign, in, &ri, &ii);
EXTRACT_REIM(sign, out, &ro, &io);
return X(mkapiplan)(
sign, flags,
X(mkproblem_dft_d)(MKTENSOR_IODIMS(rank, dims, 2, 2),
MKTENSOR_IODIMS(howmany_rank, howmany_dims,
2, 2),
TAINT_UNALIGNED(ri, flags),
TAINT_UNALIGNED(ii, flags),
TAINT_UNALIGNED(ro, flags),
TAINT_UNALIGNED(io, flags)));
}

2
extern/fftw/api/plan-guru-r2r.c vendored Normal file
View file

@ -0,0 +1,2 @@
#include "guru.h"
#include "plan-guru-r2r.h"

45
extern/fftw/api/plan-guru-r2r.h vendored Normal file
View file

@ -0,0 +1,45 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include "rdft/rdft.h"
X(plan) XGURU(r2r)(int rank, const IODIM *dims,
int howmany_rank,
const IODIM *howmany_dims,
R *in, R *out,
const X(r2r_kind) * kind, unsigned flags)
{
X(plan) p;
rdft_kind *k;
if (!GURU_KOSHERP(rank, dims, howmany_rank, howmany_dims)) return 0;
k = X(map_r2r_kind)(rank, kind);
p = X(mkapiplan)(
0, flags,
X(mkproblem_rdft_d)(MKTENSOR_IODIMS(rank, dims, 1, 1),
MKTENSOR_IODIMS(howmany_rank, howmany_dims,
1, 1),
TAINT_UNALIGNED(in, flags),
TAINT_UNALIGNED(out, flags), k));
X(ifree0)(k);
return p;
}

View file

@ -0,0 +1,2 @@
#include "guru.h"
#include "plan-guru-split-dft-c2r.h"

View file

@ -0,0 +1,40 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include "rdft/rdft.h"
X(plan) XGURU(split_dft_c2r)(int rank, const IODIM *dims,
int howmany_rank, const IODIM *howmany_dims,
R *ri, R *ii, R *out, unsigned flags)
{
if (!GURU_KOSHERP(rank, dims, howmany_rank, howmany_dims)) return 0;
if (out != ri)
flags |= FFTW_DESTROY_INPUT;
return X(mkapiplan)(
0, flags,
X(mkproblem_rdft2_d_3pointers)(
MKTENSOR_IODIMS(rank, dims, 1, 1),
MKTENSOR_IODIMS(howmany_rank, howmany_dims, 1, 1),
TAINT_UNALIGNED(out, flags),
TAINT_UNALIGNED(ri, flags),
TAINT_UNALIGNED(ii, flags), HC2R));
}

View file

@ -0,0 +1,2 @@
#include "guru.h"
#include "plan-guru-split-dft-r2c.h"

View file

@ -0,0 +1,39 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include "rdft/rdft.h"
X(plan) XGURU(split_dft_r2c)(int rank, const IODIM *dims,
int howmany_rank,
const IODIM *howmany_dims,
R *in, R *ro, R *io, unsigned flags)
{
if (!GURU_KOSHERP(rank, dims, howmany_rank, howmany_dims)) return 0;
return X(mkapiplan)(
0, flags,
X(mkproblem_rdft2_d_3pointers)(
MKTENSOR_IODIMS(rank, dims, 1, 1),
MKTENSOR_IODIMS(howmany_rank, howmany_dims, 1, 1),
TAINT_UNALIGNED(in, flags),
TAINT_UNALIGNED(ro, flags),
TAINT_UNALIGNED(io, flags), R2HC));
}

2
extern/fftw/api/plan-guru-split-dft.c vendored Normal file
View file

@ -0,0 +1,2 @@
#include "guru.h"
#include "plan-guru-split-dft.h"

39
extern/fftw/api/plan-guru-split-dft.h vendored Normal file
View file

@ -0,0 +1,39 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include "dft/dft.h"
X(plan) XGURU(split_dft)(int rank, const IODIM *dims,
int howmany_rank, const IODIM *howmany_dims,
R *ri, R *ii, R *ro, R *io, unsigned flags)
{
if (!GURU_KOSHERP(rank, dims, howmany_rank, howmany_dims)) return 0;
return X(mkapiplan)(
ii - ri == 1 && io - ro == 1 ? FFT_SIGN : -FFT_SIGN, flags,
X(mkproblem_dft_d)(MKTENSOR_IODIMS(rank, dims, 1, 1),
MKTENSOR_IODIMS(howmany_rank, howmany_dims,
1, 1),
TAINT_UNALIGNED(ri, flags),
TAINT_UNALIGNED(ii, flags),
TAINT_UNALIGNED(ro, flags),
TAINT_UNALIGNED(io, flags)));
}

2
extern/fftw/api/plan-guru64-dft-c2r.c vendored Normal file
View file

@ -0,0 +1,2 @@
#include "guru64.h"
#include "plan-guru-dft-c2r.h"

2
extern/fftw/api/plan-guru64-dft-r2c.c vendored Normal file
View file

@ -0,0 +1,2 @@
#include "guru64.h"
#include "plan-guru-dft-r2c.h"

2
extern/fftw/api/plan-guru64-dft.c vendored Normal file
View file

@ -0,0 +1,2 @@
#include "guru64.h"
#include "plan-guru-dft.h"

2
extern/fftw/api/plan-guru64-r2r.c vendored Normal file
View file

@ -0,0 +1,2 @@
#include "guru64.h"
#include "plan-guru-r2r.h"

View file

@ -0,0 +1,2 @@
#include "guru64.h"
#include "plan-guru-split-dft-c2r.h"

View file

@ -0,0 +1,2 @@
#include "guru64.h"
#include "plan-guru-split-dft-r2c.h"

View file

@ -0,0 +1,2 @@
#include "guru64.h"
#include "plan-guru-split-dft.h"

59
extern/fftw/api/plan-many-dft-c2r.c vendored Normal file
View file

@ -0,0 +1,59 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include "rdft/rdft.h"
X(plan) X(plan_many_dft_c2r)(int rank, const int *n,
int howmany,
C *in, const int *inembed,
int istride, int idist,
R *out, const int *onembed,
int ostride, int odist, unsigned flags)
{
R *ri, *ii;
int *nfi, *nfo;
int inplace;
X(plan) p;
if (!X(many_kosherp)(rank, n, howmany)) return 0;
EXTRACT_REIM(FFT_SIGN, in, &ri, &ii);
inplace = out == ri;
if (!inplace)
flags |= FFTW_DESTROY_INPUT;
p = X(mkapiplan)(
0, flags,
X(mkproblem_rdft2_d_3pointers)(
X(mktensor_rowmajor)(
rank, n,
X(rdft2_pad)(rank, n, inembed, inplace, 1, &nfi),
X(rdft2_pad)(rank, n, onembed, inplace, 0, &nfo),
2 * istride, ostride),
X(mktensor_1d)(howmany, 2 * idist, odist),
TAINT_UNALIGNED(out, flags),
TAINT_UNALIGNED(ri, flags), TAINT_UNALIGNED(ii, flags),
HC2R));
X(ifree0)(nfi);
X(ifree0)(nfo);
return p;
}

57
extern/fftw/api/plan-many-dft-r2c.c vendored Normal file
View file

@ -0,0 +1,57 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include "rdft/rdft.h"
X(plan) X(plan_many_dft_r2c)(int rank, const int *n,
int howmany,
R *in, const int *inembed,
int istride, int idist,
C *out, const int *onembed,
int ostride, int odist, unsigned flags)
{
R *ro, *io;
int *nfi, *nfo;
int inplace;
X(plan) p;
if (!X(many_kosherp)(rank, n, howmany)) return 0;
EXTRACT_REIM(FFT_SIGN, out, &ro, &io);
inplace = in == ro;
p = X(mkapiplan)(
0, flags,
X(mkproblem_rdft2_d_3pointers)(
X(mktensor_rowmajor)(
rank, n,
X(rdft2_pad)(rank, n, inembed, inplace, 0, &nfi),
X(rdft2_pad)(rank, n, onembed, inplace, 1, &nfo),
istride, 2 * ostride),
X(mktensor_1d)(howmany, idist, 2 * odist),
TAINT_UNALIGNED(in, flags),
TAINT_UNALIGNED(ro, flags), TAINT_UNALIGNED(io, flags),
R2HC));
X(ifree0)(nfi);
X(ifree0)(nfo);
return p;
}

51
extern/fftw/api/plan-many-dft.c vendored Normal file
View file

@ -0,0 +1,51 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include "dft/dft.h"
#define N0(nembed)((nembed) ? (nembed) : n)
X(plan) X(plan_many_dft)(int rank, const int *n,
int howmany,
C *in, const int *inembed,
int istride, int idist,
C *out, const int *onembed,
int ostride, int odist, int sign, unsigned flags)
{
R *ri, *ii, *ro, *io;
if (!X(many_kosherp)(rank, n, howmany)) return 0;
EXTRACT_REIM(sign, in, &ri, &ii);
EXTRACT_REIM(sign, out, &ro, &io);
return
X(mkapiplan)(sign, flags,
X(mkproblem_dft_d)(
X(mktensor_rowmajor)(rank, n,
N0(inembed), N0(onembed),
2 * istride, 2 * ostride),
X(mktensor_1d)(howmany, 2 * idist, 2 * odist),
TAINT_UNALIGNED(ri, flags),
TAINT_UNALIGNED(ii, flags),
TAINT_UNALIGNED(ro, flags),
TAINT_UNALIGNED(io, flags)));
}

50
extern/fftw/api/plan-many-r2r.c vendored Normal file
View file

@ -0,0 +1,50 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
#include "rdft/rdft.h"
#define N0(nembed)((nembed) ? (nembed) : n)
X(plan) X(plan_many_r2r)(int rank, const int *n,
int howmany,
R *in, const int *inembed,
int istride, int idist,
R *out, const int *onembed,
int ostride, int odist,
const X(r2r_kind) * kind, unsigned flags)
{
X(plan) p;
rdft_kind *k;
if (!X(many_kosherp)(rank, n, howmany)) return 0;
k = X(map_r2r_kind)(rank, kind);
p = X(mkapiplan)(
0, flags,
X(mkproblem_rdft_d)(X(mktensor_rowmajor)(rank, n,
N0(inembed), N0(onembed),
istride, ostride),
X(mktensor_1d)(howmany, idist, odist),
TAINT_UNALIGNED(in, flags),
TAINT_UNALIGNED(out, flags), k));
X(ifree0)(k);
return p;
}

26
extern/fftw/api/plan-r2r-1d.c vendored Normal file
View file

@ -0,0 +1,26 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
X(plan) X(plan_r2r_1d)(int n, R *in, R *out, X(r2r_kind) kind, unsigned flags)
{
return X(plan_r2r)(1, &n, in, out, &kind, flags);
}

33
extern/fftw/api/plan-r2r-2d.c vendored Normal file
View file

@ -0,0 +1,33 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
X(plan) X(plan_r2r_2d)(int nx, int ny, R *in, R *out,
X(r2r_kind) kindx, X(r2r_kind) kindy, unsigned flags)
{
int n[2];
X(r2r_kind) kind[2];
n[0] = nx;
n[1] = ny;
kind[0] = kindx;
kind[1] = kindy;
return X(plan_r2r)(2, n, in, out, kind, flags);
}

36
extern/fftw/api/plan-r2r-3d.c vendored Normal file
View file

@ -0,0 +1,36 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
X(plan) X(plan_r2r_3d)(int nx, int ny, int nz,
R *in, R *out, X(r2r_kind) kindx,
X(r2r_kind) kindy, X(r2r_kind) kindz, unsigned flags)
{
int n[3];
X(r2r_kind) kind[3];
n[0] = nx;
n[1] = ny;
n[2] = nz;
kind[0] = kindx;
kind[1] = kindy;
kind[2] = kindz;
return X(plan_r2r)(3, n, in, out, kind, flags);
}

28
extern/fftw/api/plan-r2r.c vendored Normal file
View file

@ -0,0 +1,28 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
X(plan) X(plan_r2r)(int rank, const int *n, R *in, R *out,
const X(r2r_kind) * kind, unsigned flags)
{
return X(plan_many_r2r)(rank, n, 1, in, 0, 1, 1, out, 0, 1, 1, kind,
flags);
}

53
extern/fftw/api/print-plan.c vendored Normal file
View file

@ -0,0 +1,53 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
char *X(sprint_plan)(const X(plan) p)
{
size_t cnt;
char *s;
plan *pln = p->pln;
printer *pr = X(mkprinter_cnt)(&cnt);
pln->adt->print(pln, pr);
X(printer_destroy)(pr);
s = (char *) malloc(sizeof(char) * (cnt + 1));
if (s) {
pr = X(mkprinter_str)(s);
pln->adt->print(pln, pr);
X(printer_destroy)(pr);
}
return s;
}
void X(fprint_plan)(const X(plan) p, FILE *output_file)
{
printer *pr = X(mkprinter_file)(output_file);
plan *pln = p->pln;
pln->adt->print(pln, pr);
X(printer_destroy)(pr);
}
void X(print_plan)(const X(plan) p)
{
X(fprint_plan)(p, stdout);
}

39
extern/fftw/api/rdft2-pad.c vendored Normal file
View file

@ -0,0 +1,39 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include <string.h>
#include "api/api.h"
const int *X(rdft2_pad)(int rnk, const int *n, const int *nembed,
int inplace, int cmplx, int **nfree)
{
A(FINITE_RNK(rnk));
*nfree = 0;
if (!nembed && rnk > 0) {
if (inplace || cmplx) {
int *np = (int *) MALLOC(sizeof(int) * (unsigned)rnk, PROBLEMS);
memcpy(np, n, sizeof(int) * (unsigned)rnk);
np[rnk - 1] = (n[rnk - 1] / 2 + 1) * (1 + !cmplx);
nembed = *nfree = np;
} else
nembed = n;
}
return nembed;
}

49
extern/fftw/api/the-planner.c vendored Normal file
View file

@ -0,0 +1,49 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
static planner *plnr = 0;
/* create the planner for the rest of the API */
planner *X(the_planner)(void)
{
if (!plnr) {
plnr = X(mkplanner)();
X(configure_planner)(plnr);
}
return plnr;
}
void X(cleanup)(void)
{
if (plnr) {
X(planner_destroy)(plnr);
plnr = 0;
}
}
void X(set_timelimit)(double tlim)
{
/* PLNR is not necessarily initialized when this function is
called, so use X(the_planner)() */
X(the_planner)()->timelimit = tlim;
}

88
extern/fftw/api/version.c vendored Normal file
View file

@ -0,0 +1,88 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "api/api.h"
const char X(cc)[] = FFTW_CC;
/* fftw <= 3.2.2 had special compiler flags for codelets, which are
not used anymore. We keep this variable around because it is part
of the ABI */
const char X(codelet_optim)[] = "";
const char X(version)[] = PACKAGE "-" PACKAGE_VERSION
#if HAVE_FMA
"-fma"
#endif
#if HAVE_SSE2
"-sse2"
#endif
/* Earlier versions of FFTW only provided 256-bit AVX, which meant
* it was important to also enable sse2 for best performance for
* short transforms. Since some programs check for this and warn
* the user, we explicitly add avx_128 to the suffix to emphasize
* that this version is more capable.
*/
#if HAVE_AVX
"-avx"
#endif
#if HAVE_AVX_128_FMA
"-avx_128_fma"
#endif
#if HAVE_AVX2
"-avx2-avx2_128"
#endif
#if HAVE_AVX512
"-avx512"
#endif
#if HAVE_KCVI
"-kcvi"
#endif
#if HAVE_ALTIVEC
"-altivec"
#endif
#if HAVE_VSX
"-vsx"
#endif
#if HAVE_NEON
"-neon"
#endif
#if defined(HAVE_GENERIC_SIMD128)
"-generic_simd128"
#endif
#if defined(HAVE_GENERIC_SIMD256)
"-generic_simd256"
#endif
;

69
extern/fftw/api/x77.h vendored Normal file
View file

@ -0,0 +1,69 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/* Fortran-like (e.g. as in BLAS) type prefixes for F77 interface */
#if defined(FFTW_SINGLE)
# define x77(name) CONCAT(sfftw_, name)
# define X77(NAME) CONCAT(SFFTW_, NAME)
#elif defined(FFTW_LDOUBLE)
/* FIXME: what is best? BLAS uses D..._X, apparently. Ugh. */
# define x77(name) CONCAT(lfftw_, name)
# define X77(NAME) CONCAT(LFFTW_, NAME)
#elif defined(FFTW_QUAD)
# define x77(name) CONCAT(qfftw_, name)
# define X77(NAME) CONCAT(QFFTW_, NAME)
#else
# define x77(name) CONCAT(dfftw_, name)
# define X77(NAME) CONCAT(DFFTW_, NAME)
#endif
/* If F77_FUNC is not defined and the user didn't explicitly specify
--disable-fortran, then make our best guess at default wrappers
(since F77_FUNC_EQUIV should not be defined in this case, we
will use both double-underscored g77 wrappers and single- or
non-underscored wrappers). This saves us from dealing with
complaints in the cases where the user failed to specify
an F77 compiler or wrapper detection failed for some reason. */
#if !defined(F77_FUNC) && !defined(DISABLE_FORTRAN)
# if (defined(_WIN32) || defined(__WIN32__)) && !defined(WINDOWS_F77_MANGLING)
# define WINDOWS_F77_MANGLING 1
# endif
# if defined(_AIX) || defined(__hpux) || defined(hpux)
# define F77_FUNC(a, A) a
# elif defined(CRAY) || defined(_CRAY) || defined(_UNICOS)
# define F77_FUNC(a, A) A
# else
# define F77_FUNC(a, A) a ## _
# endif
# define F77_FUNC_(a, A) a ## __
#endif
#if defined(WITH_G77_WRAPPERS) && !defined(DISABLE_FORTRAN)
# undef F77_FUNC_
# define F77_FUNC_(a, A) a ## __
# undef F77_FUNC_EQUIV
#endif
/* annoying Windows syntax for shared-library declarations */
#if defined(FFTW_DLL) && (defined(_WIN32) || defined(__WIN32__))
# define FFTW_VOIDFUNC __declspec(dllexport) void
#else
# define FFTW_VOIDFUNC void
#endif