annotate liboctave/numeric/oct-fftw.h @ 23615:be7b884ac589

use version number in OCTAVE_DEPRECATED macro * mk-octave-config-h.sh, oct-conf-post.in.h (OCTAVE_DEPRECATED): New argument, VER, to record and display version number in which the object was marked as deprecated. Change all uses.
author John W. Eaton <jwe@octave.org>
date Fri, 16 Jun 2017 09:19:20 -0400
parents d691ed308237
children 980f39c3ab90
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3828
adc217ebe692 [project @ 2001-05-02 14:50:46 by jwe]
jwe
parents:
diff changeset
1 /*
adc217ebe692 [project @ 2001-05-02 14:50:46 by jwe]
jwe
parents:
diff changeset
2
23219
3ac9f9ecfae5 maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents: 23083
diff changeset
3 Copyright (C) 2001-2017 John W. Eaton
7017
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
4
3828
adc217ebe692 [project @ 2001-05-02 14:50:46 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
adc217ebe692 [project @ 2001-05-02 14:50:46 by jwe]
jwe
parents:
diff changeset
6
adc217ebe692 [project @ 2001-05-02 14:50:46 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
8 under the terms of the GNU General Public License as published by
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
9 the Free Software Foundation; either version 3 of the License, or
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
10 (at your option) any later version.
3828
adc217ebe692 [project @ 2001-05-02 14:50:46 by jwe]
jwe
parents:
diff changeset
11
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
12 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
13 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
15 GNU General Public License for more details.
3828
adc217ebe692 [project @ 2001-05-02 14:50:46 by jwe]
jwe
parents:
diff changeset
16
adc217ebe692 [project @ 2001-05-02 14:50:46 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6583
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6583
diff changeset
19 <http://www.gnu.org/licenses/>.
3828
adc217ebe692 [project @ 2001-05-02 14:50:46 by jwe]
jwe
parents:
diff changeset
20
adc217ebe692 [project @ 2001-05-02 14:50:46 by jwe]
jwe
parents:
diff changeset
21 */
adc217ebe692 [project @ 2001-05-02 14:50:46 by jwe]
jwe
parents:
diff changeset
22
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19697
diff changeset
23 #if ! defined (octave_oct_fftw_h)
3828
adc217ebe692 [project @ 2001-05-02 14:50:46 by jwe]
jwe
parents:
diff changeset
24 #define octave_oct_fftw_h 1
adc217ebe692 [project @ 2001-05-02 14:50:46 by jwe]
jwe
parents:
diff changeset
25
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
26 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
27
3828
adc217ebe692 [project @ 2001-05-02 14:50:46 by jwe]
jwe
parents:
diff changeset
28 #include <cstddef>
9523
0ce82753dd72 more configure changes for libraries
John W. Eaton <jwe@octave.org>
parents: 9516
diff changeset
29
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23440
diff changeset
30 #include <string>
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23440
diff changeset
31
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23440
diff changeset
32 #include "dim-vector.h"
3828
adc217ebe692 [project @ 2001-05-02 14:50:46 by jwe]
jwe
parents:
diff changeset
33 #include "oct-cmplx.h"
adc217ebe692 [project @ 2001-05-02 14:50:46 by jwe]
jwe
parents:
diff changeset
34
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
35 namespace octave
6228
aa5df9ba98d5 [project @ 2007-01-05 22:49:03 by dbateman]
dbateman
parents: 5307
diff changeset
36 {
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
37 class
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
38 OCTAVE_API
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
39 fftw_planner
9516
fb933db0c517 convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
40 {
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
41 protected:
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
42
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
43 fftw_planner (void);
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
44
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
45 public:
6228
aa5df9ba98d5 [project @ 2007-01-05 22:49:03 by dbateman]
dbateman
parents: 5307
diff changeset
46
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
47 // No copying!
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
48
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
49 fftw_planner (const fftw_planner&) = delete;
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
50
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
51 fftw_planner& operator = (const fftw_planner&) = delete;
9516
fb933db0c517 convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
52
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
53 ~fftw_planner (void);
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
54
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
55 enum FftwMethod
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
56 {
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
57 UNKNOWN = -1,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
58 ESTIMATE,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
59 MEASURE,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
60 PATIENT,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
61 EXHAUSTIVE,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
62 HYBRID
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
63 };
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
64
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
65 static bool instance_ok (void);
6228
aa5df9ba98d5 [project @ 2007-01-05 22:49:03 by dbateman]
dbateman
parents: 5307
diff changeset
66
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
67 static void *
23440
f15f0d8b78c8 pass dim_vector as const reference, not by value
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
68 create_plan (int dir, const int rank, const dim_vector& dims,
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
69 octave_idx_type howmany, octave_idx_type stride,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
70 octave_idx_type dist, const Complex *in,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
71 Complex *out)
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
72 {
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
73 return instance_ok ()
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
74 ? instance->do_create_plan (dir, rank, dims, howmany, stride,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
75 dist, in, out)
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
76 : 0;
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
77 }
9516
fb933db0c517 convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
78
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
79 static void *
23440
f15f0d8b78c8 pass dim_vector as const reference, not by value
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
80 create_plan (const int rank, const dim_vector& dims,
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
81 octave_idx_type howmany, octave_idx_type stride,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
82 octave_idx_type dist, const double *in, Complex *out)
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
83 {
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
84 return instance_ok ()
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
85 ? instance->do_create_plan (rank, dims, howmany, stride, dist,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
86 in, out)
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
87 : 0;
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
88 }
15960
bde7731b2b83 added FFTW multithreaded library support
Andreas Weber <andy.weber.aw@gmail.com>
parents: 15818
diff changeset
89
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
90 static FftwMethod method (void)
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
91 {
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
92 static FftwMethod dummy;
6228
aa5df9ba98d5 [project @ 2007-01-05 22:49:03 by dbateman]
dbateman
parents: 5307
diff changeset
93
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
94 return instance_ok () ? instance->do_method () : dummy;
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
95 }
12122
f4689107dd8c Explicitly disallow copying in some classes.
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11586
diff changeset
96
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
97 static FftwMethod method (FftwMethod _meth)
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
98 {
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
99 static FftwMethod dummy;
12122
f4689107dd8c Explicitly disallow copying in some classes.
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11586
diff changeset
100
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
101 return instance_ok () ? instance->do_method (_meth) : dummy;
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
102 }
9516
fb933db0c517 convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
103
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
104 static void threads (int nt);
13983
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 12122
diff changeset
105
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
106 static int threads (void)
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
107 {
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
108 return instance_ok () ? instance->nthreads : 0;
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
109 }
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
110
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
111 private:
9516
fb933db0c517 convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
112
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
113 static fftw_planner *instance;
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
114
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
115 static void cleanup_instance (void) { delete instance; instance = 0; }
9516
fb933db0c517 convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
116
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
117 void *
23440
f15f0d8b78c8 pass dim_vector as const reference, not by value
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
118 do_create_plan (int dir, const int rank, const dim_vector& dims,
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
119 octave_idx_type howmany, octave_idx_type stride,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
120 octave_idx_type dist, const Complex *in,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
121 Complex *out);
6228
aa5df9ba98d5 [project @ 2007-01-05 22:49:03 by dbateman]
dbateman
parents: 5307
diff changeset
122
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
123 void *
23440
f15f0d8b78c8 pass dim_vector as const reference, not by value
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
124 do_create_plan (const int rank, const dim_vector& dims,
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
125 octave_idx_type howmany, octave_idx_type stride,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
126 octave_idx_type dist, const double *in, Complex *out);
6228
aa5df9ba98d5 [project @ 2007-01-05 22:49:03 by dbateman]
dbateman
parents: 5307
diff changeset
127
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
128 FftwMethod do_method (void);
6228
aa5df9ba98d5 [project @ 2007-01-05 22:49:03 by dbateman]
dbateman
parents: 5307
diff changeset
129
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
130 FftwMethod do_method (FftwMethod _meth);
6228
aa5df9ba98d5 [project @ 2007-01-05 22:49:03 by dbateman]
dbateman
parents: 5307
diff changeset
131
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
132 FftwMethod meth;
6228
aa5df9ba98d5 [project @ 2007-01-05 22:49:03 by dbateman]
dbateman
parents: 5307
diff changeset
133
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
134 // FIXME: perhaps this should be split into two classes?
6228
aa5df9ba98d5 [project @ 2007-01-05 22:49:03 by dbateman]
dbateman
parents: 5307
diff changeset
135
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
136 // Plan for fft and ifft of complex values
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
137 void *plan[2];
6228
aa5df9ba98d5 [project @ 2007-01-05 22:49:03 by dbateman]
dbateman
parents: 5307
diff changeset
138
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
139 // dist
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
140 octave_idx_type d[2];
6228
aa5df9ba98d5 [project @ 2007-01-05 22:49:03 by dbateman]
dbateman
parents: 5307
diff changeset
141
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
142 // stride
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
143 octave_idx_type s[2];
6228
aa5df9ba98d5 [project @ 2007-01-05 22:49:03 by dbateman]
dbateman
parents: 5307
diff changeset
144
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
145 // rank
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
146 int r[2];
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
147
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
148 // howmany
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
149 octave_idx_type h[2];
6228
aa5df9ba98d5 [project @ 2007-01-05 22:49:03 by dbateman]
dbateman
parents: 5307
diff changeset
150
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
151 // dims
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
152 dim_vector n[2];
6228
aa5df9ba98d5 [project @ 2007-01-05 22:49:03 by dbateman]
dbateman
parents: 5307
diff changeset
153
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
154 bool simd_align[2];
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
155 bool inplace[2];
6228
aa5df9ba98d5 [project @ 2007-01-05 22:49:03 by dbateman]
dbateman
parents: 5307
diff changeset
156
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
157 // Plan for fft of real values
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
158 void *rplan;
15960
bde7731b2b83 added FFTW multithreaded library support
Andreas Weber <andy.weber.aw@gmail.com>
parents: 15818
diff changeset
159
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
160 // dist
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
161 octave_idx_type rd;
6228
aa5df9ba98d5 [project @ 2007-01-05 22:49:03 by dbateman]
dbateman
parents: 5307
diff changeset
162
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
163 // stride
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
164 octave_idx_type rs;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
165
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
166 // rank
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
167 int rr;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
168
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
169 // howmany
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
170 octave_idx_type rh;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
171
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
172 // dims
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
173 dim_vector rn;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
174
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
175 bool rsimd_align;
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
176
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
177 // number of threads. Always 1 unless compiled with multi-threading
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
178 // support.
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
179 int nthreads;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
180 };
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
181
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
182 class
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
183 OCTAVE_API
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
184 float_fftw_planner
9516
fb933db0c517 convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
185 {
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
186 protected:
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
187
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
188 float_fftw_planner (void);
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
189
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
190 public:
9516
fb933db0c517 convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
191
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
192 // No copying!
6228
aa5df9ba98d5 [project @ 2007-01-05 22:49:03 by dbateman]
dbateman
parents: 5307
diff changeset
193
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
194 float_fftw_planner (const float_fftw_planner&) = delete;
9516
fb933db0c517 convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
195
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
196 float_fftw_planner&
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
197 operator = (const float_fftw_planner&) = delete;
15960
bde7731b2b83 added FFTW multithreaded library support
Andreas Weber <andy.weber.aw@gmail.com>
parents: 15818
diff changeset
198
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
199 ~float_fftw_planner (void);
15960
bde7731b2b83 added FFTW multithreaded library support
Andreas Weber <andy.weber.aw@gmail.com>
parents: 15818
diff changeset
200
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
201 enum FftwMethod
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
202 {
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
203 UNKNOWN = -1,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
204 ESTIMATE,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
205 MEASURE,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
206 PATIENT,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
207 EXHAUSTIVE,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
208 HYBRID
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
209 };
9516
fb933db0c517 convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
210
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
211 static bool instance_ok (void);
9516
fb933db0c517 convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
212
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
213 static void *
23440
f15f0d8b78c8 pass dim_vector as const reference, not by value
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
214 create_plan (int dir, const int rank, const dim_vector& dims,
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
215 octave_idx_type howmany, octave_idx_type stride,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
216 octave_idx_type dist, const FloatComplex *in,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
217 FloatComplex *out)
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
218 {
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
219 return instance_ok ()
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
220 ? instance->do_create_plan (dir, rank, dims, howmany, stride,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
221 dist, in, out)
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
222 : 0;
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
223 }
9516
fb933db0c517 convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
224
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
225 static void *
23440
f15f0d8b78c8 pass dim_vector as const reference, not by value
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
226 create_plan (const int rank, const dim_vector& dims,
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
227 octave_idx_type howmany, octave_idx_type stride,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
228 octave_idx_type dist, const float *in, FloatComplex *out)
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
229 {
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
230 return instance_ok ()
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
231 ? instance->do_create_plan (rank, dims, howmany, stride, dist,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
232 in, out)
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
233 : 0;
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
234 }
15960
bde7731b2b83 added FFTW multithreaded library support
Andreas Weber <andy.weber.aw@gmail.com>
parents: 15818
diff changeset
235
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
236 static FftwMethod method (void)
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
237 {
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
238 static FftwMethod dummy;
15960
bde7731b2b83 added FFTW multithreaded library support
Andreas Weber <andy.weber.aw@gmail.com>
parents: 15818
diff changeset
239
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
240 return instance_ok () ? instance->do_method () : dummy;
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
241 }
9516
fb933db0c517 convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
242
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
243 static FftwMethod method (FftwMethod _meth)
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
244 {
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
245 static FftwMethod dummy;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
246
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
247 return instance_ok () ? instance->do_method (_meth) : dummy;
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
248 }
12122
f4689107dd8c Explicitly disallow copying in some classes.
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11586
diff changeset
249
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
250 static void threads (int nt);
12122
f4689107dd8c Explicitly disallow copying in some classes.
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11586
diff changeset
251
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
252 static int threads (void)
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
253 {
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
254 return instance_ok () ? instance->nthreads : 0;
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
255 }
12122
f4689107dd8c Explicitly disallow copying in some classes.
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11586
diff changeset
256
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
257 private:
9516
fb933db0c517 convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
258
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
259 static float_fftw_planner *instance;
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
260
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
261 static void cleanup_instance (void) { delete instance; instance = 0; }
13994
99f039289e95 also clean up float fftw planner
John W. Eaton <jwe@octave.org>
parents: 13983
diff changeset
262
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
263 void *
23440
f15f0d8b78c8 pass dim_vector as const reference, not by value
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
264 do_create_plan (int dir, const int rank, const dim_vector& dims,
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
265 octave_idx_type howmany, octave_idx_type stride,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
266 octave_idx_type dist, const FloatComplex *in,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
267 FloatComplex *out);
9516
fb933db0c517 convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
268
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
269 void *
23440
f15f0d8b78c8 pass dim_vector as const reference, not by value
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
270 do_create_plan (const int rank, const dim_vector& dims,
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
271 octave_idx_type howmany, octave_idx_type stride,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
272 octave_idx_type dist, const float *in, FloatComplex *out);
6228
aa5df9ba98d5 [project @ 2007-01-05 22:49:03 by dbateman]
dbateman
parents: 5307
diff changeset
273
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
274 FftwMethod do_method (void);
9516
fb933db0c517 convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
275
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
276 FftwMethod do_method (FftwMethod _meth);
9516
fb933db0c517 convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
277
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
278 FftwMethod meth;
9516
fb933db0c517 convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
279
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
280 // FIXME: perhaps this should be split into two classes?
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
281
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
282 // Plan for fft and ifft of complex values
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
283 void *plan[2];
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
284
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
285 // dist
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
286 octave_idx_type d[2];
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
287
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
288 // stride
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
289 octave_idx_type s[2];
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
290
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
291 // rank
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
292 int r[2];
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
293
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
294 // howmany
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
295 octave_idx_type h[2];
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
296
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
297 // dims
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
298 dim_vector n[2];
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
299
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
300 bool simd_align[2];
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
301 bool inplace[2];
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
302
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
303 // Plan for fft of real values
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
304 void *rplan;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
305
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
306 // dist
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
307 octave_idx_type rd;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
308
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
309 // stride
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
310 octave_idx_type rs;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
311
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
312 // rank
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
313 int rr;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
314
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
315 // howmany
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
316 octave_idx_type rh;
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
317
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
318 // dims
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
319 dim_vector rn;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
320
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
321 bool rsimd_align;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
322
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
323 // number of threads. Always 1 unless compiled with multi-threading
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
324 // support.
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
325 int nthreads;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
326 };
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
327
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
328 class
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
329 OCTAVE_API
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
330 fftw
9516
fb933db0c517 convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
331 {
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
332 public:
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
333
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
334 fftw (void) = delete;
9516
fb933db0c517 convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
335
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
336 // No copying.
15960
bde7731b2b83 added FFTW multithreaded library support
Andreas Weber <andy.weber.aw@gmail.com>
parents: 15818
diff changeset
337
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
338 fftw (const fftw&) = delete;
9516
fb933db0c517 convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
339
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
340 fftw& operator = (const fftw&) = delete;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
341
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
342 static int fft (const double *in, Complex *out, size_t npts,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
343 size_t nsamples = 1, octave_idx_type stride = 1,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
344 octave_idx_type dist = -1);
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
345 static int fft (const Complex *in, Complex *out, size_t npts,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
346 size_t nsamples = 1, octave_idx_type stride = 1,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
347 octave_idx_type dist = -1);
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
348 static int ifft (const Complex *in, Complex *out, size_t npts,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
349 size_t nsamples = 1, octave_idx_type stride = 1,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
350 octave_idx_type dist = -1);
9523
0ce82753dd72 more configure changes for libraries
John W. Eaton <jwe@octave.org>
parents: 9516
diff changeset
351
23440
f15f0d8b78c8 pass dim_vector as const reference, not by value
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
352 static int fftNd (const double*, Complex*, const int, const dim_vector&);
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
353 static int fftNd (const Complex*, Complex*, const int,
23440
f15f0d8b78c8 pass dim_vector as const reference, not by value
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
354 const dim_vector&);
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
355 static int ifftNd (const Complex*, Complex*, const int,
23440
f15f0d8b78c8 pass dim_vector as const reference, not by value
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
356 const dim_vector&);
3828
adc217ebe692 [project @ 2001-05-02 14:50:46 by jwe]
jwe
parents:
diff changeset
357
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
358 static int fft (const float *in, FloatComplex *out, size_t npts,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
359 size_t nsamples = 1, octave_idx_type stride = 1,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
360 octave_idx_type dist = -1);
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
361 static int fft (const FloatComplex *in, FloatComplex *out, size_t npts,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
362 size_t nsamples = 1, octave_idx_type stride = 1,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
363 octave_idx_type dist = -1);
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
364 static int ifft (const FloatComplex *in, FloatComplex *out, size_t npts,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
365 size_t nsamples = 1, octave_idx_type stride = 1,
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
366 octave_idx_type dist = -1);
3828
adc217ebe692 [project @ 2001-05-02 14:50:46 by jwe]
jwe
parents:
diff changeset
367
23440
f15f0d8b78c8 pass dim_vector as const reference, not by value
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
368 static int fftNd (const float*, FloatComplex*, const int, const dim_vector&);
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
369 static int fftNd (const FloatComplex*, FloatComplex*, const int,
23440
f15f0d8b78c8 pass dim_vector as const reference, not by value
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
370 const dim_vector&);
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
371 static int ifftNd (const FloatComplex*, FloatComplex*, const int,
23440
f15f0d8b78c8 pass dim_vector as const reference, not by value
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
372 const dim_vector&);
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
373 };
15960
bde7731b2b83 added FFTW multithreaded library support
Andreas Weber <andy.weber.aw@gmail.com>
parents: 15818
diff changeset
374
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
375 extern OCTAVE_API std::string fftw_version (void);
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
376 extern OCTAVE_API std::string fftwf_version (void);
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
377 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
378
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
379 #if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
380
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
381 OCTAVE_DEPRECATED (4.4, "use 'octave::fftw_version' instead")
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
382 static inline std::string
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
383 octave_fftw_version (void)
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
384 {
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
385 return octave::fftw_version ();
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
386 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
387
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
388 OCTAVE_DEPRECATED (4.4, "use 'octave::fftwf_version' instead")
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
389 static inline std::string
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
390 octave_fftwf_version (void)
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
391 {
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
392 return octave::fftwf_version ();
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
393 }
3828
adc217ebe692 [project @ 2001-05-02 14:50:46 by jwe]
jwe
parents:
diff changeset
394
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
395 OCTAVE_DEPRECATED (4.4, "use 'octave::fftw_planner' instead")
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
396 typedef octave::fftw_planner octave_fftw_planner;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
397
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
398 OCTAVE_DEPRECATED (4.4, "use 'octave::float_fftw_planner' instead")
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
399 typedef octave::float_fftw_planner octave_float_fftw_planner;
3828
adc217ebe692 [project @ 2001-05-02 14:50:46 by jwe]
jwe
parents:
diff changeset
400
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
401 OCTAVE_DEPRECATED (4.4, "use 'octave::fftw' instead")
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
402 typedef octave::fftw octave_fftw;
21600
184b85b31e03 more updates for version function
mmuetzel <markus.muetzel@gmx.de>
parents: 21451
diff changeset
403
3828
adc217ebe692 [project @ 2001-05-02 14:50:46 by jwe]
jwe
parents:
diff changeset
404 #endif
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22323
diff changeset
405
23058
5839d16828cb move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
406 #endif