$darkmode
Eigen-unsupported  5.0.1-dev
duccfft_impl.h
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // This Source Code Form is subject to the terms of the Mozilla
5 // Public License v. 2.0. If a copy of the MPL was not distributed
6 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 
8 namespace Eigen {
9 
10 namespace internal {
11 
12 template <typename _Scalar>
13 struct duccfft_impl {
14  using Scalar = _Scalar;
15  using Complex = std::complex<Scalar>;
16  using shape_t = ducc0::fmav_info::shape_t;
17  using stride_t = ducc0::fmav_info::stride_t;
18 
19  inline void clear() {}
20 
21  inline void fwd(Complex* dst, const Scalar* src, int nfft) {
22  const shape_t axes{0};
23  ducc0::cfmav<Scalar> m_in(src, shape_t{static_cast<size_t>(nfft)});
24  ducc0::vfmav<Complex> m_out(dst, shape_t{static_cast<size_t>(nfft) / 2 + 1});
25  ducc0::r2c(m_in, m_out, axes, /*forward=*/true, /*scale=*/static_cast<Scalar>(1));
26  }
27 
28  inline void fwd(Complex* dst, const Complex* src, int nfft) {
29  const shape_t axes{0};
30  ducc0::cfmav<Complex> m_in(src, shape_t{static_cast<size_t>(nfft)});
31  ducc0::vfmav<Complex> m_out(dst, shape_t{static_cast<size_t>(nfft)});
32  ducc0::c2c(m_in, m_out, axes, /*forward=*/true, /*scale=*/static_cast<Scalar>(1));
33  }
34 
35  inline void inv(Scalar* dst, const Complex* src, int nfft) {
36  const shape_t axes{0};
37  ducc0::cfmav<Complex> m_in(src, shape_t{static_cast<size_t>(nfft) / 2 + 1});
38  ducc0::vfmav<Scalar> m_out(dst, shape_t{static_cast<size_t>(nfft)});
39  ducc0::c2r(m_in, m_out, axes, /*forward=*/false, /*scale=*/static_cast<Scalar>(1));
40  }
41 
42  inline void inv(Complex* dst, const Complex* src, int nfft) {
43  const shape_t axes{0};
44  ducc0::cfmav<Complex> m_in(src, shape_t{static_cast<size_t>(nfft)});
45  ducc0::vfmav<Complex> m_out(dst, shape_t{static_cast<size_t>(nfft)});
46  ducc0::c2c(m_in, m_out, axes, /*forward=*/false, /*scale=*/static_cast<Scalar>(1));
47  }
48 
49  inline void fwd2(Complex* dst, const Complex* src, int nfft0, int nfft1) {
50  const shape_t axes{0, 1};
51  const shape_t in_shape{static_cast<size_t>(nfft0), static_cast<size_t>(nfft1)};
52  const shape_t out_shape{static_cast<size_t>(nfft0), static_cast<size_t>(nfft1)};
53  const stride_t stride{static_cast<ptrdiff_t>(nfft1), static_cast<ptrdiff_t>(1)};
54  ducc0::cfmav<Complex> m_in(src, in_shape, stride);
55  ducc0::vfmav<Complex> m_out(dst, out_shape, stride);
56  ducc0::c2c(m_in, m_out, axes, /*forward=*/true, /*scale=*/static_cast<Scalar>(1));
57  }
58 
59  inline void inv2(Complex* dst, const Complex* src, int nfft0, int nfft1) {
60  const shape_t axes{0, 1};
61  const shape_t in_shape{static_cast<size_t>(nfft0), static_cast<size_t>(nfft1)};
62  const shape_t out_shape{static_cast<size_t>(nfft0), static_cast<size_t>(nfft1)};
63  const stride_t stride{static_cast<ptrdiff_t>(nfft1), static_cast<ptrdiff_t>(1)};
64  ducc0::cfmav<Complex> m_in(src, in_shape, stride);
65  ducc0::vfmav<Complex> m_out(dst, out_shape, stride);
66  ducc0::c2c(m_in, m_out, axes, /*forward=*/false, /*scale=*/static_cast<Scalar>(1));
67  }
68 };
69 
70 } // namespace internal
71 } // namespace Eigen
Namespace containing all symbols from the Eigen library.