Eigen-unsupported  5.0.1-dev+284dcc12
 
Loading...
Searching...
No Matches
pocketfft_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
8namespace Eigen {
9
10namespace internal {
11
12template <typename _Scalar>
13struct pocketfft_impl {
14 using Scalar = _Scalar;
15 using Complex = std::complex<Scalar>;
16 using shape_t = pocketfft::shape_t;
17 using stride_t = pocketfft::stride_t;
18
19 inline void clear() {}
20
21 inline void fwd(Complex* dst, const Scalar* src, int nfft) {
22 const shape_t shape_{static_cast<size_t>(nfft)};
23 const shape_t axes_{0};
24 const stride_t stride_in{sizeof(Scalar)};
25 const stride_t stride_out{sizeof(Complex)};
26 pocketfft::r2c(shape_, stride_in, stride_out, axes_, pocketfft::FORWARD, src, dst, static_cast<Scalar>(1));
27 }
28
29 inline void fwd(Complex* dst, const Complex* src, int nfft) {
30 const shape_t shape_{static_cast<size_t>(nfft)};
31 const shape_t axes_{0};
32 const stride_t stride_{sizeof(Complex)};
33 pocketfft::c2c(shape_, stride_, stride_, axes_, pocketfft::FORWARD, src, dst, static_cast<Scalar>(1));
34 }
35
36 inline void inv(Scalar* dst, const Complex* src, int nfft) {
37 const shape_t shape_{static_cast<size_t>(nfft)};
38 const shape_t axes_{0};
39 const stride_t stride_in{sizeof(Complex)};
40 const stride_t stride_out{sizeof(Scalar)};
41 pocketfft::c2r(shape_, stride_in, stride_out, axes_, pocketfft::BACKWARD, src, dst, static_cast<Scalar>(1));
42 }
43
44 inline void inv(Complex* dst, const Complex* src, int nfft) {
45 const shape_t shape_{static_cast<size_t>(nfft)};
46 const shape_t axes_{0};
47 const stride_t stride_{sizeof(Complex)};
48 pocketfft::c2c(shape_, stride_, stride_, axes_, pocketfft::BACKWARD, src, dst, static_cast<Scalar>(1));
49 }
50
51 inline void fwd2(Complex* dst, const Complex* src, int nfft0, int nfft1) {
52 const shape_t shape_{static_cast<size_t>(nfft0), static_cast<size_t>(nfft1)};
53 const shape_t axes_{0, 1};
54 const stride_t stride_{static_cast<ptrdiff_t>(sizeof(Complex) * nfft1), static_cast<ptrdiff_t>(sizeof(Complex))};
55 pocketfft::c2c(shape_, stride_, stride_, axes_, pocketfft::FORWARD, src, dst, static_cast<Scalar>(1));
56 }
57
58 inline void inv2(Complex* dst, const Complex* src, int nfft0, int nfft1) {
59 const shape_t shape_{static_cast<size_t>(nfft0), static_cast<size_t>(nfft1)};
60 const shape_t axes_{0, 1};
61 const stride_t stride_{static_cast<ptrdiff_t>(sizeof(Complex) * nfft1), static_cast<ptrdiff_t>(sizeof(Complex))};
62 pocketfft::c2c(shape_, stride_, stride_, axes_, pocketfft::BACKWARD, src, dst, static_cast<Scalar>(1));
63 }
64};
65
66} // namespace internal
67} // namespace Eigen
Namespace containing all symbols from the Eigen library.