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