20 #define RUN_OR_ASSERT(EXPR, ERROR_MSG) \
22 MKL_LONG status = (EXPR); \
23 eigen_assert(status == DFTI_NO_ERROR && (ERROR_MSG)); \
27 return const_cast<MKL_Complex16*
>(
reinterpret_cast<const MKL_Complex16*
>(
p));
31 return const_cast<MKL_Complex8*
>(
reinterpret_cast<const MKL_Complex8*
>(
p));
43 inline void configure_descriptor(std::shared_ptr<DFTI_DESCRIPTOR>& handl,
enum DFTI_CONFIG_VALUE precision,
44 enum DFTI_CONFIG_VALUE forward_domain, MKL_LONG dimension, MKL_LONG*
sizes) {
45 eigen_assert(dimension == 1 || dimension == 2 &&
"Transformation dimension must be less than 3.");
47 DFTI_DESCRIPTOR_HANDLE
res =
nullptr;
50 "DftiCreateDescriptor failed.")
51 handl.reset(
res, [](DFTI_DESCRIPTOR_HANDLE handle) { DftiFreeDescriptor(&handle); });
52 if (forward_domain == DFTI_REAL) {
54 RUN_OR_ASSERT(DftiSetValue(handl.get(), DFTI_CONJUGATE_EVEN_STORAGE, DFTI_COMPLEX_COMPLEX),
55 "DftiSetValue failed.")
58 RUN_OR_ASSERT(DftiCreateDescriptor(&
res, precision, DFTI_COMPLEX, dimension,
sizes),
"DftiCreateDescriptor failed.")
59 handl.reset(
res, [](DFTI_DESCRIPTOR_HANDLE handle) { DftiFreeDescriptor(&handle); });
62 RUN_OR_ASSERT(DftiSetValue(handl.get(), DFTI_PLACEMENT, DFTI_NOT_INPLACE),
"DftiSetValue failed.")
63 RUN_OR_ASSERT(DftiCommitDescriptor(handl.get()),
"DftiCommitDescriptor failed.")
74 std::shared_ptr<DFTI_DESCRIPTOR>
m_plan;
78 enum DFTI_CONFIG_VALUE precision = DFTI_SINGLE;
84 RUN_OR_ASSERT(DftiComputeForward(m_plan.get(), src, dst),
"DftiComputeForward failed.")
91 RUN_OR_ASSERT(DftiComputeBackward(m_plan.get(), src, dst),
"DftiComputeBackward failed.")
98 RUN_OR_ASSERT(DftiComputeForward(m_plan.get(), src, dst),
"DftiComputeForward failed.")
105 RUN_OR_ASSERT(DftiComputeBackward(m_plan.get(), src, dst),
"DftiComputeBackward failed.")
110 MKL_LONG
sizes[2] = {n0, n1};
113 RUN_OR_ASSERT(DftiComputeForward(m_plan.get(), src, dst),
"DftiComputeForward failed.")
118 MKL_LONG
sizes[2] = {n0, n1};
121 RUN_OR_ASSERT(DftiComputeBackward(m_plan.get(), src, dst),
"DftiComputeBackward failed.")
134 enum DFTI_CONFIG_VALUE precision = DFTI_DOUBLE;
140 RUN_OR_ASSERT(DftiComputeForward(m_plan.get(), src, dst),
"DftiComputeForward failed.")
147 RUN_OR_ASSERT(DftiComputeBackward(m_plan.get(), src, dst),
"DftiComputeBackward failed.")
154 RUN_OR_ASSERT(DftiComputeForward(m_plan.get(), src, dst),
"DftiComputeForward failed.")
161 RUN_OR_ASSERT(DftiComputeBackward(m_plan.get(), src, dst),
"DftiComputeBackward failed.")
166 MKL_LONG
sizes[2] = {n0, n1};
169 RUN_OR_ASSERT(DftiComputeForward(m_plan.get(), src, dst),
"DftiComputeForward failed.")
174 MKL_LONG
sizes[2] = {n0, n1};
177 RUN_OR_ASSERT(DftiComputeBackward(m_plan.get(), src, dst),
"DftiComputeBackward failed.")
181 template <
typename Scalar_>
190 MKL_LONG
size = nfft;
196 MKL_LONG
size = nfft;
207 MKL_LONG
size = nfft;
213 MKL_LONG
size = nfft;
226 int inplace = dst == src ? 1 : 0;
227 int aligned = ((
reinterpret_cast<size_t>(src) & 15) | (
reinterpret_cast<size_t>(dst) & 15)) == 0 ? 1 : 0;
235 int inplace = (dst == src) ? 1 : 0;
236 int aligned = ((
reinterpret_cast<size_t>(src) & 15) | (
reinterpret_cast<size_t>(dst) & 15)) == 0 ? 1 : 0;
#define eigen_assert(x)
Definition: Macros.h:910
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
Definition: PartialRedux_count.cpp:3
float * p
Definition: Tutorial_Map_using.cpp:9
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
std::vector< Array2i > sizes
Definition: dense_solvers.cpp:12
#define RUN_OR_ASSERT(EXPR, ERROR_MSG)
Definition: ei_imklfft_impl.h:20
void inplace(bool square=false, bool SPD=false)
Definition: inplace_decomposition.cpp:18
void configure_descriptor(std::shared_ptr< DFTI_DESCRIPTOR > &handl, enum DFTI_CONFIG_VALUE precision, enum DFTI_CONFIG_VALUE forward_domain, MKL_LONG dimension, MKL_LONG *sizes)
Definition: ei_imklfft_impl.h:43
MKL_Complex16 * complex_cast(const std::complex< double > *p)
Definition: ei_imklfft_impl.h:26
std::int64_t int64_t
Definition: Meta.h:43
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
Definition: Eigen_Colamd.h:49
Definition: ei_imklfft_impl.h:182
plan< Scalar > & get_plan(int n0, int n1, void *dst, const void *src)
Definition: ei_imklfft_impl.h:234
std::complex< Scalar > Complex
Definition: ei_imklfft_impl.h:184
void fwd2(Complex *dst, const Complex *src, int n0, int n1)
Definition: ei_imklfft_impl.h:201
void fwd(Complex *dst, const Complex *src, int nfft)
Definition: ei_imklfft_impl.h:189
std::map< int64_t, plan< Scalar > > m_plans
Definition: ei_imklfft_impl.h:223
void clear()
Definition: ei_imklfft_impl.h:186
void inv(Scalar *dst, const Complex *src, int nfft)
Definition: ei_imklfft_impl.h:212
void inv2(Complex *dst, const Complex *src, int n0, int n1)
Definition: ei_imklfft_impl.h:218
plan< Scalar > & get_plan(int nfft, void *dst, const void *src)
Definition: ei_imklfft_impl.h:225
void fwd(Complex *dst, const Scalar *src, int nfft)
Definition: ei_imklfft_impl.h:195
void inv(Complex *dst, const Complex *src, int nfft)
Definition: ei_imklfft_impl.h:206
Scalar_ Scalar
Definition: ei_imklfft_impl.h:183
void inverse2(complex_type *dst, complex_type *src, int n0, int n1)
Definition: ei_imklfft_impl.h:172
MKL_Complex16 complex_type
Definition: ei_imklfft_impl.h:128
std::shared_ptr< DFTI_DESCRIPTOR > m_plan
Definition: ei_imklfft_impl.h:130
void inverse(scalar_type *dst, complex_type *src, MKL_LONG nfft)
Definition: ei_imklfft_impl.h:157
void inverse(complex_type *dst, complex_type *src, MKL_LONG nfft)
Definition: ei_imklfft_impl.h:143
void forward2(complex_type *dst, complex_type *src, int n0, int n1)
Definition: ei_imklfft_impl.h:164
void forward(complex_type *dst, complex_type *src, MKL_LONG nfft)
Definition: ei_imklfft_impl.h:136
void forward(complex_type *dst, scalar_type *src, MKL_LONG nfft)
Definition: ei_imklfft_impl.h:150
double scalar_type
Definition: ei_imklfft_impl.h:127
std::shared_ptr< DFTI_DESCRIPTOR > m_plan
Definition: ei_imklfft_impl.h:74
void forward(complex_type *dst, scalar_type *src, MKL_LONG nfft)
Definition: ei_imklfft_impl.h:94
float scalar_type
Definition: ei_imklfft_impl.h:71
void inverse2(complex_type *dst, complex_type *src, int n0, int n1)
Definition: ei_imklfft_impl.h:116
void forward(complex_type *dst, complex_type *src, MKL_LONG nfft)
Definition: ei_imklfft_impl.h:80
MKL_Complex8 complex_type
Definition: ei_imklfft_impl.h:72
void inverse(complex_type *dst, complex_type *src, MKL_LONG nfft)
Definition: ei_imklfft_impl.h:87
void inverse(scalar_type *dst, complex_type *src, MKL_LONG nfft)
Definition: ei_imklfft_impl.h:101
void forward2(complex_type *dst, complex_type *src, int n0, int n1)
Definition: ei_imklfft_impl.h:108
Definition: ei_imklfft_impl.h:67