Commit 2ad915e8 authored by Mert Burkay Çöteli's avatar Mert Burkay Çöteli
Browse files

AIM integration 220621

parent adc6521c
#include "analysistransform.h"
int main()
{
analysistransform* m_fft = new analysistransform();
return 0;
}
#include "soundfielddescription.h"
soundfielddescription::soundfielddescription(string json_textaddress)
{
}
void* soundfielddescription::calcsphericalharmonics(double* pressure_real_in, double* pressure_imag_in, double* shd_realpart_out, double* shd_imagpart_out)
{
int nof_sph = (int)(pow(SHDorder + 1, 2));
for (int sn = 0; sn < nofsamples; sn++)
{
//malloc with zero valued spherical harmonics
complex<double>* sph_harmonics = (complex<double>*)calloc(nof_sph, sizeof(complex<double>));
//SHD computation according to the recording microphones
for (int ml = 0; ml < nofmicrophones; ml++)
{
// get the microphone coordinates in theta/phi
model::point<double, 2, cs::spherical<radian> > p1((*(micanglestheta + ml) * PI / 180), (*(micanglesphi + ml) * PI / 180));
int counter = 0;
// SHD calculations according to the spherical harmonics
for (int sph_n = 0; sph_n <= SHDorder; sph_n++)
{
for (int sph_m = ((-1) * sph_n); sph_m <= sph_n; sph_m++)
{
complex<double> calcharmonic_conj = conj((complex<double>)boost::math::spherical_harmonic(sph_n, sph_m, get<0>(p1), get<1>(p1)));
*(sph_harmonics + counter) += complex<double>(pressure_real_in[sn* nofmicrophones + ml], pressure_imag_in[sn * nofmicrophones + ml]) * calcharmonic_conj;
shd_realpart_out[sn * nof_sph + counter] = sph_harmonics[counter].real();
shd_imagpart_out[sn * nof_sph + counter] = sph_harmonics[counter].imag();
counter++;
}
}
}
}
return 0;
}
\ No newline at end of file
#pragma once
#ifndef Q_MOC_RUN
#include "boost/geometry.hpp"
#endif
#include "boost/math/special_functions/bessel.hpp"
#include "boost/math/special_functions/bessel_prime.hpp"
#include "boost/math/special_functions/legendre.hpp"
#include "boost/math/special_functions/hankel.hpp"
#include "boost/math/special_functions/spherical_harmonic.hpp"
#include "boost/variant/get.hpp"
#define SHDorder 1
#define PI 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117068
using namespace std;
using namespace boost::geometry;
using namespace boost::math;
class soundfielddescription
{
public:
soundfielddescription(string json_textaddress);
void* calcsphericalharmonics(double* pressure_real_in, double* pressure_imag_in, double* shd_realpart_out, double* shd_imagpart_out);
private:
float* micanglestheta;
float* micanglesphi;
int nofmicrophones;
int nofsamples;
};
###############################Introduction##################################################
Synthesis tranform is an AIM that is used for transferring the time-frequency domain interleaved microphone array signals into the time domain.
IN:
realpart : fft_real[0] to fft_real[N/2 -1]
imagpart : imagpart[0] to imagpart[N/2 -1]
OUT:
Signal : x[0] to x[signalLength - 1]
###############################Windows (x64) Installation##################################################
#include \include directory
-------Debug--------
libs \libs\Windows_x64\Debug\fftw3.lib
-------Release--------
libs \libs\Windows_x64\Release\fftw3.lib
###############################Windows (x86) Installation##################################################
#include \include directory
-------Debug--------
libs
-------Release--------
libs
###############################Linux Installation##################################################
#include \include directory
-------Debug--------
libs
-------Release--------
libs
###############################Standalone usage of this AIM (code script)##################################################
// For analysis of interleaved Nofchannelsx10240 samples with fftsize=2048 and overlap=1024
// The output will be Interleaved Nofchannelsx20480 in real numbers.
// Input and output data formats can be followed from MPAI-CAE v1.3
synthesistransform* m_fft = new synthesistransform();
float* signal; // Interleaved data output
float* realpart; // Real part to be malloc
float* imagpart; // Imaginary part to be malloc
m_fft->IFFT(signal, realpart, imagpart);
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
This diff is collapsed.
/*
* 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__ */
/*
* 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));
}
/*
* 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);
}
/*
* 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);
}
/*
* 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);
}
/*
* 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]);
}
/*
* 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);
}
/*
* 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);
}
/*
* 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);
}
/*
* 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);
}
/*
* 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);
}
/*
* 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;
}
/*
* 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;
}
/*
* 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);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment