Mercurial > octave
annotate liboctave/numeric/oct-fftw.cc @ 30102:eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
* oct-fftw.cc, oct-fftw.h: use "m_" prefix for member variables in class
fftw_planner.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 01 Sep 2021 13:32:43 -0700 |
parents | aef11bb4e6d1 |
children | 796f54d4ddbf |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
29358
0a5b15007766
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27933
diff
changeset
|
3 // Copyright (C) 2001-2021 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
3828 | 25 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21688
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21202
diff
changeset
|
27 # include "config.h" |
3828 | 28 #endif |
29 | |
21451
763e30285935
eliminate configuration macros from oct-fftw.h (bug #41027)
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
30 #if defined (HAVE_FFTW3_H) |
763e30285935
eliminate configuration macros from oct-fftw.h (bug #41027)
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
31 # include <fftw3.h> |
763e30285935
eliminate configuration macros from oct-fftw.h (bug #41027)
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
32 #endif |
763e30285935
eliminate configuration macros from oct-fftw.h (bug #41027)
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
33 |
4786 | 34 #include "lo-error.h" |
3828 | 35 #include "oct-fftw.h" |
23475
d691ed308237
maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents:
23457
diff
changeset
|
36 #include "oct-locbuf.h" |
4786 | 37 #include "quit.h" |
13983
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
38 #include "singleton-cleanup.h" |
3828 | 39 |
21520
e1c921322ba2
Fix configuration conditions in oct-fftw.cc
Mike Miller <mtmiller@octave.org>
parents:
21451
diff
changeset
|
40 #if defined (HAVE_FFTW3_THREADS) || defined (HAVE_FFTW3F_THREADS) |
21893
0a6f387d18d3
* nproc.cc, oct-fftw.cc: Use octave_num_processors_wrapper.
John W. Eaton <jwe@octave.org>
parents:
21751
diff
changeset
|
41 # include "nproc-wrapper.h" |
15960
bde7731b2b83
added FFTW multithreaded library support
Andreas Weber <andy.weber.aw@gmail.com>
parents:
15271
diff
changeset
|
42 #endif |
bde7731b2b83
added FFTW multithreaded library support
Andreas Weber <andy.weber.aw@gmail.com>
parents:
15271
diff
changeset
|
43 |
23062
9ca0829b160e
fix editing error in previous change to oct-fftw.cc (bug #50070)
John W. Eaton <jwe@octave.org>
parents:
23058
diff
changeset
|
44 namespace octave |
9ca0829b160e
fix editing error in previous change to oct-fftw.cc (bug #50070)
John W. Eaton <jwe@octave.org>
parents:
23058
diff
changeset
|
45 { |
21688
68ab693d16e4
* oct-fftw.cc: Allow compilation without FFTW.
John W. Eaton <jwe@octave.org>
parents:
21660
diff
changeset
|
46 #if defined (HAVE_FFTW) |
68ab693d16e4
* oct-fftw.cc: Allow compilation without FFTW.
John W. Eaton <jwe@octave.org>
parents:
21660
diff
changeset
|
47 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
48 fftw_planner *fftw_planner::s_instance = nullptr; |
9516
fb933db0c517
convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
49 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
50 // Helper class to create and cache FFTW plans for both 1D and |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
51 // 2D. This implementation defaults to using FFTW_ESTIMATE to create |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
52 // the plans, which in theory is suboptimal, but provides quite |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
53 // reasonable performance in practice. |
4773 | 54 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
55 // Also note that if FFTW_ESTIMATE is not used then the planner in FFTW3 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
56 // will destroy the input and output arrays. We must, therefore, create a |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
57 // temporary input array with the same size and 16-byte alignment as |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
58 // the original array when using a different planner strategy. |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
59 // Note that we also use any wisdom that is available, either in a |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
60 // FFTW3 system wide file or as supplied by the user. |
4773 | 61 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
62 // FIXME: if we can ensure 16 byte alignment in Array<T> |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
63 // (<T> *data) the FFTW3 can use SIMD instructions for further |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
64 // acceleration. |
4773 | 65 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
66 // Note that it is profitable to store the FFTW3 plans, for small FFTs. |
3828 | 67 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
68 fftw_planner::fftw_planner (void) |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
69 : m_meth (ESTIMATE), m_rplan (nullptr), m_rd (0), m_rs (0), m_rr (0), |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
70 m_rh (0), m_rn (), m_rsimd_align (false), m_nthreads (1) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
71 { |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
72 m_plan[0] = m_plan[1] = nullptr; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
73 m_d[0] = m_d[1] = m_s[0] = m_s[1] = m_r[0] = m_r[1] = m_h[0] = m_h[1] = 0; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
74 m_simd_align[0] = m_simd_align[1] = false; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
75 m_inplace[0] = m_inplace[1] = false; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
76 m_n[0] = m_n[1] = dim_vector (); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
77 |
15960
bde7731b2b83
added FFTW multithreaded library support
Andreas Weber <andy.weber.aw@gmail.com>
parents:
15271
diff
changeset
|
78 #if defined (HAVE_FFTW3_THREADS) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
79 int init_ret = fftw_init_threads (); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
80 if (! init_ret) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
81 (*current_liboctave_error_handler) ("Error initializing FFTW threads"); |
21136
7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
82 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
83 // Use number of processors available to the current process |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
84 // This can be later changed with fftw ("threads", nthreads). |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
85 m_nthreads = |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
86 octave_num_processors_wrapper (OCTAVE_NPROC_CURRENT_OVERRIDABLE); |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
87 |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
88 fftw_plan_with_nthreads (m_nthreads); |
15960
bde7731b2b83
added FFTW multithreaded library support
Andreas Weber <andy.weber.aw@gmail.com>
parents:
15271
diff
changeset
|
89 #endif |
bde7731b2b83
added FFTW multithreaded library support
Andreas Weber <andy.weber.aw@gmail.com>
parents:
15271
diff
changeset
|
90 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
91 // If we have a system wide wisdom file, import it. |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
92 fftw_import_system_wisdom (); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
93 } |
3828 | 94 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
95 fftw_planner::~fftw_planner (void) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
96 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
97 fftw_plan *plan_p; |
14078
941d19370065
Cleanup FFTW wisdom plans in class destructor and prevent a memory leak.
Rik <octave@nomad.inbox5.com>
parents:
13994
diff
changeset
|
98 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
99 plan_p = reinterpret_cast<fftw_plan *> (&m_rplan); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
100 if (*plan_p) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
101 fftw_destroy_plan (*plan_p); |
14078
941d19370065
Cleanup FFTW wisdom plans in class destructor and prevent a memory leak.
Rik <octave@nomad.inbox5.com>
parents:
13994
diff
changeset
|
102 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
103 plan_p = reinterpret_cast<fftw_plan *> (&m_plan[0]); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
104 if (*plan_p) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
105 fftw_destroy_plan (*plan_p); |
14078
941d19370065
Cleanup FFTW wisdom plans in class destructor and prevent a memory leak.
Rik <octave@nomad.inbox5.com>
parents:
13994
diff
changeset
|
106 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
107 plan_p = reinterpret_cast<fftw_plan *> (&m_plan[1]); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
108 if (*plan_p) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
109 fftw_destroy_plan (*plan_p); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
110 } |
14078
941d19370065
Cleanup FFTW wisdom plans in class destructor and prevent a memory leak.
Rik <octave@nomad.inbox5.com>
parents:
13994
diff
changeset
|
111 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
112 bool |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
113 fftw_planner::instance_ok (void) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
114 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
115 bool retval = true; |
6228 | 116 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
117 if (! s_instance) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
118 { |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
119 s_instance = new fftw_planner (); |
26369
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26148
diff
changeset
|
120 singleton_cleanup_list::add (cleanup_instance); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
121 } |
9516
fb933db0c517
convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
122 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
123 return retval; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
124 } |
6228 | 125 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
126 void |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
127 fftw_planner::threads (int nt) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
128 { |
21520
e1c921322ba2
Fix configuration conditions in oct-fftw.cc
Mike Miller <mtmiller@octave.org>
parents:
21451
diff
changeset
|
129 #if defined (HAVE_FFTW3_THREADS) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
130 if (instance_ok () && nt != threads ()) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
131 { |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
132 s_instance->m_nthreads = nt; |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
133 fftw_plan_with_nthreads (nt); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
134 // Clear the current plans. |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
135 s_instance->m_rplan = nullptr; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
136 s_instance->m_plan[0] = s_instance->m_plan[1] = nullptr; |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
137 } |
21451
763e30285935
eliminate configuration macros from oct-fftw.h (bug #41027)
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
138 #else |
26148
8c72f0345ee8
maint: Silence compiler warnings about unused or too many parameters.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
25688
diff
changeset
|
139 octave_unused_parameter (nt); |
8c72f0345ee8
maint: Silence compiler warnings about unused or too many parameters.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
25688
diff
changeset
|
140 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
141 (*current_liboctave_warning_handler) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
142 ("unable to change number of threads without FFTW thread support"); |
21451
763e30285935
eliminate configuration macros from oct-fftw.h (bug #41027)
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
143 #endif |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
144 } |
21451
763e30285935
eliminate configuration macros from oct-fftw.h (bug #41027)
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
145 |
763e30285935
eliminate configuration macros from oct-fftw.h (bug #41027)
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
146 #define CHECK_SIMD_ALIGNMENT(x) \ |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
147 (((reinterpret_cast<std::ptrdiff_t> (x)) & 0xF) == 0) |
4808 | 148 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
149 void * |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
150 fftw_planner::do_create_plan (int dir, const int rank, |
23440
f15f0d8b78c8
pass dim_vector as const reference, not by value
John W. Eaton <jwe@octave.org>
parents:
23433
diff
changeset
|
151 const dim_vector& dims, |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
152 octave_idx_type howmany, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
153 octave_idx_type stride, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
154 octave_idx_type dist, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
155 const Complex *in, Complex *out) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
156 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
157 int which = (dir == FFTW_FORWARD) ? 0 : 1; |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
158 fftw_plan *cur_plan_p = reinterpret_cast<fftw_plan *> (&m_plan[which]); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
159 bool create_new_plan = false; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
160 bool ioalign = CHECK_SIMD_ALIGNMENT (in) && CHECK_SIMD_ALIGNMENT (out); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
161 bool ioinplace = (in == out); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
162 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
163 // Don't create a new plan if we have a non SIMD plan already but |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
164 // can do SIMD. This prevents endlessly recreating plans if we |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
165 // change the alignment. |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
166 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
167 if (m_plan[which] == nullptr || m_d[which] != dist || m_s[which] != stride |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
168 || m_r[which] != rank || m_h[which] != howmany |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
169 || ioinplace != m_inplace[which] |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
170 || ((ioalign != m_simd_align[which]) ? ! ioalign : false)) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
171 create_new_plan = true; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
172 else |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
173 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
174 // We still might not have the same shape of array. |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
175 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
176 for (int i = 0; i < rank; i++) |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
177 if (dims(i) != m_n[which](i)) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
178 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
179 create_new_plan = true; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
180 break; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
181 } |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
182 } |
3828 | 183 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
184 if (create_new_plan) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
185 { |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
186 m_d[which] = dist; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
187 m_s[which] = stride; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
188 m_r[which] = rank; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
189 m_h[which] = howmany; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
190 m_simd_align[which] = ioalign; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
191 m_inplace[which] = ioinplace; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
192 m_n[which] = dims; |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
193 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
194 // Note reversal of dimensions for column major storage in FFTW. |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
195 octave_idx_type nn = 1; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
196 OCTAVE_LOCAL_BUFFER (int, tmp, rank); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
197 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
198 for (int i = 0, j = rank-1; i < rank; i++, j--) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
199 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
200 tmp[i] = dims(j); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
201 nn *= dims(j); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
202 } |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
203 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
204 int plan_flags = 0; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
205 bool plan_destroys_in = true; |
4809 | 206 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
207 switch (m_meth) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
208 { |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
209 case UNKNOWN: |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
210 case ESTIMATE: |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
211 plan_flags |= FFTW_ESTIMATE; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
212 plan_destroys_in = false; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
213 break; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
214 case MEASURE: |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
215 plan_flags |= FFTW_MEASURE; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
216 break; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
217 case PATIENT: |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
218 plan_flags |= FFTW_PATIENT; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
219 break; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
220 case EXHAUSTIVE: |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
221 plan_flags |= FFTW_EXHAUSTIVE; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
222 break; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
223 case HYBRID: |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
224 if (nn < 8193) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
225 plan_flags |= FFTW_MEASURE; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
226 else |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
227 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
228 plan_flags |= FFTW_ESTIMATE; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
229 plan_destroys_in = false; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
230 } |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
231 break; |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
232 } |
3828 | 233 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
234 if (ioalign) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
235 plan_flags &= ~FFTW_UNALIGNED; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
236 else |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
237 plan_flags |= FFTW_UNALIGNED; |
4773 | 238 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
239 if (*cur_plan_p) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
240 fftw_destroy_plan (*cur_plan_p); |
6228 | 241 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
242 if (plan_destroys_in) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
243 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
244 // Create matrix with the same size and 16-byte alignment as input |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
245 OCTAVE_LOCAL_BUFFER (Complex, itmp, nn * howmany + 32); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
246 itmp = reinterpret_cast<Complex *> |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
247 (((reinterpret_cast<std::ptrdiff_t> (itmp) + 15) & ~ 0xF) + |
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
248 ((reinterpret_cast<std::ptrdiff_t> (in)) & 0xF)); |
6228 | 249 |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
250 *cur_plan_p |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
251 = fftw_plan_many_dft (rank, tmp, howmany, |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
252 reinterpret_cast<fftw_complex *> (itmp), |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
253 nullptr, stride, dist, |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
254 reinterpret_cast<fftw_complex *> (out), |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
255 nullptr, stride, dist, dir, plan_flags); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
256 } |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
257 else |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
258 { |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
259 *cur_plan_p |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
260 = fftw_plan_many_dft (rank, tmp, howmany, |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
261 reinterpret_cast<fftw_complex *> (const_cast<Complex *> (in)), |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
262 nullptr, stride, dist, |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
263 reinterpret_cast<fftw_complex *> (out), |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
264 nullptr, stride, dist, dir, plan_flags); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
265 } |
6228 | 266 |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23475
diff
changeset
|
267 if (*cur_plan_p == nullptr) |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
268 (*current_liboctave_error_handler) ("Error creating FFTW plan"); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
269 } |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
270 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
271 return *cur_plan_p; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
272 } |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
273 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
274 void * |
23440
f15f0d8b78c8
pass dim_vector as const reference, not by value
John W. Eaton <jwe@octave.org>
parents:
23433
diff
changeset
|
275 fftw_planner::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:
22755
diff
changeset
|
276 octave_idx_type howmany, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
277 octave_idx_type stride, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
278 octave_idx_type dist, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
279 const double *in, Complex *out) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
280 { |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
281 fftw_plan *cur_plan_p = reinterpret_cast<fftw_plan *> (&m_rplan); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
282 bool create_new_plan = false; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
283 bool ioalign = CHECK_SIMD_ALIGNMENT (in) && CHECK_SIMD_ALIGNMENT (out); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
284 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
285 // Don't create a new plan if we have a non SIMD plan already but |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
286 // can do SIMD. This prevents endlessly recreating plans if we |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
287 // change the alignment. |
4808 | 288 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
289 if (m_rplan == nullptr || m_rd != dist || m_rs != stride || m_rr != rank |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
290 || m_rh != howmany || ((ioalign != m_rsimd_align) ? ! ioalign : false)) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
291 create_new_plan = true; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
292 else |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
293 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
294 // We still might not have the same shape of array. |
4809 | 295 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
296 for (int i = 0; i < rank; i++) |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
297 if (dims(i) != m_rn(i)) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
298 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
299 create_new_plan = true; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
300 break; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
301 } |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
302 } |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
303 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
304 if (create_new_plan) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
305 { |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
306 m_rd = dist; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
307 m_rs = stride; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
308 m_rr = rank; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
309 m_rh = howmany; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
310 m_rsimd_align = ioalign; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
311 m_rn = dims; |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
312 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
313 // Note reversal of dimensions for column major storage in FFTW. |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
314 octave_idx_type nn = 1; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
315 OCTAVE_LOCAL_BUFFER (int, tmp, rank); |
3828 | 316 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
317 for (int i = 0, j = rank-1; i < rank; i++, j--) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
318 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
319 tmp[i] = dims(j); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
320 nn *= dims(j); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
321 } |
3828 | 322 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
323 int plan_flags = 0; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
324 bool plan_destroys_in = true; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
325 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
326 switch (m_meth) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
327 { |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
328 case UNKNOWN: |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
329 case ESTIMATE: |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
330 plan_flags |= FFTW_ESTIMATE; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
331 plan_destroys_in = false; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
332 break; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
333 case MEASURE: |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
334 plan_flags |= FFTW_MEASURE; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
335 break; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
336 case PATIENT: |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
337 plan_flags |= FFTW_PATIENT; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
338 break; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
339 case EXHAUSTIVE: |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
340 plan_flags |= FFTW_EXHAUSTIVE; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
341 break; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
342 case HYBRID: |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
343 if (nn < 8193) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
344 plan_flags |= FFTW_MEASURE; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
345 else |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
346 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
347 plan_flags |= FFTW_ESTIMATE; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
348 plan_destroys_in = false; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
349 } |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
350 break; |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
351 } |
3828 | 352 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
353 if (ioalign) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
354 plan_flags &= ~FFTW_UNALIGNED; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
355 else |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
356 plan_flags |= FFTW_UNALIGNED; |
4773 | 357 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
358 if (*cur_plan_p) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
359 fftw_destroy_plan (*cur_plan_p); |
6228 | 360 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
361 if (plan_destroys_in) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
362 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
363 // Create matrix with the same size and 16-byte alignment as input |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
364 OCTAVE_LOCAL_BUFFER (double, itmp, nn + 32); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
365 itmp = reinterpret_cast<double *> |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
366 (((reinterpret_cast<std::ptrdiff_t> (itmp) + 15) & ~ 0xF) + |
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
367 ((reinterpret_cast<std::ptrdiff_t> (in)) & 0xF)); |
6228 | 368 |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
369 *cur_plan_p |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
370 = fftw_plan_many_dft_r2c (rank, tmp, howmany, itmp, |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
371 nullptr, stride, dist, |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
372 reinterpret_cast<fftw_complex *> (out), |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
373 nullptr, stride, dist, plan_flags); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
374 } |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
375 else |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
376 { |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
377 *cur_plan_p |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
378 = fftw_plan_many_dft_r2c (rank, tmp, howmany, |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
379 (const_cast<double *> (in)), |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
380 nullptr, stride, dist, |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
381 reinterpret_cast<fftw_complex *> (out), |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
382 nullptr, stride, dist, plan_flags); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
383 } |
6228 | 384 |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23475
diff
changeset
|
385 if (*cur_plan_p == nullptr) |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
386 (*current_liboctave_error_handler) ("Error creating FFTW plan"); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
387 } |
4808 | 388 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
389 return *cur_plan_p; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
390 } |
3828 | 391 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
392 fftw_planner::FftwMethod |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
393 fftw_planner::do_method (void) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
394 { |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
395 return m_meth; |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
396 } |
9516
fb933db0c517
convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
397 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
398 fftw_planner::FftwMethod |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
399 fftw_planner::do_method (FftwMethod _meth) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
400 { |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
401 FftwMethod ret = m_meth; |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
402 if (_meth == ESTIMATE || _meth == MEASURE |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
403 || _meth == PATIENT || _meth == EXHAUSTIVE |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
404 || _meth == HYBRID) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
405 { |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
406 if (m_meth != _meth) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
407 { |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
408 m_meth = _meth; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
409 if (m_rplan) |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
410 fftw_destroy_plan (reinterpret_cast<fftw_plan> (m_rplan)); |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
411 if (m_plan[0]) |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
412 fftw_destroy_plan (reinterpret_cast<fftw_plan> (m_plan[0])); |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
413 if (m_plan[1]) |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
414 fftw_destroy_plan (reinterpret_cast<fftw_plan> (m_plan[1])); |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
415 m_rplan = m_plan[0] = m_plan[1] = nullptr; |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
416 } |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
417 } |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
418 else |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
419 ret = UNKNOWN; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
420 return ret; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
421 } |
9516
fb933db0c517
convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
422 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
423 float_fftw_planner *float_fftw_planner::s_instance = nullptr; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
424 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
425 float_fftw_planner::float_fftw_planner (void) |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
426 : m_meth (ESTIMATE), m_rplan (nullptr), m_rd (0), m_rs (0), m_rr (0), |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
427 m_rh (0), m_rn (), m_rsimd_align (false), m_nthreads (1) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
428 { |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
429 m_plan[0] = m_plan[1] = nullptr; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
430 m_d[0] = m_d[1] = m_s[0] = m_s[1] = m_r[0] = m_r[1] = m_h[0] = m_h[1] = 0; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
431 m_simd_align[0] = m_simd_align[1] = false; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
432 m_inplace[0] = m_inplace[1] = false; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
433 m_n[0] = m_n[1] = dim_vector (); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
434 |
15960
bde7731b2b83
added FFTW multithreaded library support
Andreas Weber <andy.weber.aw@gmail.com>
parents:
15271
diff
changeset
|
435 #if defined (HAVE_FFTW3F_THREADS) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
436 int init_ret = fftwf_init_threads (); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
437 if (! init_ret) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
438 (*current_liboctave_error_handler) ("Error initializing FFTW3F threads"); |
21136
7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
439 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
440 // Use number of processors available to the current process |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
441 // This can be later changed with fftw ("threads", nthreads). |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
442 m_nthreads = |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
443 octave_num_processors_wrapper (OCTAVE_NPROC_CURRENT_OVERRIDABLE); |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
444 |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
445 fftwf_plan_with_nthreads (m_nthreads); |
15960
bde7731b2b83
added FFTW multithreaded library support
Andreas Weber <andy.weber.aw@gmail.com>
parents:
15271
diff
changeset
|
446 #endif |
bde7731b2b83
added FFTW multithreaded library support
Andreas Weber <andy.weber.aw@gmail.com>
parents:
15271
diff
changeset
|
447 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
448 // If we have a system wide wisdom file, import it. |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
449 fftwf_import_system_wisdom (); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
450 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
451 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
452 float_fftw_planner::~float_fftw_planner (void) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
453 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
454 fftwf_plan *plan_p; |
14078
941d19370065
Cleanup FFTW wisdom plans in class destructor and prevent a memory leak.
Rik <octave@nomad.inbox5.com>
parents:
13994
diff
changeset
|
455 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
456 plan_p = reinterpret_cast<fftwf_plan *> (&m_rplan); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
457 if (*plan_p) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
458 fftwf_destroy_plan (*plan_p); |
14078
941d19370065
Cleanup FFTW wisdom plans in class destructor and prevent a memory leak.
Rik <octave@nomad.inbox5.com>
parents:
13994
diff
changeset
|
459 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
460 plan_p = reinterpret_cast<fftwf_plan *> (&m_plan[0]); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
461 if (*plan_p) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
462 fftwf_destroy_plan (*plan_p); |
14078
941d19370065
Cleanup FFTW wisdom plans in class destructor and prevent a memory leak.
Rik <octave@nomad.inbox5.com>
parents:
13994
diff
changeset
|
463 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
464 plan_p = reinterpret_cast<fftwf_plan *> (&m_plan[1]); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
465 if (*plan_p) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
466 fftwf_destroy_plan (*plan_p); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
467 } |
14078
941d19370065
Cleanup FFTW wisdom plans in class destructor and prevent a memory leak.
Rik <octave@nomad.inbox5.com>
parents:
13994
diff
changeset
|
468 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
469 bool |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
470 float_fftw_planner::instance_ok (void) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
471 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
472 bool retval = true; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
473 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
474 if (! s_instance) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
475 { |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
476 s_instance = new float_fftw_planner (); |
26369
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26148
diff
changeset
|
477 singleton_cleanup_list::add (cleanup_instance); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
478 } |
9516
fb933db0c517
convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
479 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
480 return retval; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
481 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
482 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
483 void |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
484 float_fftw_planner::threads (int nt) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
485 { |
21451
763e30285935
eliminate configuration macros from oct-fftw.h (bug #41027)
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
486 #if defined (HAVE_FFTW3F_THREADS) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
487 if (instance_ok () && nt != threads ()) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
488 { |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
489 s_instance->m_nthreads = nt; |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
490 fftwf_plan_with_nthreads (nt); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
491 // Clear the current plans. |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
492 s_instance->m_rplan = nullptr; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
493 s_instance->m_plan[0] = s_instance->m_plan[1] = nullptr; |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
494 } |
21451
763e30285935
eliminate configuration macros from oct-fftw.h (bug #41027)
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
495 #else |
26148
8c72f0345ee8
maint: Silence compiler warnings about unused or too many parameters.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
25688
diff
changeset
|
496 octave_unused_parameter (nt); |
8c72f0345ee8
maint: Silence compiler warnings about unused or too many parameters.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
25688
diff
changeset
|
497 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
498 (*current_liboctave_warning_handler) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
499 ("unable to change number of threads without FFTW thread support"); |
21451
763e30285935
eliminate configuration macros from oct-fftw.h (bug #41027)
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
500 #endif |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
501 } |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
502 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
503 void * |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
504 float_fftw_planner::do_create_plan (int dir, const int rank, |
23440
f15f0d8b78c8
pass dim_vector as const reference, not by value
John W. Eaton <jwe@octave.org>
parents:
23433
diff
changeset
|
505 const dim_vector& dims, |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
506 octave_idx_type howmany, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
507 octave_idx_type stride, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
508 octave_idx_type dist, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
509 const FloatComplex *in, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
510 FloatComplex *out) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
511 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
512 int which = (dir == FFTW_FORWARD) ? 0 : 1; |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
513 fftwf_plan *cur_plan_p = reinterpret_cast<fftwf_plan *> (&m_plan[which]); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
514 bool create_new_plan = false; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
515 bool ioalign = CHECK_SIMD_ALIGNMENT (in) && CHECK_SIMD_ALIGNMENT (out); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
516 bool ioinplace = (in == out); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
517 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
518 // Don't create a new plan if we have a non SIMD plan already but |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
519 // can do SIMD. This prevents endlessly recreating plans if we |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
520 // change the alignment. |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
521 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
522 if (m_plan[which] == nullptr || m_d[which] != dist || m_s[which] != stride |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
523 || m_r[which] != rank || m_h[which] != howmany |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
524 || ioinplace != m_inplace[which] |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
525 || ((ioalign != m_simd_align[which]) ? ! ioalign : false)) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
526 create_new_plan = true; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
527 else |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
528 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
529 // We still might not have the same shape of array. |
21451
763e30285935
eliminate configuration macros from oct-fftw.h (bug #41027)
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
530 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
531 for (int i = 0; i < rank; i++) |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
532 if (dims(i) != m_n[which](i)) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
533 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
534 create_new_plan = true; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
535 break; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
536 } |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
537 } |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
538 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
539 if (create_new_plan) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
540 { |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
541 m_d[which] = dist; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
542 m_s[which] = stride; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
543 m_r[which] = rank; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
544 m_h[which] = howmany; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
545 m_simd_align[which] = ioalign; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
546 m_inplace[which] = ioinplace; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
547 m_n[which] = dims; |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
548 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
549 // Note reversal of dimensions for column major storage in FFTW. |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
550 octave_idx_type nn = 1; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
551 OCTAVE_LOCAL_BUFFER (int, tmp, rank); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
552 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
553 for (int i = 0, j = rank-1; i < rank; i++, j--) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
554 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
555 tmp[i] = dims(j); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
556 nn *= dims(j); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
557 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
558 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
559 int plan_flags = 0; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
560 bool plan_destroys_in = true; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
561 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
562 switch (m_meth) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
563 { |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
564 case UNKNOWN: |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
565 case ESTIMATE: |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
566 plan_flags |= FFTW_ESTIMATE; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
567 plan_destroys_in = false; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
568 break; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
569 case MEASURE: |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
570 plan_flags |= FFTW_MEASURE; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
571 break; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
572 case PATIENT: |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
573 plan_flags |= FFTW_PATIENT; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
574 break; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
575 case EXHAUSTIVE: |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
576 plan_flags |= FFTW_EXHAUSTIVE; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
577 break; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
578 case HYBRID: |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
579 if (nn < 8193) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
580 plan_flags |= FFTW_MEASURE; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
581 else |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
582 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
583 plan_flags |= FFTW_ESTIMATE; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
584 plan_destroys_in = false; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
585 } |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
586 break; |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
587 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
588 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
589 if (ioalign) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
590 plan_flags &= ~FFTW_UNALIGNED; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
591 else |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
592 plan_flags |= FFTW_UNALIGNED; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
593 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
594 if (*cur_plan_p) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
595 fftwf_destroy_plan (*cur_plan_p); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
596 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
597 if (plan_destroys_in) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
598 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
599 // Create matrix with the same size and 16-byte alignment as input |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
600 OCTAVE_LOCAL_BUFFER (FloatComplex, itmp, nn * howmany + 32); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
601 itmp = reinterpret_cast<FloatComplex *> |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
602 (((reinterpret_cast<std::ptrdiff_t> (itmp) + 15) & ~ 0xF) + |
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
603 ((reinterpret_cast<std::ptrdiff_t> (in)) & 0xF)); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
604 |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
605 *cur_plan_p |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
606 = fftwf_plan_many_dft (rank, tmp, howmany, |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
607 reinterpret_cast<fftwf_complex *> (itmp), |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
608 nullptr, stride, dist, |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
609 reinterpret_cast<fftwf_complex *> (out), |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
610 nullptr, stride, dist, dir, plan_flags); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
611 } |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
612 else |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
613 { |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
614 *cur_plan_p |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
615 = fftwf_plan_many_dft (rank, tmp, howmany, |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
616 reinterpret_cast<fftwf_complex *> (const_cast<FloatComplex *> (in)), |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
617 nullptr, stride, dist, |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
618 reinterpret_cast<fftwf_complex *> (out), |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
619 nullptr, stride, dist, dir, plan_flags); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
620 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
621 |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23475
diff
changeset
|
622 if (*cur_plan_p == nullptr) |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
623 (*current_liboctave_error_handler) ("Error creating FFTW plan"); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
624 } |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
625 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
626 return *cur_plan_p; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
627 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
628 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
629 void * |
23440
f15f0d8b78c8
pass dim_vector as const reference, not by value
John W. Eaton <jwe@octave.org>
parents:
23433
diff
changeset
|
630 float_fftw_planner::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:
22755
diff
changeset
|
631 octave_idx_type howmany, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
632 octave_idx_type stride, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
633 octave_idx_type dist, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
634 const float *in, FloatComplex *out) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
635 { |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
636 fftwf_plan *cur_plan_p = reinterpret_cast<fftwf_plan *> (&m_rplan); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
637 bool create_new_plan = false; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
638 bool ioalign = CHECK_SIMD_ALIGNMENT (in) && CHECK_SIMD_ALIGNMENT (out); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
639 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
640 // Don't create a new plan if we have a non SIMD plan already but |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
641 // can do SIMD. This prevents endlessly recreating plans if we |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
642 // change the alignment. |
3828 | 643 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
644 if (m_rplan == nullptr || m_rd != dist || m_rs != stride || m_rr != rank |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
645 || m_rh != howmany || ((ioalign != m_rsimd_align) ? ! ioalign : false)) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
646 create_new_plan = true; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
647 else |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
648 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
649 // We still might not have the same shape of array. |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
650 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
651 for (int i = 0; i < rank; i++) |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
652 if (dims(i) != m_rn(i)) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
653 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
654 create_new_plan = true; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
655 break; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
656 } |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
657 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
658 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
659 if (create_new_plan) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
660 { |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
661 m_rd = dist; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
662 m_rs = stride; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
663 m_rr = rank; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
664 m_rh = howmany; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
665 m_rsimd_align = ioalign; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
666 m_rn = dims; |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
667 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
668 // Note reversal of dimensions for column major storage in FFTW. |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
669 octave_idx_type nn = 1; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
670 OCTAVE_LOCAL_BUFFER (int, tmp, rank); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
671 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
672 for (int i = 0, j = rank-1; i < rank; i++, j--) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
673 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
674 tmp[i] = dims(j); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
675 nn *= dims(j); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
676 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
677 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
678 int plan_flags = 0; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
679 bool plan_destroys_in = true; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
680 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
681 switch (m_meth) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
682 { |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
683 case UNKNOWN: |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
684 case ESTIMATE: |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
685 plan_flags |= FFTW_ESTIMATE; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
686 plan_destroys_in = false; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
687 break; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
688 case MEASURE: |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
689 plan_flags |= FFTW_MEASURE; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
690 break; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
691 case PATIENT: |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
692 plan_flags |= FFTW_PATIENT; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
693 break; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
694 case EXHAUSTIVE: |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
695 plan_flags |= FFTW_EXHAUSTIVE; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
696 break; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
697 case HYBRID: |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
698 if (nn < 8193) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
699 plan_flags |= FFTW_MEASURE; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
700 else |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
701 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
702 plan_flags |= FFTW_ESTIMATE; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
703 plan_destroys_in = false; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
704 } |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
705 break; |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
706 } |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
707 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
708 if (ioalign) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
709 plan_flags &= ~FFTW_UNALIGNED; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
710 else |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
711 plan_flags |= FFTW_UNALIGNED; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
712 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
713 if (*cur_plan_p) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
714 fftwf_destroy_plan (*cur_plan_p); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
715 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
716 if (plan_destroys_in) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
717 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
718 // Create matrix with the same size and 16-byte alignment as input |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
719 OCTAVE_LOCAL_BUFFER (float, itmp, nn + 32); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
720 itmp = reinterpret_cast<float *> |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
721 (((reinterpret_cast<std::ptrdiff_t> (itmp) + 15) & ~ 0xF) + |
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
722 ((reinterpret_cast<std::ptrdiff_t> (in)) & 0xF)); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
723 |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
724 *cur_plan_p |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
725 = fftwf_plan_many_dft_r2c (rank, tmp, howmany, itmp, |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
726 nullptr, stride, dist, |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
727 reinterpret_cast<fftwf_complex *> (out), |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
728 nullptr, stride, dist, plan_flags); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
729 } |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
730 else |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
731 { |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
732 *cur_plan_p |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
733 = fftwf_plan_many_dft_r2c (rank, tmp, howmany, |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
734 (const_cast<float *> (in)), |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
735 nullptr, stride, dist, |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
736 reinterpret_cast<fftwf_complex *> (out), |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27032
diff
changeset
|
737 nullptr, stride, dist, plan_flags); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
738 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
739 |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23475
diff
changeset
|
740 if (*cur_plan_p == nullptr) |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
741 (*current_liboctave_error_handler) ("Error creating FFTW plan"); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
742 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
743 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
744 return *cur_plan_p; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
745 } |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
746 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
747 float_fftw_planner::FftwMethod |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
748 float_fftw_planner::do_method (void) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
749 { |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
750 return m_meth; |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
751 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
752 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
753 float_fftw_planner::FftwMethod |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
754 float_fftw_planner::do_method (FftwMethod _meth) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
755 { |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
756 FftwMethod ret = m_meth; |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
757 if (_meth == ESTIMATE || _meth == MEASURE |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
758 || _meth == PATIENT || _meth == EXHAUSTIVE |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
759 || _meth == HYBRID) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
760 { |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
761 if (m_meth != _meth) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
762 { |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
763 m_meth = _meth; |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
764 if (m_rplan) |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
765 fftwf_destroy_plan (reinterpret_cast<fftwf_plan> (m_rplan)); |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
766 if (m_plan[0]) |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
767 fftwf_destroy_plan (reinterpret_cast<fftwf_plan> (m_plan[0])); |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
768 if (m_plan[1]) |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
769 fftwf_destroy_plan (reinterpret_cast<fftwf_plan> (m_plan[1])); |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
770 m_rplan = m_plan[0] = m_plan[1] = nullptr; |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
771 } |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
772 } |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
773 else |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
774 ret = UNKNOWN; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
775 return ret; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
776 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
777 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
778 template <typename T> |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
779 static inline void |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
780 convert_packcomplex_1d (T *out, std::size_t nr, std::size_t nc, |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
781 octave_idx_type stride, octave_idx_type dist) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
782 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
783 octave_quit (); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
784 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
785 // Fill in the missing data. |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
786 |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
787 for (std::size_t i = 0; i < nr; i++) |
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
788 for (std::size_t j = nc/2+1; j < nc; j++) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
789 out[j*stride + i*dist] = conj (out[(nc - j)*stride + i*dist]); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
790 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
791 octave_quit (); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
792 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
793 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
794 template <typename T> |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
795 static inline void |
23433
c9fab0bc983e
maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
796 convert_packcomplex_Nd (T *out, const dim_vector& dv) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
797 { |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
798 std::size_t nc = dv(0); |
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
799 std::size_t nr = dv(1); |
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
800 std::size_t np = (dv.ndims () > 2 ? dv.numel () / nc / nr : 1); |
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
801 std::size_t nrp = nr * np; |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
802 T *ptr1, *ptr2; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
803 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
804 octave_quit (); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
805 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
806 // Create space for the missing elements. |
9516
fb933db0c517
convert fftw planner classes to singleton objects
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
807 |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
808 for (std::size_t i = 0; i < nrp; i++) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
809 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
810 ptr1 = out + i * (nc/2 + 1) + nrp*((nc-1)/2); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
811 ptr2 = out + i * nc; |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
812 for (std::size_t j = 0; j < nc/2+1; j++) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
813 *ptr2++ = *ptr1++; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
814 } |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
815 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
816 octave_quit (); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
817 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
818 // Fill in the missing data for the rank = 2 case directly for speed. |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
819 |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
820 for (std::size_t i = 0; i < np; i++) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
821 { |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
822 for (std::size_t j = 1; j < nr; j++) |
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
823 for (std::size_t k = nc/2+1; k < nc; k++) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
824 out[k + (j + i*nr)*nc] = conj (out[nc - k + ((i+1)*nr - j)*nc]); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
825 |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
826 for (std::size_t j = nc/2+1; j < nc; j++) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
827 out[j + i*nr*nc] = conj (out[(i*nr+1)*nc - j]); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
828 } |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
829 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
830 octave_quit (); |
4785 | 831 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
832 // Now do the permutations needed for rank > 2 cases. |
4785 | 833 |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
834 std::size_t jstart = dv(0) * dv(1); |
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
835 std::size_t kstep = dv(0); |
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
836 std::size_t nel = dv.numel (); |
4773 | 837 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
838 for (int inner = 2; inner < dv.ndims (); inner++) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
839 { |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
840 std::size_t jmax = jstart * dv(inner); |
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
841 for (std::size_t i = 0; i < nel; i+=jmax) |
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
842 for (std::size_t j = jstart, jj = jmax-jstart; j < jj; |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
843 j+=jstart, jj-=jstart) |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
844 for (std::size_t k = 0; k < jstart; k+= kstep) |
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
845 for (std::size_t l = nc/2+1; l < nc; l++) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
846 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
847 T tmp = out[i+ j + k + l]; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
848 out[i + j + k + l] = out[i + jj + k + l]; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
849 out[i + jj + k + l] = tmp; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
850 } |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
851 jstart = jmax; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
852 } |
4785 | 853 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
854 octave_quit (); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
855 } |
4785 | 856 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
857 int |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
858 fftw::fft (const double *in, Complex *out, std::size_t npts, |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
859 std::size_t nsamples, octave_idx_type stride, |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
860 octave_idx_type dist) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
861 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
862 dist = (dist < 0 ? npts : dist); |
4773 | 863 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
864 dim_vector dv (npts, 1); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
865 void *vplan = fftw_planner::create_plan (1, dv, nsamples, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
866 stride, dist, in, out); |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
867 fftw_plan m_plan = reinterpret_cast<fftw_plan> (vplan); |
4785 | 868 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
869 fftw_execute_dft_r2c (m_plan, (const_cast<double *>(in)), |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
870 reinterpret_cast<fftw_complex *> (out)); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
871 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
872 // Need to create other half of the transform. |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
873 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
874 convert_packcomplex_1d (out, nsamples, npts, stride, dist); |
4785 | 875 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
876 return 0; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
877 } |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
878 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
879 int |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
880 fftw::fft (const Complex *in, Complex *out, std::size_t npts, |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
881 std::size_t nsamples, octave_idx_type stride, |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
882 octave_idx_type dist) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
883 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
884 dist = (dist < 0 ? npts : dist); |
4773 | 885 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
886 dim_vector dv (npts, 1); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
887 void *vplan = fftw_planner::create_plan (FFTW_FORWARD, 1, dv, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
888 nsamples, stride, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
889 dist, in, out); |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
890 fftw_plan m_plan = reinterpret_cast<fftw_plan> (vplan); |
4773 | 891 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
892 fftw_execute_dft (m_plan, |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
893 reinterpret_cast<fftw_complex *> (const_cast<Complex *>(in)), |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
894 reinterpret_cast<fftw_complex *> (out)); |
4773 | 895 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
896 return 0; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
897 } |
3828 | 898 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
899 int |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
900 fftw::ifft (const Complex *in, Complex *out, std::size_t npts, |
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
901 std::size_t nsamples, octave_idx_type stride, |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
902 octave_idx_type dist) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
903 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
904 dist = (dist < 0 ? npts : dist); |
4773 | 905 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
906 dim_vector dv (npts, 1); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
907 void *vplan = fftw_planner::create_plan (FFTW_BACKWARD, 1, dv, nsamples, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
908 stride, dist, in, out); |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
909 fftw_plan m_plan = reinterpret_cast<fftw_plan> (vplan); |
4773 | 910 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
911 fftw_execute_dft (m_plan, |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
912 reinterpret_cast<fftw_complex *> (const_cast<Complex *>(in)), |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
913 reinterpret_cast<fftw_complex *> (out)); |
4773 | 914 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
915 const Complex scale = npts; |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
916 for (std::size_t j = 0; j < nsamples; j++) |
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
917 for (std::size_t i = 0; i < npts; i++) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
918 out[i*stride + j*dist] /= scale; |
4773 | 919 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
920 return 0; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
921 } |
4773 | 922 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
923 int |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
924 fftw::fftNd (const double *in, Complex *out, const int rank, |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
925 const dim_vector& dv) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
926 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
927 octave_idx_type dist = 1; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
928 for (int i = 0; i < rank; i++) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
929 dist *= dv(i); |
4773 | 930 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
931 // Fool with the position of the start of the output matrix, so that |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
932 // creating other half of the matrix won't cause cache problems. |
3828 | 933 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
934 octave_idx_type offset = (dv.numel () / dv(0)) * ((dv(0) - 1) / 2); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
935 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
936 void *vplan = fftw_planner::create_plan (rank, dv, 1, 1, dist, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
937 in, out + offset); |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
938 fftw_plan m_plan = reinterpret_cast<fftw_plan> (vplan); |
3828 | 939 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
940 fftw_execute_dft_r2c (m_plan, (const_cast<double *>(in)), |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
941 reinterpret_cast<fftw_complex *> (out+ offset)); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
942 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
943 // Need to create other half of the transform. |
3828 | 944 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
945 convert_packcomplex_Nd (out, dv); |
4773 | 946 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
947 return 0; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
948 } |
4809 | 949 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
950 int |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
951 fftw::fftNd (const Complex *in, Complex *out, const int rank, |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
952 const dim_vector& dv) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
953 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
954 octave_idx_type dist = 1; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
955 for (int i = 0; i < rank; i++) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
956 dist *= dv(i); |
4773 | 957 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
958 void *vplan = fftw_planner::create_plan (FFTW_FORWARD, rank, dv, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
959 1, 1, dist, in, out); |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
960 fftw_plan m_plan = reinterpret_cast<fftw_plan> (vplan); |
4809 | 961 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
962 fftw_execute_dft (m_plan, |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
963 reinterpret_cast<fftw_complex *> (const_cast<Complex *>(in)), |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
964 reinterpret_cast<fftw_complex *> (out)); |
3828 | 965 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
966 return 0; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
967 } |
4773 | 968 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
969 int |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
970 fftw::ifftNd (const Complex *in, Complex *out, const int rank, |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
971 const dim_vector& dv) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
972 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
973 octave_idx_type dist = 1; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
974 for (int i = 0; i < rank; i++) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
975 dist *= dv(i); |
4773 | 976 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
977 void *vplan = fftw_planner::create_plan (FFTW_BACKWARD, rank, dv, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
978 1, 1, dist, in, out); |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
979 fftw_plan m_plan = reinterpret_cast<fftw_plan> (vplan); |
4773 | 980 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
981 fftw_execute_dft (m_plan, |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
982 reinterpret_cast<fftw_complex *> (const_cast<Complex *>(in)), |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
983 reinterpret_cast<fftw_complex *> (out)); |
3828 | 984 |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
985 const std::size_t npts = dv.numel (); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
986 const Complex scale = npts; |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
987 for (std::size_t i = 0; i < npts; i++) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
988 out[i] /= scale; |
4773 | 989 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
990 return 0; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
991 } |
4773 | 992 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
993 int |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
994 fftw::fft (const float *in, FloatComplex *out, std::size_t npts, |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
995 std::size_t nsamples, octave_idx_type stride, |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
996 octave_idx_type dist) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
997 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
998 dist = (dist < 0 ? npts : dist); |
4773 | 999 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1000 dim_vector dv (npts, 1); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1001 void *vplan = float_fftw_planner::create_plan (1, dv, nsamples, stride, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1002 dist, in, out); |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
1003 fftwf_plan m_plan = reinterpret_cast<fftwf_plan> (vplan); |
3828 | 1004 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
1005 fftwf_execute_dft_r2c (m_plan, (const_cast<float *>(in)), |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1006 reinterpret_cast<fftwf_complex *> (out)); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1007 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1008 // Need to create other half of the transform. |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1009 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1010 convert_packcomplex_1d (out, nsamples, npts, stride, dist); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
1011 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1012 return 0; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1013 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
1014 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1015 int |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
1016 fftw::fft (const FloatComplex *in, FloatComplex *out, std::size_t npts, |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
1017 std::size_t nsamples, octave_idx_type stride, |
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
1018 octave_idx_type dist) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1019 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1020 dist = (dist < 0 ? npts : dist); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
1021 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1022 dim_vector dv (npts, 1); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1023 void *vplan = float_fftw_planner::create_plan (FFTW_FORWARD, 1, dv, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1024 nsamples, stride, dist, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1025 in, out); |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
1026 fftwf_plan m_plan = reinterpret_cast<fftwf_plan> (vplan); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
1027 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
1028 fftwf_execute_dft (m_plan, |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1029 reinterpret_cast<fftwf_complex *> (const_cast<FloatComplex *>(in)), |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1030 reinterpret_cast<fftwf_complex *> (out)); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
1031 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1032 return 0; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1033 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
1034 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1035 int |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
1036 fftw::ifft (const FloatComplex *in, FloatComplex *out, std::size_t npts, |
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
1037 std::size_t nsamples, octave_idx_type stride, |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
1038 octave_idx_type dist) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1039 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1040 dist = (dist < 0 ? npts : dist); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
1041 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1042 dim_vector dv (npts, 1); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1043 void *vplan = float_fftw_planner::create_plan (FFTW_BACKWARD, 1, dv, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1044 nsamples, stride, dist, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1045 in, out); |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
1046 fftwf_plan m_plan = reinterpret_cast<fftwf_plan> (vplan); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
1047 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
1048 fftwf_execute_dft (m_plan, |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1049 reinterpret_cast<fftwf_complex *> (const_cast<FloatComplex *>(in)), |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1050 reinterpret_cast<fftwf_complex *> (out)); |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1051 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1052 const FloatComplex scale = npts; |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
1053 for (std::size_t j = 0; j < nsamples; j++) |
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
1054 for (std::size_t i = 0; i < npts; i++) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1055 out[i*stride + j*dist] /= scale; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
1056 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1057 return 0; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1058 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
1059 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1060 int |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1061 fftw::fftNd (const float *in, FloatComplex *out, const int rank, |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
1062 const dim_vector& dv) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1063 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1064 octave_idx_type dist = 1; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1065 for (int i = 0; i < rank; i++) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1066 dist *= dv(i); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
1067 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1068 // Fool with the position of the start of the output matrix, so that |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1069 // creating other half of the matrix won't cause cache problems. |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1070 |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1071 octave_idx_type offset = (dv.numel () / dv(0)) * ((dv(0) - 1) / 2); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
1072 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1073 void *vplan = float_fftw_planner::create_plan (rank, dv, 1, 1, dist, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1074 in, out + offset); |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
1075 fftwf_plan m_plan = reinterpret_cast<fftwf_plan> (vplan); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
1076 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
1077 fftwf_execute_dft_r2c (m_plan, (const_cast<float *>(in)), |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1078 reinterpret_cast<fftwf_complex *> (out+ offset)); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
1079 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1080 // Need to create other half of the transform. |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
1081 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1082 convert_packcomplex_Nd (out, dv); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
1083 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1084 return 0; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1085 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
1086 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1087 int |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1088 fftw::fftNd (const FloatComplex *in, FloatComplex *out, const int rank, |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
1089 const dim_vector& dv) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1090 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1091 octave_idx_type dist = 1; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1092 for (int i = 0; i < rank; i++) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1093 dist *= dv(i); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
1094 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1095 void *vplan = float_fftw_planner::create_plan (FFTW_FORWARD, rank, dv, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1096 1, 1, dist, in, out); |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
1097 fftwf_plan m_plan = reinterpret_cast<fftwf_plan> (vplan); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
1098 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
1099 fftwf_execute_dft (m_plan, |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1100 reinterpret_cast<fftwf_complex *> (const_cast<FloatComplex *>(in)), |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1101 reinterpret_cast<fftwf_complex *> (out)); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
1102 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1103 return 0; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1104 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
1105 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1106 int |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1107 fftw::ifftNd (const FloatComplex *in, FloatComplex *out, const int rank, |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
1108 const dim_vector& dv) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1109 { |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1110 octave_idx_type dist = 1; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1111 for (int i = 0; i < rank; i++) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1112 dist *= dv(i); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
1113 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1114 void *vplan = float_fftw_planner::create_plan (FFTW_BACKWARD, rank, dv, |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1115 1, 1, dist, in, out); |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
1116 fftwf_plan m_plan = reinterpret_cast<fftwf_plan> (vplan); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1117 |
30102
eb10871a5882
maint: use "m_" prefix for member variables in class fftw_planner.
Rik <rik@octave.org>
parents:
29572
diff
changeset
|
1118 fftwf_execute_dft (m_plan, |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1119 reinterpret_cast<fftwf_complex *> (const_cast<FloatComplex *>(in)), |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1120 reinterpret_cast<fftwf_complex *> (out)); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
1121 |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
1122 const std::size_t npts = dv.numel (); |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1123 const FloatComplex scale = npts; |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
1124 for (std::size_t i = 0; i < npts; i++) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1125 out[i] /= scale; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
1126 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1127 return 0; |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1128 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
1129 |
3828 | 1130 #endif |
21600
184b85b31e03
more updates for version function
mmuetzel <markus.muetzel@gmx.de>
parents:
21520
diff
changeset
|
1131 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1132 std::string |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1133 fftw_version (void) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1134 { |
21600
184b85b31e03
more updates for version function
mmuetzel <markus.muetzel@gmx.de>
parents:
21520
diff
changeset
|
1135 #if defined (HAVE_FFTW) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1136 return ::fftw_version; |
21600
184b85b31e03
more updates for version function
mmuetzel <markus.muetzel@gmx.de>
parents:
21520
diff
changeset
|
1137 #else |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1138 return "none"; |
21600
184b85b31e03
more updates for version function
mmuetzel <markus.muetzel@gmx.de>
parents:
21520
diff
changeset
|
1139 #endif |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1140 } |
21603
37cbdf7bffa9
Add fftwf_version (bug #45659)
mmuetzel <markus.muetzel@gmx.de>
parents:
21600
diff
changeset
|
1141 |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1142 std::string |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1143 fftwf_version (void) |
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1144 { |
21603
37cbdf7bffa9
Add fftwf_version (bug #45659)
mmuetzel <markus.muetzel@gmx.de>
parents:
21600
diff
changeset
|
1145 #if defined (HAVE_FFTW) |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1146 return ::fftwf_version; |
21603
37cbdf7bffa9
Add fftwf_version (bug #45659)
mmuetzel <markus.muetzel@gmx.de>
parents:
21600
diff
changeset
|
1147 #else |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1148 return "none"; |
21603
37cbdf7bffa9
Add fftwf_version (bug #45659)
mmuetzel <markus.muetzel@gmx.de>
parents:
21600
diff
changeset
|
1149 #endif |
23058
5839d16828cb
move fftw classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1150 } |
21603
37cbdf7bffa9
Add fftwf_version (bug #45659)
mmuetzel <markus.muetzel@gmx.de>
parents:
21600
diff
changeset
|
1151 } |