Mercurial > octave
annotate libinterp/corefcn/fftn.cc @ 33623:4517f929c59d bytecode-interpreter tip
maint: Merge default to bytecode-interpreter
author | Arun Giridhar <arungiridhar@gmail.com> |
---|---|
date | Fri, 24 May 2024 16:22:41 -0400 |
parents | 6e67f10b4d33 |
children |
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 // |
32632
2e484f9f1f18
maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
31706
diff
changeset
|
3 // Copyright (C) 2004-2024 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 //////////////////////////////////////////////////////////////////////// |
4773 | 25 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21660
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21200
diff
changeset
|
27 # include "config.h" |
4773 | 28 #endif |
29 | |
30 #include "lo-mappers.h" | |
31 | |
15039
e753177cde93
maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
32 #include "defun.h" |
4773 | 33 #include "error.h" |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
20940
diff
changeset
|
34 #include "errwarn.h" |
20940
48b2ad5ee801
maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents:
20918
diff
changeset
|
35 #include "ovl.h" |
4773 | 36 #include "utils.h" |
37 | |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30888
diff
changeset
|
38 OCTAVE_BEGIN_NAMESPACE(octave) |
29958
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
39 |
4773 | 40 // This function should be merged with Fifft. |
41 | |
42 static octave_value | |
23433
c9fab0bc983e
maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
43 do_fftn (const octave_value_list& args, const char *fcn, int type) |
4773 | 44 { |
45 int nargin = args.length (); | |
46 | |
47 if (nargin < 1 || nargin > 2) | |
20802
8bb38ba1bad6
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20704
diff
changeset
|
48 print_usage (); |
4773 | 49 |
20918
6f0bd96f93c0
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20853
diff
changeset
|
50 octave_value retval; |
4773 | 51 octave_value arg = args(0); |
52 dim_vector dims = arg.dims (); | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
53 |
21660
53728df3e4c9
maint: for clarity, call ndims() rather than length() on dimension vectors.
Rik <rik@octave.org>
parents:
21301
diff
changeset
|
54 for (int i = 0; i < dims.ndims (); i++) |
4773 | 55 if (dims(i) < 0) |
56 return retval; | |
57 | |
58 if (nargin > 1) | |
59 { | |
20704
571508c1ed06
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20555
diff
changeset
|
60 Matrix val = args(1).xmatrix_value ("%s: SIZE must be a vector of length dim", fcn); |
571508c1ed06
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20555
diff
changeset
|
61 |
4773 | 62 if (val.rows () > val.columns ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9523
diff
changeset
|
63 val = val.transpose (); |
4773 | 64 |
21660
53728df3e4c9
maint: for clarity, call ndims() rather than length() on dimension vectors.
Rik <rik@octave.org>
parents:
21301
diff
changeset
|
65 if (val.columns () != dims.ndims () || val.rows () != 1) |
11553
01f703952eff
Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
66 error ("%s: SIZE must be a vector of length dim", fcn); |
20918
6f0bd96f93c0
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20853
diff
changeset
|
67 |
21660
53728df3e4c9
maint: for clarity, call ndims() rather than length() on dimension vectors.
Rik <rik@octave.org>
parents:
21301
diff
changeset
|
68 for (int i = 0; i < dims.ndims (); i++) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9523
diff
changeset
|
69 { |
30390
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29961
diff
changeset
|
70 if (math::isnan (val(i, 0))) |
20918
6f0bd96f93c0
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20853
diff
changeset
|
71 error ("%s: SIZE has invalid NaN entries", fcn); |
30390
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29961
diff
changeset
|
72 else if (math::nint_big (val(i, 0)) < 0) |
20918
6f0bd96f93c0
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20853
diff
changeset
|
73 error ("%s: all dimensions in SIZE must be greater than zero", fcn); |
6f0bd96f93c0
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20853
diff
changeset
|
74 else |
30390
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29961
diff
changeset
|
75 dims(i) = math::nint_big(val(i, 0)); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9523
diff
changeset
|
76 } |
4773 | 77 } |
78 | |
33146
6e67f10b4d33
Fix input validation for zero-dimensional input data to ifftn, ifft2, fftn, fft2 (bug #65414).
Markus Meisinger <chloros2@gmx.de>
parents:
32632
diff
changeset
|
79 if (dims.any_zero ()) |
7924 | 80 { |
81 if (arg.is_single_type ()) | |
33146
6e67f10b4d33
Fix input validation for zero-dimensional input data to ifftn, ifft2, fftn, fft2 (bug #65414).
Markus Meisinger <chloros2@gmx.de>
parents:
32632
diff
changeset
|
82 return octave_value (FloatNDArray (dims)); |
7924 | 83 else |
33146
6e67f10b4d33
Fix input validation for zero-dimensional input data to ifftn, ifft2, fftn, fft2 (bug #65414).
Markus Meisinger <chloros2@gmx.de>
parents:
32632
diff
changeset
|
84 return octave_value (NDArray (dims)); |
7924 | 85 } |
4773 | 86 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
87 if (arg.is_single_type ()) |
4773 | 88 { |
23582
0cc2011d800e
maint: Deprecate is_real_type and replace with isreal.
Rik <rik@octave.org>
parents:
23581
diff
changeset
|
89 if (arg.isreal ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9523
diff
changeset
|
90 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9523
diff
changeset
|
91 FloatNDArray nda = arg.float_array_value (); |
4773 | 92 |
20555
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20172
diff
changeset
|
93 nda.resize (dims, 0.0); |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20172
diff
changeset
|
94 retval = (type != 0 ? nda.ifourierNd () : nda.fourierNd ()); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9523
diff
changeset
|
95 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
96 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9523
diff
changeset
|
97 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9523
diff
changeset
|
98 FloatComplexNDArray cnda = arg.float_complex_array_value (); |
4773 | 99 |
20555
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20172
diff
changeset
|
100 cnda.resize (dims, 0.0); |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20172
diff
changeset
|
101 retval = (type != 0 ? cnda.ifourierNd () : cnda.fourierNd ()); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9523
diff
changeset
|
102 } |
4773 | 103 } |
104 else | |
105 { | |
23582
0cc2011d800e
maint: Deprecate is_real_type and replace with isreal.
Rik <rik@octave.org>
parents:
23581
diff
changeset
|
106 if (arg.isreal ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9523
diff
changeset
|
107 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9523
diff
changeset
|
108 NDArray nda = arg.array_value (); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
109 |
20555
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20172
diff
changeset
|
110 nda.resize (dims, 0.0); |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20172
diff
changeset
|
111 retval = (type != 0 ? nda.ifourierNd () : nda.fourierNd ()); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9523
diff
changeset
|
112 } |
23581
c3075ae020e1
maint: Deprecate is_complex_type and replace with iscomplex.
Rik <rik@octave.org>
parents:
23433
diff
changeset
|
113 else if (arg.iscomplex ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9523
diff
changeset
|
114 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9523
diff
changeset
|
115 ComplexNDArray cnda = arg.complex_array_value (); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
116 |
20555
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20172
diff
changeset
|
117 cnda.resize (dims, 0.0); |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20172
diff
changeset
|
118 retval = (type != 0 ? cnda.ifourierNd () : cnda.fourierNd ()); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9523
diff
changeset
|
119 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
120 else |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
20940
diff
changeset
|
121 err_wrong_type_arg (fcn, arg); |
4773 | 122 } |
123 | |
124 return retval; | |
125 } | |
126 | |
15039
e753177cde93
maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
127 DEFUN (fftn, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
128 doc: /* -*- texinfo -*- |
30888
32d2b6604a9f
doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
129 @deftypefn {} {@var{B} =} fftn (@var{A}) |
32d2b6604a9f
doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
130 @deftypefnx {} {@var{B} =} fftn (@var{A}, @var{size}) |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
131 Compute the N-dimensional discrete Fourier transform of @var{A} using |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
132 a Fast Fourier Transform (FFT) algorithm. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
133 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
134 The optional vector argument @var{size} may be used specify the dimensions |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
135 of the array to be used. If an element of @var{size} is smaller than the |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
136 corresponding dimension of @var{A}, then the dimension of @var{A} is |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
137 truncated prior to performing the FFT@. Otherwise, if an element of |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
138 @var{size} is larger than the corresponding dimension then @var{A} is |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
139 resized and padded with zeros. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
140 @seealso{ifftn, fft, fft2, fftw} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
141 @end deftypefn */) |
4773 | 142 { |
4782 | 143 return do_fftn (args, "fftn", 0); |
4773 | 144 } |
145 | |
33146
6e67f10b4d33
Fix input validation for zero-dimensional input data to ifftn, ifft2, fftn, fft2 (bug #65414).
Markus Meisinger <chloros2@gmx.de>
parents:
32632
diff
changeset
|
146 /* |
6e67f10b4d33
Fix input validation for zero-dimensional input data to ifftn, ifft2, fftn, fft2 (bug #65414).
Markus Meisinger <chloros2@gmx.de>
parents:
32632
diff
changeset
|
147 %!testif HAVE_FFTW <*65414> |
6e67f10b4d33
Fix input validation for zero-dimensional input data to ifftn, ifft2, fftn, fft2 (bug #65414).
Markus Meisinger <chloros2@gmx.de>
parents:
32632
diff
changeset
|
148 %! sz = size (fftn (ones (2, 0, 3))); |
6e67f10b4d33
Fix input validation for zero-dimensional input data to ifftn, ifft2, fftn, fft2 (bug #65414).
Markus Meisinger <chloros2@gmx.de>
parents:
32632
diff
changeset
|
149 %! assert (sz, [2, 0, 3]); |
6e67f10b4d33
Fix input validation for zero-dimensional input data to ifftn, ifft2, fftn, fft2 (bug #65414).
Markus Meisinger <chloros2@gmx.de>
parents:
32632
diff
changeset
|
150 |
6e67f10b4d33
Fix input validation for zero-dimensional input data to ifftn, ifft2, fftn, fft2 (bug #65414).
Markus Meisinger <chloros2@gmx.de>
parents:
32632
diff
changeset
|
151 %!testif HAVE_FFTW <*65414> |
6e67f10b4d33
Fix input validation for zero-dimensional input data to ifftn, ifft2, fftn, fft2 (bug #65414).
Markus Meisinger <chloros2@gmx.de>
parents:
32632
diff
changeset
|
152 %! sz = size (fftn (ones (5, 4, 3), [2, 0, 3])); |
6e67f10b4d33
Fix input validation for zero-dimensional input data to ifftn, ifft2, fftn, fft2 (bug #65414).
Markus Meisinger <chloros2@gmx.de>
parents:
32632
diff
changeset
|
153 %! assert (sz, [2, 0, 3]); |
6e67f10b4d33
Fix input validation for zero-dimensional input data to ifftn, ifft2, fftn, fft2 (bug #65414).
Markus Meisinger <chloros2@gmx.de>
parents:
32632
diff
changeset
|
154 */ |
6e67f10b4d33
Fix input validation for zero-dimensional input data to ifftn, ifft2, fftn, fft2 (bug #65414).
Markus Meisinger <chloros2@gmx.de>
parents:
32632
diff
changeset
|
155 |
15039
e753177cde93
maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
156 DEFUN (ifftn, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
157 doc: /* -*- texinfo -*- |
30888
32d2b6604a9f
doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
158 @deftypefn {} {@var{A} =} ifftn (@var{B}) |
32d2b6604a9f
doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
159 @deftypefnx {} {@var{A} =} ifftn (@var{B}, @var{size}) |
32d2b6604a9f
doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
160 Compute the inverse N-dimensional discrete Fourier transform of @var{B} |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
161 using a Fast Fourier Transform (FFT) algorithm. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
162 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
163 The optional vector argument @var{size} may be used specify the dimensions |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
164 of the array to be used. If an element of @var{size} is smaller than the |
30888
32d2b6604a9f
doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
165 corresponding dimension of @var{B}, then the dimension of @var{B} is |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
166 truncated prior to performing the inverse FFT@. Otherwise, if an element of |
30888
32d2b6604a9f
doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
167 @var{size} is larger than the corresponding dimension then @var{B} is |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
168 resized and padded with zeros. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
169 @seealso{fftn, ifft, ifft2, fftw} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
170 @end deftypefn */) |
4773 | 171 { |
4782 | 172 return do_fftn (args, "ifftn", 1); |
4773 | 173 } |
29958
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
174 |
33146
6e67f10b4d33
Fix input validation for zero-dimensional input data to ifftn, ifft2, fftn, fft2 (bug #65414).
Markus Meisinger <chloros2@gmx.de>
parents:
32632
diff
changeset
|
175 /* |
6e67f10b4d33
Fix input validation for zero-dimensional input data to ifftn, ifft2, fftn, fft2 (bug #65414).
Markus Meisinger <chloros2@gmx.de>
parents:
32632
diff
changeset
|
176 %!testif HAVE_FFTW <*65414> |
6e67f10b4d33
Fix input validation for zero-dimensional input data to ifftn, ifft2, fftn, fft2 (bug #65414).
Markus Meisinger <chloros2@gmx.de>
parents:
32632
diff
changeset
|
177 %! sz = size (ifftn (ones (2, 0, 3))); |
6e67f10b4d33
Fix input validation for zero-dimensional input data to ifftn, ifft2, fftn, fft2 (bug #65414).
Markus Meisinger <chloros2@gmx.de>
parents:
32632
diff
changeset
|
178 %! assert (sz, [2, 0, 3]); |
6e67f10b4d33
Fix input validation for zero-dimensional input data to ifftn, ifft2, fftn, fft2 (bug #65414).
Markus Meisinger <chloros2@gmx.de>
parents:
32632
diff
changeset
|
179 |
6e67f10b4d33
Fix input validation for zero-dimensional input data to ifftn, ifft2, fftn, fft2 (bug #65414).
Markus Meisinger <chloros2@gmx.de>
parents:
32632
diff
changeset
|
180 %!testif HAVE_FFTW <*65414> |
6e67f10b4d33
Fix input validation for zero-dimensional input data to ifftn, ifft2, fftn, fft2 (bug #65414).
Markus Meisinger <chloros2@gmx.de>
parents:
32632
diff
changeset
|
181 %! sz = size (ifftn (ones (5, 4, 3), [2, 0, 3])); |
6e67f10b4d33
Fix input validation for zero-dimensional input data to ifftn, ifft2, fftn, fft2 (bug #65414).
Markus Meisinger <chloros2@gmx.de>
parents:
32632
diff
changeset
|
182 %! assert (sz, [2, 0, 3]); |
6e67f10b4d33
Fix input validation for zero-dimensional input data to ifftn, ifft2, fftn, fft2 (bug #65414).
Markus Meisinger <chloros2@gmx.de>
parents:
32632
diff
changeset
|
183 */ |
6e67f10b4d33
Fix input validation for zero-dimensional input data to ifftn, ifft2, fftn, fft2 (bug #65414).
Markus Meisinger <chloros2@gmx.de>
parents:
32632
diff
changeset
|
184 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30888
diff
changeset
|
185 OCTAVE_END_NAMESPACE(octave) |