3828
|
1 /* |
|
2 |
|
3 This file is part of Octave. |
|
4 |
|
5 Octave is free software; you can redistribute it and/or modify it |
|
6 under the terms of the GNU General Public License as published by the |
|
7 Free Software Foundation; either version 2, or (at your option) any |
|
8 later version. |
|
9 |
|
10 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 for more details. |
|
14 |
|
15 You should have received a copy of the GNU General Public License |
|
16 along with Octave; see the file COPYING. If not, write to the Free |
5307
|
17 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 02110-1301, USA. |
3828
|
19 |
|
20 */ |
|
21 |
|
22 #if !defined (octave_oct_fftw_h) |
|
23 #define octave_oct_fftw_h 1 |
|
24 |
|
25 #include <cstddef> |
4773
|
26 #include <fftw3.h> |
3828
|
27 |
|
28 #include "oct-cmplx.h" |
4773
|
29 #include "dim-vector.h" |
3828
|
30 |
|
31 class |
6228
|
32 octave_fftw_planner |
|
33 { |
|
34 public: |
|
35 |
|
36 octave_fftw_planner (void); |
|
37 |
|
38 fftw_plan create_plan (int dir, const int rank, const dim_vector dims, |
|
39 octave_idx_type howmany, octave_idx_type stride, octave_idx_type dist, |
|
40 const Complex *in, Complex *out); |
|
41 |
|
42 fftw_plan create_plan (const int rank, const dim_vector dims, |
|
43 octave_idx_type howmany, octave_idx_type stride, octave_idx_type dist, |
|
44 const double *in, Complex *out); |
|
45 |
|
46 enum FftwMethod { |
|
47 UNKNOWN = -1, |
|
48 ESTIMATE, |
|
49 MEASURE, |
|
50 PATIENT, |
|
51 EXHAUSTIVE, |
|
52 HYBRID |
|
53 }; |
|
54 |
|
55 FftwMethod method (void); |
|
56 |
|
57 FftwMethod method (FftwMethod _meth); |
|
58 |
|
59 private: |
|
60 |
|
61 FftwMethod meth; |
|
62 |
|
63 // FIXME -- perhaps this should be split into two classes? |
|
64 |
|
65 // Plan for fft and ifft of complex values |
|
66 fftw_plan plan[2]; |
|
67 |
|
68 // dist |
|
69 octave_idx_type d[2]; |
|
70 |
|
71 // stride |
|
72 octave_idx_type s[2]; |
|
73 |
|
74 // rank |
|
75 int r[2]; |
|
76 |
|
77 // howmany |
|
78 octave_idx_type h[2]; |
|
79 |
|
80 // dims |
|
81 dim_vector n[2]; |
|
82 |
|
83 bool simd_align[2]; |
|
84 bool inplace[2]; |
|
85 |
|
86 // Plan for fft of real values |
|
87 fftw_plan rplan; |
|
88 |
|
89 // dist |
|
90 octave_idx_type rd; |
|
91 |
|
92 // stride |
|
93 octave_idx_type rs; |
|
94 |
|
95 // rank |
|
96 int rr; |
|
97 |
|
98 // howmany |
|
99 octave_idx_type rh; |
|
100 |
|
101 // dims |
|
102 dim_vector rn; |
|
103 |
|
104 bool rsimd_align; |
|
105 }; |
|
106 |
|
107 class |
3828
|
108 octave_fftw |
|
109 { |
|
110 public: |
4773
|
111 static int fft (const double *in, Complex *out, size_t npts, |
5275
|
112 size_t nsamples = 1, octave_idx_type stride = 1, octave_idx_type dist = -1); |
4773
|
113 static int fft (const Complex *in, Complex *out, size_t npts, |
5275
|
114 size_t nsamples = 1, octave_idx_type stride = 1, octave_idx_type dist = -1); |
4773
|
115 static int ifft (const Complex *in, Complex *out, size_t npts, |
5275
|
116 size_t nsamples = 1, octave_idx_type stride = 1, octave_idx_type dist = -1); |
3828
|
117 |
4773
|
118 static int fftNd (const double*, Complex*, const int, const dim_vector &); |
|
119 static int fftNd (const Complex*, Complex*, const int, |
|
120 const dim_vector &); |
|
121 static int ifftNd (const Complex*, Complex*, const int, |
|
122 const dim_vector &); |
3828
|
123 |
|
124 private: |
|
125 octave_fftw (); |
|
126 octave_fftw (const octave_fftw&); |
|
127 octave_fftw& operator = (const octave_fftw&); |
|
128 }; |
|
129 |
|
130 #endif |
|
131 |
|
132 /* |
|
133 ;;; Local Variables: *** |
|
134 ;;; mode: C++ *** |
|
135 ;;; End: *** |
|
136 */ |
|
137 |