23namespace jsa::cicuetea {
27 DFTImpl(
size_t fftSize) :
30 DftiCreateDescriptor(&realSetup, DFTI_DOUBLE, DFTI_REAL, 1, this->fftSize);
31 status += DftiSetValue(realSetup, DFTI_PLACEMENT, DFTI_NOT_INPLACE);
32 status += DftiSetValue(realSetup, DFTI_CONJUGATE_EVEN_STORAGE, DFTI_COMPLEX_COMPLEX);
33 status += DftiSetValue(realSetup, DFTI_FORWARD_SCALE, 1.0);
34 status += DftiSetValue(realSetup, DFTI_BACKWARD_SCALE, 1.0 / fftSize);
35 status += DftiCommitDescriptor(realSetup);
37 DftiCreateDescriptor(&cplxSetup, DFTI_DOUBLE, DFTI_COMPLEX, 1, this->fftSize);
38 status += DftiSetValue(realSetup, DFTI_PLACEMENT, DFTI_NOT_INPLACE);
39 status += DftiSetValue(realSetup, DFTI_CONJUGATE_EVEN_STORAGE, DFTI_COMPLEX_COMPLEX);
40 status += DftiSetValue(realSetup, DFTI_FORWARD_SCALE, 1.0);
41 status += DftiSetValue(realSetup, DFTI_BACKWARD_SCALE, 1.0 / fftSize);
42 status += DftiCommitDescriptor(cplxSetup);
43 assert(status == DFTI_NO_ERROR);
48 if (realSetup) DftiFreeDescriptor(&realSetup);
49 if (cplxSetup) DftiFreeDescriptor(&cplxSetup);
52 void dft(
const dcomplex* inPtr, dcomplex* outPtr)
54 MKL_Complex16* inPtr_ =
reinterpret_cast<MKL_Complex16*
>(
const_cast<dcomplex*
>(inPtr));
55 MKL_Complex16* outPtr_ =
reinterpret_cast<MKL_Complex16*
>(outPtr);
56 DftiComputeForward(cplxSetup, inPtr_, outPtr_);
59 void idft(
const dcomplex* inPtr, dcomplex* outPtr)
61 MKL_Complex16* inPtr_ =
reinterpret_cast<MKL_Complex16*
>(
const_cast<dcomplex*
>(inPtr));
62 MKL_Complex16* outPtr_ =
reinterpret_cast<MKL_Complex16*
>(outPtr);
63 DftiComputeBackward(cplxSetup, inPtr_, outPtr_);
66 void rdft(
const double* inPtr, dcomplex* outPtr)
68 double* inPtr_ =
const_cast<double*
>(inPtr);
69 MKL_Complex16* outPtr_ =
reinterpret_cast<MKL_Complex16*
>(outPtr);
70 DftiComputeForward(realSetup, inPtr_, outPtr_);
73 void irdft(
const dcomplex* inPtr,
double* outPtr)
75 MKL_Complex16* inPtr_ =
reinterpret_cast<MKL_Complex16*
>(
const_cast<dcomplex*
>(inPtr));
76 DftiComputeBackward(cplxSetup, inPtr_, outPtr);
79 static const std::string getName()
86 DFTI_DESCRIPTOR_HANDLE realSetup;
87 DFTI_DESCRIPTOR_HANDLE cplxSetup;
88 long status = DFTI_NO_ERROR;