@@ -71,6 +71,50 @@ TYPED_TEST(TransformAndInvert_realFFT, realFFT_nD_n_equals_1_xarray) {
7171 assert_results (a, a_fourier, should_be_a);
7272}
7373
74+ // odd data sizes
75+
76+ TYPED_TEST (TransformAndInvert_realFFT, realFFT_1D_oddsize_xarray) {
77+ xt::xarray<TypeParam, xt::layout_type::row_major> a = generate_data<TypeParam, 1 >(5 );
78+ auto a_fourier = xt::fftw::rfft (a);
79+ // std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
80+ auto should_be_a = xt::fftw::irfft (a_fourier);
81+ assert_results (a, a_fourier, should_be_a);
82+ }
83+
84+ TYPED_TEST (TransformAndInvert_realFFT, realFFT_2D_oddsize_xarray) {
85+ xt::xarray<TypeParam, xt::layout_type::row_major> a = generate_data<TypeParam, 2 >(5 );
86+ auto a_fourier = xt::fftw::rfft2 (a);
87+ // std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
88+ auto should_be_a = xt::fftw::irfft2 (a_fourier);
89+ assert_results (a, a_fourier, should_be_a);
90+ }
91+
92+
93+ TYPED_TEST (TransformAndInvert_realFFT, realFFT_3D_oddsize_xarray) {
94+ xt::xarray<TypeParam> a = generate_data<TypeParam, 3 >(5 );
95+ auto a_fourier = xt::fftw::rfft3 (a);
96+ // std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
97+ auto should_be_a = xt::fftw::irfft3 (a_fourier);
98+ assert_results (a, a_fourier, should_be_a);
99+ }
100+
101+
102+ TYPED_TEST (TransformAndInvert_realFFT, realFFT_nD_n_equals_4_oddsize_xarray) {
103+ xt::xarray<TypeParam> a = generate_data<TypeParam, 4 >(5 );
104+ auto a_fourier = xt::fftw::rfftn<4 >(a);
105+ // std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
106+ auto should_be_a = xt::fftw::irfftn<4 >(a_fourier);
107+ assert_results (a, a_fourier, should_be_a);
108+ }
109+
110+ TYPED_TEST (TransformAndInvert_realFFT, realFFT_nD_n_equals_1_oddsize_xarray) {
111+ xt::xarray<TypeParam> a = generate_data<TypeParam, 1 >(5 );
112+ auto a_fourier = xt::fftw::rfftn<1 >(a);
113+ // std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
114+ auto should_be_a = xt::fftw::irfftn<1 >(a_fourier);
115+ assert_results (a, a_fourier, should_be_a);
116+ }
117+
74118
75119/*
76120////
0 commit comments