13 #include <Eigen/CXX11/Tensor> 17 template <
int DataLayout>
28 tensor_after_fft = tensor.template fft<Eigen::BothParts, Eigen::FFT_FORWARD>(fft);
29 tensor_after_fft_ifft = tensor_after_fft.template fft<Eigen::BothParts, Eigen::FFT_REVERSE>(fft);
34 for (
int i = 0;
i < sequence_length; ++
i) {
39 template <
int DataLayout>
51 tensor_after_fft = tensor.template fft<Eigen::BothParts, Eigen::FFT_FORWARD>(fft);
52 tensor_after_fft_ifft = tensor_after_fft.template fft<Eigen::BothParts, Eigen::FFT_REVERSE>(fft);
59 for (
int i = 0;
i < dim0; ++
i) {
60 for (
int j = 0;
j < dim1; ++
j) {
67 template <
int DataLayout>
80 tensor_after_fft = tensor.template fft<Eigen::BothParts, Eigen::FFT_FORWARD>(fft);
81 tensor_after_fft_ifft = tensor_after_fft.template fft<Eigen::BothParts, Eigen::FFT_REVERSE>(fft);
90 for (
int i = 0;
i < dim0; ++
i) {
91 for (
int j = 0;
j < dim1; ++
j) {
92 for (
int k = 0; k < dim2; ++k) {
99 template <
int DataLayout>
111 tensor_after_fft = tensor.template fft<Eigen::BothParts, Eigen::FFT_FORWARD>(fft);
112 tensor_after_fft_ifft = tensor_after_fft.template fft<Eigen::RealPart, Eigen::FFT_REVERSE>(fft);
123 for (
int i = 0;
i < dim0; ++
i) {
124 for (
int j = 0;
j < dim1; ++
j) {
125 for (
int k = 0; k < dim2; ++k) {
126 for (
int l = 0;
l < dim3; ++
l) {
127 VERIFY_IS_APPROX(static_cast<float>(tensor(
i,
j,k,
l)), static_cast<float>(tensor_after_fft_ifft(
i,
j,k,
l)));
138 CALL_SUBTEST(test_1D_fft_ifft_invariant<ColMajor>(1024*1024));
140 CALL_SUBTEST(test_2D_fft_ifft_invariant<ColMajor>(4,4));
141 CALL_SUBTEST(test_2D_fft_ifft_invariant<ColMajor>(8,16));
142 CALL_SUBTEST(test_2D_fft_ifft_invariant<ColMajor>(16,32));
143 CALL_SUBTEST(test_2D_fft_ifft_invariant<ColMajor>(1024,1024));
145 CALL_SUBTEST(test_3D_fft_ifft_invariant<ColMajor>(4,4,4));
146 CALL_SUBTEST(test_3D_fft_ifft_invariant<ColMajor>(8,16,32));
147 CALL_SUBTEST(test_3D_fft_ifft_invariant<ColMajor>(16,4,8));
148 CALL_SUBTEST(test_3D_fft_ifft_invariant<ColMajor>(256,256,256));
150 CALL_SUBTEST(test_sub_fft_ifft_invariant<ColMajor>(4,4,4,4));
151 CALL_SUBTEST(test_sub_fft_ifft_invariant<ColMajor>(8,16,32,64));
152 CALL_SUBTEST(test_sub_fft_ifft_invariant<ColMajor>(16,4,8,12));
153 CALL_SUBTEST(test_sub_fft_ifft_invariant<ColMajor>(64,64,64,64));
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index dimension(std::size_t n) const
static void test_sub_fft_ifft_invariant(int dim0, int dim1, int dim2, int dim3)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor< Scalar_, NumIndices_, Options_, IndexType_ > & setRandom()
static void test_3D_fft_ifft_invariant(int dim0, int dim1, int dim2)
#define VERIFY_IS_APPROX(a, b)
static const Line3 l(Rot3(), 1, 1)
#define VERIFY_IS_EQUAL(a, b)
static void test_2D_fft_ifft_invariant(int dim0, int dim1)
static void test_1D_fft_ifft_invariant(int sequence_length)
void test_cxx11_tensor_ifft()
#define CALL_SUBTEST(FUNC)