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 |
6256
|
32 OCTAVE_API |
6228
|
33 octave_fftw_planner |
|
34 { |
|
35 public: |
|
36 |
|
37 octave_fftw_planner (void); |
|
38 |
|
39 fftw_plan create_plan (int dir, const int rank, const dim_vector dims, |
|
40 octave_idx_type howmany, octave_idx_type stride, octave_idx_type dist, |
|
41 const Complex *in, Complex *out); |
|
42 |
|
43 fftw_plan create_plan (const int rank, const dim_vector dims, |
|
44 octave_idx_type howmany, octave_idx_type stride, octave_idx_type dist, |
|
45 const double *in, Complex *out); |
|
46 |
|
47 enum FftwMethod { |
|
48 UNKNOWN = -1, |
|
49 ESTIMATE, |
|
50 MEASURE, |
|
51 PATIENT, |
|
52 EXHAUSTIVE, |
|
53 HYBRID |
|
54 }; |
|
55 |
|
56 FftwMethod method (void); |
|
57 |
|
58 FftwMethod method (FftwMethod _meth); |
|
59 |
|
60 private: |
|
61 |
|
62 FftwMethod meth; |
|
63 |
|
64 // FIXME -- perhaps this should be split into two classes? |
|
65 |
|
66 // Plan for fft and ifft of complex values |
|
67 fftw_plan plan[2]; |
|
68 |
|
69 // dist |
|
70 octave_idx_type d[2]; |
|
71 |
|
72 // stride |
|
73 octave_idx_type s[2]; |
|
74 |
|
75 // rank |
|
76 int r[2]; |
|
77 |
|
78 // howmany |
|
79 octave_idx_type h[2]; |
|
80 |
|
81 // dims |
|
82 dim_vector n[2]; |
|
83 |
|
84 bool simd_align[2]; |
|
85 bool inplace[2]; |
|
86 |
|
87 // Plan for fft of real values |
|
88 fftw_plan rplan; |
|
89 |
|
90 // dist |
|
91 octave_idx_type rd; |
|
92 |
|
93 // stride |
|
94 octave_idx_type rs; |
|
95 |
|
96 // rank |
|
97 int rr; |
|
98 |
|
99 // howmany |
|
100 octave_idx_type rh; |
|
101 |
|
102 // dims |
|
103 dim_vector rn; |
|
104 |
|
105 bool rsimd_align; |
|
106 }; |
|
107 |
6242
|
108 // FIXME -- maybe octave_fftw_planner should be a singleton object? |
6256
|
109 extern OCTAVE_API octave_fftw_planner fftw_planner; |
6242
|
110 |
6228
|
111 class |
3828
|
112 octave_fftw |
|
113 { |
|
114 public: |
4773
|
115 static int fft (const double *in, Complex *out, size_t npts, |
5275
|
116 size_t nsamples = 1, octave_idx_type stride = 1, octave_idx_type dist = -1); |
4773
|
117 static int fft (const Complex *in, Complex *out, size_t npts, |
5275
|
118 size_t nsamples = 1, octave_idx_type stride = 1, octave_idx_type dist = -1); |
4773
|
119 static int ifft (const Complex *in, Complex *out, size_t npts, |
5275
|
120 size_t nsamples = 1, octave_idx_type stride = 1, octave_idx_type dist = -1); |
3828
|
121 |
4773
|
122 static int fftNd (const double*, Complex*, const int, const dim_vector &); |
|
123 static int fftNd (const Complex*, Complex*, const int, |
|
124 const dim_vector &); |
|
125 static int ifftNd (const Complex*, Complex*, const int, |
|
126 const dim_vector &); |
3828
|
127 |
|
128 private: |
|
129 octave_fftw (); |
|
130 octave_fftw (const octave_fftw&); |
|
131 octave_fftw& operator = (const octave_fftw&); |
|
132 }; |
|
133 |
|
134 #endif |
|
135 |
|
136 /* |
|
137 ;;; Local Variables: *** |
|
138 ;;; mode: C++ *** |
|
139 ;;; End: *** |
|
140 */ |
|
141 |