18#ifndef IPPL_FFT_FFTPACK_FFT_H
19#define IPPL_FFT_FFTPACK_FFT_H
27 void cffti (
size_t n,
double& wsave);
28 void cfftf (
size_t n,
double& r,
double& wsave);
29 void cfftb (
size_t n,
double& r,
double& wsave);
31 void rffti (
size_t n,
double& wsave);
32 void rfftf (
size_t n,
double& r,
double& wsave);
33 void rfftb (
size_t n,
double& r,
double& wsave);
35 void sinti (
size_t n,
double& wsave);
36 void sint (
size_t n,
double& r,
double& wsave);
39 void fcfftf (
size_t n,
float& r,
float& wsave);
40 void fcfftb (
size_t n,
float& r,
float& wsave);
43 void frfftf (
size_t n,
float& r,
float& wsave);
44 void frfftb (
size_t n,
float& r,
float& wsave);
47 void fsint (
size_t n,
float& r,
float& wsave);
68 static void ccfftf(
size_t n,
float* r,
float* wsave) {
fcfftf (
n, *r, *wsave); }
69 static void ccfftb(
size_t n,
float* r,
float* wsave) {
fcfftb (
n, *r, *wsave); }
71 static void rcfftf(
size_t n,
float* r,
float* wsave) {
frfftf (
n, *r, *wsave); }
72 static void rcfftb(
size_t n,
float* r,
float* wsave) {
frfftb (
n, *r, *wsave); }
74 static void rrfft(
size_t n,
float* r,
float* wsave) {
fsint (
n, *r, *wsave); }
89 static void ccfftf(
size_t n,
double* r,
double* wsave) {
cfftf (
n, *r, *wsave);}
90 static void ccfftb(
size_t n,
double* r,
double* wsave) {
cfftb (
n, *r, *wsave);}
92 static void rcfftf(
size_t n,
double* r,
double* wsave) {
rfftf (
n, *r, *wsave);}
93 static void rcfftb(
size_t n,
double* r,
double* wsave) {
rfftb (
n, *r, *wsave);}
95 static void rrfft(
size_t n,
double* r,
double* wsave) {
sint (
n, *r, *wsave); }
117 void setup(
unsigned numTransformDims,
const int* transformTypes,
118 const int* axisLengths);
124 void callFFT(
unsigned transformDim,
int direction,
T* data);
143 for (
unsigned d=0; d<numTransformDims_m; ++d)
146 delete [] transformType_m;
147 delete [] axisLength_m;
154 const int* axisLengths) {
157 numTransformDims_m = numTransformDims;
158 transformType_m =
new int[numTransformDims_m];
159 axisLength_m =
new int[numTransformDims_m];
161 for (d=0; d<numTransformDims_m; ++d) {
162 transformType_m[d] = transformTypes[d];
163 axisLength_m[d] = axisLengths[d];
167 trig_m =
new T*[numTransformDims_m];
168 for (d=0; d<numTransformDims_m; ++d) {
169 switch (transformType_m[d]) {
171 trig_m[d] =
new T[4 * axisLength_m[d] + 15];
175 trig_m[d] =
new T[2 * axisLength_m[d] + 15];
179 trig_m[d] =
new T[
static_cast<int>(2.5 * axisLength_m[d] + 0.5) + 15];
202 T* rdata =
reinterpret_cast<T*
>(data);
205 switch (transformType_m[transformDim]) {
207 if (direction == +1) {
210 trig_m[transformDim]);
215 trig_m[transformDim]);
219 if (direction == +1) {
222 trig_m[transformDim]);
224 int clen = axisLength_m[transformDim]/2 + 1;
225 data[clen-1] = Complex_t(
imag(data[clen-2]),0.0);
226 for (
int i = clen-2; i > 0; --i)
227 data[i] = Complex_t(
imag(data[i-1]),
real(data[i]));
228 data[0] = Complex_t(
real(data[0]),0.0);
232 int clen = axisLength_m[transformDim]/2 + 1;
233 data[0] = Complex_t(
real(data[0]),
real(data[1]));
234 for (
int i = 1; i < clen-1; ++i)
235 data[i] = Complex_t(
imag(data[i]),
real(data[i+1]));
238 trig_m[transformDim]);
242 ERRORMSG(
"Input for real-to-real FFT should be real!!" <<
endl);
265 switch (transformType_m[transformDim]) {
267 ERRORMSG(
"Input for complex-to-complex FFT should be complex!!" <<
endl);
270 ERRORMSG(
"real-to-complex FFT uses complex input!!" <<
endl);
275 trig_m[transformDim]);
FLieGenerator< T, N > real(const FLieGenerator< std::complex< T >, N > &)
Take real part of a complex generator.
FLieGenerator< T, N > imag(const FLieGenerator< std::complex< T >, N > &)
Take imaginary part of a complex generator.
void frfftf(size_t n, float &r, float &wsave)
void frffti(size_t n, float &wsave)
void rfftf(size_t n, double &r, double &wsave)
void fsint(size_t n, float &r, float &wsave)
void cffti(size_t n, double &wsave)
void fsinti(size_t n, float &wsave)
void cfftf(size_t n, double &r, double &wsave)
void sint(size_t n, double &r, double &wsave)
void sinti(size_t n, double &wsave)
void cfftb(size_t n, double &r, double &wsave)
void rfftb(size_t n, double &r, double &wsave)
void fcffti(size_t n, float &wsave)
void fcfftf(size_t n, float &r, float &wsave)
void rffti(size_t n, double &wsave)
void fcfftb(size_t n, float &r, float &wsave)
void frfftb(size_t n, float &r, float &wsave)
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
Inform & endl(Inform &inf)
static void ccfftb(size_t n, float *r, float *wsave)
static void rcfftb(size_t n, float *r, float *wsave)
static void rcffti(size_t n, float *wsave)
static void ccfftf(size_t n, float *r, float *wsave)
static void rcfftf(size_t n, float *r, float *wsave)
static void rrfft(size_t n, float *r, float *wsave)
static void ccffti(size_t n, float *wsave)
static void rrffti(size_t n, float *wsave)
static void ccfftb(size_t n, double *r, double *wsave)
static void rrfft(size_t n, double *r, double *wsave)
static void rrffti(size_t n, double *wsave)
static void rcffti(size_t n, double *wsave)
static void rcfftb(size_t n, double *r, double *wsave)
static void rcfftf(size_t n, double *r, double *wsave)
static void ccfftf(size_t n, double *r, double *wsave)
static void ccffti(size_t n, double *wsave)
std::complex< T > Complex_t
void callFFT(unsigned transformDim, int direction, Complex_t *data)
unsigned numTransformDims_m
void setup(unsigned numTransformDims, const int *transformTypes, const int *axisLengths)