ei_pocketfft_impl.h
Go to the documentation of this file.
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 using namespace pocketfft;
9 using namespace pocketfft::detail;
10 
11 namespace Eigen {
12 
13 namespace internal {
14 
15 template<typename _Scalar>
16 struct pocketfft_impl
17 {
18  typedef _Scalar Scalar;
19  typedef std::complex<Scalar> Complex;
20 
21  inline void clear() {}
22 
23  inline void fwd(Complex* dst, const Scalar* src, int nfft){
24  const shape_t shape_{ static_cast<size_t>(nfft) };
25  const shape_t axes_{ 0 };
26  const stride_t stride_in{ sizeof(Scalar) };
27  const stride_t stride_out{ sizeof(Complex) };
28  r2c(shape_, stride_in, stride_out, axes_, FORWARD, src, dst, static_cast<Scalar>(1));
29  }
30 
31  inline void fwd(Complex* dst, const Complex* src, int nfft){
32  const shape_t shape_{ static_cast<size_t>(nfft) };
33  const shape_t axes_{ 0 };
34  const stride_t stride_{ sizeof(Complex) };
35  c2c(shape_, stride_, stride_, axes_, FORWARD, src, dst, static_cast<Scalar>(1));
36  }
37 
38  inline void inv(Scalar* dst, const Complex* src, int nfft){
39  const shape_t shape_{ static_cast<size_t>(nfft) };
40  const shape_t axes_{ 0 };
41  const stride_t stride_in{ sizeof(Complex) };
42  const stride_t stride_out{ sizeof(Scalar) };
43  c2r(shape_, stride_in, stride_out, axes_, BACKWARD, src, dst, static_cast<Scalar>(1));
44  }
45 
46  inline void inv(Complex* dst, const Complex* src, int nfft){
47  const shape_t shape_{ static_cast<size_t>(nfft) };
48  const shape_t axes_{ 0 };
49  const stride_t stride_{ sizeof(Complex) };
50  c2c(shape_, stride_, stride_, axes_, BACKWARD, src, dst, static_cast<Scalar>(1));
51  }
52 
53  inline void fwd2(Complex* dst, const Complex* src, int nfft0, int nfft1){
54  const shape_t shape_{ static_cast<size_t>(nfft0), static_cast<size_t>(nfft1) };
55  const shape_t axes_{ 0, 1 };
56  const stride_t stride_{ static_cast<ptrdiff_t>(sizeof(Complex)*nfft1), static_cast<ptrdiff_t>(sizeof(Complex)) };
57  c2c(shape_, stride_, stride_, axes_, FORWARD, src, dst, static_cast<Scalar>(1));
58  }
59 
60  inline void inv2(Complex* dst, const Complex* src, int nfft0, int nfft1){
61  const shape_t shape_{ static_cast<size_t>(nfft0), static_cast<size_t>(nfft1) };
62  const shape_t axes_{ 0, 1 };
63  const stride_t stride_{ static_cast<ptrdiff_t>(sizeof(Complex)*nfft1), static_cast<ptrdiff_t>(sizeof(Complex)) };
64  c2c(shape_, stride_, stride_, axes_, BACKWARD, src, dst, static_cast<Scalar>(1));
65  }
66 };
67 
68 } // namespace internal
69 } // namespace Eigen
: TensorContractionSycl.h, provides various tensor contraction kernel for SYCL backend