MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / fft_inplace

Function fft_inplace

src/backend/cpu/fft.cpp:79–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77
78template<typename T>
79void fft_inplace(Array<T> &in, const int rank, const bool direction) {
80 auto func = [=](Param<T> in, const af::dim4 iDataDims) {
81 const af::dim4 idims = in.dims();
82
83 auto t_dims = computeDims(rank, idims);
84 auto in_embed = computeDims(rank, iDataDims);
85
86 const af::dim4 istrides = in.strides();
87
88 using ctype_t = typename fftw_transform<T>::ctype_t;
89 typename fftw_transform<T>::plan_t plan;
90
91 fftw_transform<T> transform;
92
93 int batch = 1;
94 for (int i = rank; i < 4; i++) { batch *= idims[i]; }
95
96 plan = transform.create(
97 rank, t_dims.data(), batch, reinterpret_cast<ctype_t *>(in.get()),
98 in_embed.data(), static_cast<int>(istrides[0]),
99 static_cast<int>(istrides[rank]),
100 reinterpret_cast<ctype_t *>(in.get()), in_embed.data(),
101 static_cast<int>(istrides[0]), static_cast<int>(istrides[rank]),
102 direction ? FFTW_FORWARD : FFTW_BACKWARD,
103 FFTW_ESTIMATE); // NOLINT(hicpp-signed-bitwise)
104
105 transform.execute(plan);
106 transform.destroy(plan);
107 };
108 getQueue().enqueue(func, in, in.getDataDims());
109}
110
111template<typename Tc, typename Tr>
112Array<Tc> fft_r2c(const Array<Tr> &in, const int rank) {

Callers

nothing calls this directly

Calls 8

computeDimsFunction · 0.70
getQueueFunction · 0.50
dimsMethod · 0.45
stridesMethod · 0.45
createMethod · 0.45
getMethod · 0.45
enqueueMethod · 0.45
getDataDimsMethod · 0.45

Tested by

no test coverage detected