annotate libinterp/corefcn/fft.cc @ 21200:fcac5dbbf9ed

maint: Indent #ifdef blocks in libinterp. * builtins.h, Cell.cc, __contourc__.cc, __dispatch__.cc, __dsearchn__.cc, __ichol__.cc, __ilu__.cc, __lin_interpn__.cc, __pchip_deriv__.cc, __qp__.cc, balance.cc, besselj.cc, betainc.cc, bitfcns.cc, bsxfun.cc, c-file-ptr-stream.cc, c-file-ptr-stream.h, cellfun.cc, colloc.cc, comment-list.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc, debug.cc, defaults.cc, defaults.in.h, defun-dld.h, defun.cc, defun.h, det.cc, dirfns.cc, display.cc, dlmread.cc, dot.cc, dynamic-ld.cc, eig.cc, ellipj.cc, error.cc, errwarn.cc, event-queue.cc, fft.cc, fft2.cc, fftn.cc, file-io.cc, filter.cc, find.cc, gammainc.cc, gcd.cc, getgrent.cc, getpwent.cc, getrusage.cc, givens.cc, gl-render.cc, gl2ps-print.cc, graphics.cc, graphics.in.h, gripes.cc, hash.cc, help.cc, hess.cc, hex2num.cc, input.cc, inv.cc, jit-ir.cc, jit-typeinfo.cc, jit-util.cc, jit-util.h, kron.cc, load-path.cc, load-save.cc, lookup.cc, ls-ascii-helper.cc, ls-hdf5.cc, ls-mat-ascii.cc, ls-mat4.cc, ls-mat5.cc, ls-oct-binary.cc, ls-oct-text.cc, ls-oct-text.h, ls-utils.cc, ls-utils.h, lsode.cc, lu.cc, luinc.cc, mappers.cc, matrix_type.cc, max.cc, mex.h, mexproto.h, mgorth.cc, nproc.cc, oct-errno.in.cc, oct-fstrm.cc, oct-hdf5-types.cc, oct-hdf5.h, oct-hist.cc, oct-iostrm.cc, oct-lvalue.cc, oct-map.cc, oct-prcstrm.cc, oct-procbuf.cc, oct-stream.cc, oct-strstrm.cc, octave-link.cc, ordschur.cc, pager.cc, pinv.cc, pr-output.cc, procstream.cc, profiler.cc, psi.cc, pt-jit.cc, quad.cc, quadcc.cc, qz.cc, rand.cc, rcond.cc, regexp.cc, schur.cc, sighandlers.cc, sparse-xdiv.cc, sparse-xpow.cc, sparse.cc, spparms.cc, sqrtm.cc, str2double.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc, sylvester.cc, symtab.cc, syscalls.cc, sysdep.cc, sysdep.h, time.cc, toplev.cc, tril.cc, tsearch.cc, txt-eng-ft.cc, txt-eng.cc, typecast.cc, urlwrite.cc, utils.cc, variables.cc, xdiv.cc, xnorm.cc, xpow.cc, zfstream.cc, __delaunayn__.cc, __eigs__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc, __init_gnuplot__.cc, __magick_read__.cc, __osmesa_print__.cc, __voronoi__.cc, amd.cc, audiodevinfo.cc, audioread.cc, ccolamd.cc, chol.cc, colamd.cc, convhulln.cc, dmperm.cc, fftw.cc, oct-qhull.h, qr.cc, symbfact.cc, symrcm.cc, oct-conf.in.cc, ov-base-diag.cc, ov-base-int.cc, ov-base-mat.cc, ov-base-scalar.cc, ov-base-sparse.cc, ov-base.cc, ov-bool-mat.cc, ov-bool-sparse.cc, ov-bool.cc, ov-builtin.cc, ov-cell.cc, ov-ch-mat.cc, ov-class.cc, ov-classdef.cc, ov-colon.cc, ov-complex.cc, ov-cs-list.cc, ov-cx-diag.cc, ov-cx-mat.cc, ov-cx-sparse.cc, ov-dld-fcn.cc, ov-fcn-handle.cc, ov-fcn-inline.cc, ov-fcn.cc, ov-float.cc, ov-flt-complex.cc, ov-flt-cx-diag.cc, ov-flt-cx-mat.cc, ov-flt-re-diag.cc, ov-flt-re-mat.cc, ov-int16.cc, ov-int32.cc, ov-int64.cc, ov-int8.cc, ov-java.cc, ov-lazy-idx.cc, ov-mex-fcn.cc, ov-null-mat.cc, ov-oncleanup.cc, ov-perm.cc, ov-range.cc, ov-re-diag.cc, ov-re-mat.cc, ov-re-sparse.cc, ov-scalar.cc, ov-str-mat.cc, ov-struct.cc, ov-typeinfo.cc, ov-uint16.cc, ov-uint32.cc, ov-uint64.cc, ov-uint8.cc, ov-usr-fcn.cc, ov.cc, ovl.cc, octave.cc, op-b-b.cc, op-b-bm.cc, op-b-sbm.cc, op-bm-b.cc, op-bm-bm.cc, op-bm-sbm.cc, op-cdm-cdm.cc, op-cell.cc, op-chm.cc, op-class.cc, op-cm-cm.cc, op-cm-cs.cc, op-cm-m.cc, op-cm-s.cc, op-cm-scm.cc, op-cm-sm.cc, op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc, op-cs-scm.cc, op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc, op-dm-template.cc, op-dms-template.cc, op-double-conv.cc, op-fcdm-fcdm.cc, op-fcdm-fdm.cc, op-fcm-fcm.cc, op-fcm-fcs.cc, op-fcm-fm.cc, op-fcm-fs.cc, op-fcn.cc, op-fcs-fcm.cc, op-fcs-fcs.cc, op-fcs-fm.cc, op-fcs-fs.cc, op-fdm-fdm.cc, op-float-conv.cc, op-fm-fcm.cc, op-fm-fcs.cc, op-fm-fm.cc, op-fm-fs.cc, op-fs-fcm.cc, op-fs-fcs.cc, op-fs-fm.cc, op-fs-fs.cc, op-i16-i16.cc, op-i32-i32.cc, op-i64-i64.cc, op-i8-i8.cc, op-int-concat.cc, op-int-conv.cc, op-m-cm.cc, op-m-cs.cc, op-m-m.cc, op-m-s.cc, op-m-scm.cc, op-m-sm.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc, op-pm-template.cc, op-range.cc, op-s-cm.cc, op-s-cs.cc, op-s-m.cc, op-s-s.cc, op-s-scm.cc, op-s-sm.cc, op-sbm-b.cc, op-sbm-bm.cc, op-sbm-sbm.cc, op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc, op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc, op-sm-sm.cc, op-str-m.cc, op-str-s.cc, op-str-str.cc, op-struct.cc, op-ui16-ui16.cc, op-ui32-ui32.cc, op-ui64-ui64.cc, op-ui8-ui8.cc, pt-arg-list.cc, pt-array-list.cc, pt-assign.cc, pt-binop.cc, pt-bp.cc, pt-cbinop.cc, pt-cell.cc, pt-check.cc, pt-classdef.cc, pt-cmd.cc, pt-colon.cc, pt-colon.h, pt-const.cc, pt-decl.cc, pt-eval.cc, pt-except.cc, pt-exp.cc, pt-fcn-handle.cc, pt-funcall.cc, pt-id.cc, pt-idx.cc, pt-jump.cc, pt-loop.cc, pt-mat.cc, pt-misc.cc, pt-pr-code.cc, pt-select.cc, pt-stmt.cc, pt-unop.cc, pt.cc, token.cc, Array-jit.cc, Array-os.cc, Array-sym.cc, Array-tc.cc, version.cc: Indent #ifdef blocks in libinterp.
author Rik <rik@octave.org>
date Fri, 05 Feb 2016 16:29:08 -0800
parents e39e05d90788
children 40de9f8f23a6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
1 /*
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
2
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 17787
diff changeset
3 Copyright (C) 1997-2015 David Bateman
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 10155
diff changeset
4 Copyright (C) 1996-1997 John W. Eaton
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
5
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
6 This file is part of Octave.
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
7
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
8 Octave is free software; you can redistribute it and/or modify it
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 7001
diff changeset
10 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 7001
diff changeset
11 option) any later version.
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
12
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
13 Octave is distributed in the hope that it will be useful, but WITHOUT
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
16 for more details.
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
17
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 7001
diff changeset
19 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 7001
diff changeset
20 <http://www.gnu.org/licenses/>.
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
21
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
22 */
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
23
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
24 #ifdef HAVE_CONFIG_H
21200
fcac5dbbf9ed maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents: 21100
diff changeset
25 # include <config.h>
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
26 #endif
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
27
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
28 #include "lo-mappers.h"
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
29
15039
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14854
diff changeset
30 #include "defun.h"
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
31 #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
32 #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
33 #include "ovl.h"
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
34 #include "utils.h"
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
35
9523
0ce82753dd72 more configure changes for libraries
John W. Eaton <jwe@octave.org>
parents: 9072
diff changeset
36 #if defined (HAVE_FFTW)
21200
fcac5dbbf9ed maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents: 21100
diff changeset
37 # define FFTSRC "@sc{fftw}"
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
38 #else
21200
fcac5dbbf9ed maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents: 21100
diff changeset
39 # define FFTSRC "@sc{fftpack}"
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
40 #endif
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
41
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
42 static octave_value
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
43 do_fft (const octave_value_list &args, const char *fcn, int type)
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
44 {
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
45 int nargin = args.length ();
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
46
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
47 if (nargin < 1 || nargin > 3)
20802
8bb38ba1bad6 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
48 print_usage ();
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
49
20918
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20853
diff changeset
50 octave_value retval;
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
51 octave_value arg = args(0);
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
52 dim_vector dims = arg.dims ();
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4869
diff changeset
53 octave_idx_type n_points = -1;
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
54 int dim = -1;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
55
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
56 if (nargin > 1)
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
57 {
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
58 if (! args(1).is_empty ())
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
59 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
60 double dval = args(1).double_value ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
61 if (xisnan (dval))
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
62 error ("%s: number of points (N) cannot be NaN", fcn);
20918
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20853
diff changeset
63
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20853
diff changeset
64 n_points = NINTbig (dval);
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20853
diff changeset
65 if (n_points < 0)
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20853
diff changeset
66 error ("%s: number of points (N) must be greater than zero", fcn);
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
67 }
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
68 }
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
69
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
70 if (nargin > 2)
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
71 {
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
72 double dval = args(2).double_value ();
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
73 if (xisnan (dval))
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
74 error ("%s: DIM cannot be NaN", fcn);
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
75 else if (dval < 1 || dval > dims.length ())
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
76 error ("%s: DIM must be a valid dimension along which to perform FFT",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
77 fcn);
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
78 else
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
79 // to be safe, cast it back to int since dim is an int
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
80 dim = NINT (dval) - 1;
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
81 }
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
82
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4869
diff changeset
83 for (octave_idx_type i = 0; i < dims.length (); i++)
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
84 if (dims(i) < 0)
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
85 return retval;
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
86
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
87 if (dim < 0)
4869
b92d59213e63 [project @ 2004-04-21 17:03:02 by jwe]
jwe
parents: 4782
diff changeset
88 {
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4869
diff changeset
89 for (octave_idx_type i = 0; i < dims.length (); i++)
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
90 if (dims(i) > 1)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
91 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
92 dim = i;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
93 break;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
94 }
4869
b92d59213e63 [project @ 2004-04-21 17:03:02 by jwe]
jwe
parents: 4782
diff changeset
95
b92d59213e63 [project @ 2004-04-21 17:03:02 by jwe]
jwe
parents: 4782
diff changeset
96 // And if the first argument is scalar?
b92d59213e63 [project @ 2004-04-21 17:03:02 by jwe]
jwe
parents: 4782
diff changeset
97 if (dim < 0)
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
98 dim = 1;
4869
b92d59213e63 [project @ 2004-04-21 17:03:02 by jwe]
jwe
parents: 4782
diff changeset
99 }
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
100
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
101 if (n_points < 0)
20218
b2100e1659ac maint: Use cuddled parentheses when indexing dimension_vectors.
Rik <rik@octave.org>
parents: 19697
diff changeset
102 n_points = dims(dim);
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
103 else
20218
b2100e1659ac maint: Use cuddled parentheses when indexing dimension_vectors.
Rik <rik@octave.org>
parents: 19697
diff changeset
104 dims(dim) = n_points;
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
105
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 5823
diff changeset
106 if (dims.any_zero () || n_points == 0)
7924
4976f66d469b miscellaneous cleanup
John W. Eaton <jwe@octave.org>
parents: 7814
diff changeset
107 {
4976f66d469b miscellaneous cleanup
John W. Eaton <jwe@octave.org>
parents: 7814
diff changeset
108 if (arg.is_single_type ())
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
109 return octave_value (FloatNDArray (dims));
7924
4976f66d469b miscellaneous cleanup
John W. Eaton <jwe@octave.org>
parents: 7814
diff changeset
110 else
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
111 return octave_value (NDArray (dims));
7924
4976f66d469b miscellaneous cleanup
John W. Eaton <jwe@octave.org>
parents: 7814
diff changeset
112 }
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
113
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7562
diff changeset
114 if (arg.is_single_type ())
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
115 {
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7562
diff changeset
116 if (arg.is_real_type ())
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
117 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
118 FloatNDArray nda = arg.float_array_value ();
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
119
20555
f90c8372b7ba eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20218
diff changeset
120 nda.resize (dims, 0.0);
f90c8372b7ba eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20218
diff changeset
121 retval = (type != 0 ? nda.ifourier (dim) : nda.fourier (dim));
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
122 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7562
diff changeset
123 else
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
124 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
125 FloatComplexNDArray cnda = arg.float_complex_array_value ();
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
126
20555
f90c8372b7ba eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20218
diff changeset
127 cnda.resize (dims, 0.0);
f90c8372b7ba eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20218
diff changeset
128 retval = (type != 0 ? cnda.ifourier (dim) : cnda.fourier (dim));
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
129 }
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
130 }
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
131 else
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
132 {
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7562
diff changeset
133 if (arg.is_real_type ())
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
134 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
135 NDArray nda = arg.array_value ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7562
diff changeset
136
20555
f90c8372b7ba eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20218
diff changeset
137 nda.resize (dims, 0.0);
f90c8372b7ba eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20218
diff changeset
138 retval = (type != 0 ? nda.ifourier (dim) : nda.fourier (dim));
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
139 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7562
diff changeset
140 else if (arg.is_complex_type ())
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
141 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
142 ComplexNDArray cnda = arg.complex_array_value ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7562
diff changeset
143
20555
f90c8372b7ba eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20218
diff changeset
144 cnda.resize (dims, 0.0);
f90c8372b7ba eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20218
diff changeset
145 retval = (type != 0 ? cnda.ifourier (dim) : cnda.fourier (dim));
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9523
diff changeset
146 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7562
diff changeset
147 else
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 20940
diff changeset
148 err_wrong_type_arg (fcn, arg);
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
149 }
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
150
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
151 return retval;
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
152 }
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
153
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 5823
diff changeset
154 /*
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
155 %!assert (fft ([]), [])
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
156 %!assert (fft (zeros (10,0)), zeros (10,0))
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
157 %!assert (fft (zeros (0,10)), zeros (0,10))
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
158 %!assert (fft (0), 0)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
159 %!assert (fft (1), 1)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
160 %!assert (fft (ones (2,2)), [2,2; 0,0])
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
161 %!assert (fft (eye (2,2)), [1,1; 1,-1])
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 5823
diff changeset
162
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
163 %!assert (fft (single ([])), single ([]))
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
164 %!assert (fft (zeros (10,0,"single")), zeros (10,0,"single"))
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
165 %!assert (fft (zeros (0,10,"single")), zeros (0,10,"single"))
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
166 %!assert (fft (single (0)), single (0))
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
167 %!assert (fft (single (1)), single (1))
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
168 %!assert (fft (ones (2,2,"single")), single ([2,2; 0,0]))
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
169 %!assert (fft (eye (2,2,"single")), single ([1,1; 1,-1]))
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 5823
diff changeset
170
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
171 %!error (fft ())
6620
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 5823
diff changeset
172 */
bf4bdc21dc8d [project @ 2007-05-14 17:35:46 by jwe]
jwe
parents: 5823
diff changeset
173
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
174
15039
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14854
diff changeset
175 DEFUN (fft, args, ,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
176 "-*- texinfo -*-\n\
20853
1142cf6abc0d 2015 Code Sprint: remove class of function from docstring for all C++ files.
Rik <rik@octave.org>
parents: 20802
diff changeset
177 @deftypefn {} {} fft (@var{x})\n\
1142cf6abc0d 2015 Code Sprint: remove class of function from docstring for all C++ files.
Rik <rik@octave.org>
parents: 20802
diff changeset
178 @deftypefnx {} {} fft (@var{x}, @var{n})\n\
1142cf6abc0d 2015 Code Sprint: remove class of function from docstring for all C++ files.
Rik <rik@octave.org>
parents: 20802
diff changeset
179 @deftypefnx {} {} fft (@var{x}, @var{n}, @var{dim})\n\
12160
b64b82721062 Make documentation static by removing docstrings depending on #ifdef variables
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
180 Compute the discrete Fourier transform of @var{A} using\n\
b64b82721062 Make documentation static by removing docstrings depending on #ifdef variables
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
181 a Fast Fourier Transform (FFT) algorithm.\n\
b64b82721062 Make documentation static by removing docstrings depending on #ifdef variables
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
182 \n\
b64b82721062 Make documentation static by removing docstrings depending on #ifdef variables
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
183 The FFT is calculated along the first non-singleton dimension of the\n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
184 array. Thus if @var{x} is a matrix, @code{fft (@var{x})} computes the\n\
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
185 FFT for each column of @var{x}.\n\
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
186 \n\
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
187 If called with two arguments, @var{n} is expected to be an integer\n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
188 specifying the number of elements of @var{x} to use, or an empty\n\
9064
7c02ec148a3c Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
189 matrix to specify that its value should be ignored. If @var{n} is\n\
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
190 larger than the dimension along which the FFT is calculated, then\n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
191 @var{x} is resized and padded with zeros. Otherwise, if @var{n} is\n\
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
192 smaller than the dimension along which the FFT is calculated, then\n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
193 @var{x} is truncated.\n\
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
194 \n\
5448
ebe5d7d15522 [project @ 2005-09-14 18:55:04 by jwe]
jwe
parents: 5307
diff changeset
195 If called with three arguments, @var{dim} is an integer specifying the\n\
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
196 dimension of the matrix along which the FFT is performed\n\
6971
0a9d97cf2e13 [project @ 2007-10-07 19:44:53 by dbateman]
dbateman
parents: 6622
diff changeset
197 @seealso{ifft, fft2, fftn, fftw}\n\
5642
2618a0750ae6 [project @ 2006-03-06 21:26:48 by jwe]
jwe
parents: 5448
diff changeset
198 @end deftypefn")
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
199 {
4782
3dfdf6f36854 [project @ 2004-02-17 16:23:22 by jwe]
jwe
parents: 4773
diff changeset
200 return do_fft (args, "fft", 0);
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
201 }
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
202
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
203
15039
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14854
diff changeset
204 DEFUN (ifft, args, ,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
205 "-*- texinfo -*-\n\
20853
1142cf6abc0d 2015 Code Sprint: remove class of function from docstring for all C++ files.
Rik <rik@octave.org>
parents: 20802
diff changeset
206 @deftypefn {} {} ifft (@var{x})\n\
1142cf6abc0d 2015 Code Sprint: remove class of function from docstring for all C++ files.
Rik <rik@octave.org>
parents: 20802
diff changeset
207 @deftypefnx {} {} ifft (@var{x}, @var{n})\n\
1142cf6abc0d 2015 Code Sprint: remove class of function from docstring for all C++ files.
Rik <rik@octave.org>
parents: 20802
diff changeset
208 @deftypefnx {} {} ifft (@var{x}, @var{n}, @var{dim})\n\
12160
b64b82721062 Make documentation static by removing docstrings depending on #ifdef variables
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
209 Compute the inverse discrete Fourier transform of @var{A}\n\
b64b82721062 Make documentation static by removing docstrings depending on #ifdef variables
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
210 using a Fast Fourier Transform (FFT) algorithm.\n\
b64b82721062 Make documentation static by removing docstrings depending on #ifdef variables
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
211 \n\
b64b82721062 Make documentation static by removing docstrings depending on #ifdef variables
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
212 The inverse FFT is calculated along the first non-singleton dimension\n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
213 of the array. Thus if @var{x} is a matrix, @code{fft (@var{x})} computes\n\
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
214 the inverse FFT for each column of @var{x}.\n\
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
215 \n\
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
216 If called with two arguments, @var{n} is expected to be an integer\n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
217 specifying the number of elements of @var{x} to use, or an empty\n\
9064
7c02ec148a3c Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
218 matrix to specify that its value should be ignored. If @var{n} is\n\
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
219 larger than the dimension along which the inverse FFT is calculated, then\n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
220 @var{x} is resized and padded with zeros. Otherwise, if @var{n} is\n\
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
221 smaller than the dimension along which the inverse FFT is calculated,\n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
222 then @var{x} is truncated.\n\
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
223 \n\
7001
8b0cfeb06365 [project @ 2007-10-10 18:02:59 by jwe]
jwe
parents: 6971
diff changeset
224 If called with three arguments, @var{dim} is an integer specifying the\n\
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
225 dimension of the matrix along which the inverse FFT is performed\n\
6971
0a9d97cf2e13 [project @ 2007-10-07 19:44:53 by dbateman]
dbateman
parents: 6622
diff changeset
226 @seealso{fft, ifft2, ifftn, fftw}\n\
5642
2618a0750ae6 [project @ 2006-03-06 21:26:48 by jwe]
jwe
parents: 5448
diff changeset
227 @end deftypefn")
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
228 {
4782
3dfdf6f36854 [project @ 2004-02-17 16:23:22 by jwe]
jwe
parents: 4773
diff changeset
229 return do_fft (args, "ifft", 1);
4773
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
230 }
ccfbd6047a54 [project @ 2004-02-16 19:02:32 by jwe]
jwe
parents: 4233
diff changeset
231
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
232 /*
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
233 %% Author: David Billinghurst (David.Billinghurst@riotinto.com.au)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
234 %% Comalco Research and Technology
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
235 %% 02 May 2000
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
236 %!test
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
237 %! N = 64;
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
238 %! n = 4;
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
239 %! t = 2*pi*(0:1:N-1)/N;
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
240 %! s = cos (n*t);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
241 %! S = fft (s);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
242 %!
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
243 %! answer = zeros (size (t));
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
244 %! answer(n+1) = N/2;
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
245 %! answer(N-n+1) = N/2;
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
246 %!
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
247 %! assert (S, answer, 4*N*eps);
7562
c827f5673321 move tests to individual source files
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
248
c827f5673321 move tests to individual source files
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
249 %% Author: David Billinghurst (David.Billinghurst@riotinto.com.au)
c827f5673321 move tests to individual source files
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
250 %% Comalco Research and Technology
c827f5673321 move tests to individual source files
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
251 %% 02 May 2000
c827f5673321 move tests to individual source files
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
252 %!test
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
253 %! N = 64;
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
254 %! n = 7;
7562
c827f5673321 move tests to individual source files
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
255 %! t = 2*pi*(0:1:N-1)/N;
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
256 %! s = cos (n*t);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
257 %!
14854
5ae9f0f77635 maint: Use Octave coding conventions for coddling parenthis is DLD-FUNCTIONS directory
Rik <octave@nomad.inbox5.com>
parents: 14501
diff changeset
258 %! S = zeros (size (t));
7562
c827f5673321 move tests to individual source files
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
259 %! S(n+1) = N/2;
c827f5673321 move tests to individual source files
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
260 %! S(N-n+1) = N/2;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
261 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
262 %! assert (ifft (S), s, 4*N*eps);
7562
c827f5673321 move tests to individual source files
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
263
c827f5673321 move tests to individual source files
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
264 %% Author: David Billinghurst (David.Billinghurst@riotinto.com.au)
c827f5673321 move tests to individual source files
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
265 %% Comalco Research and Technology
c827f5673321 move tests to individual source files
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
266 %% 02 May 2000
c827f5673321 move tests to individual source files
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
267 %!test
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
268 %! N = 64;
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
269 %! n = 4;
7814
87865ed7405f Second set of single precision test code and fix of resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
270 %! t = single (2*pi*(0:1:N-1)/N);
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
271 %! s = cos (n*t);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
272 %! S = fft (s);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
273 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
274 %! answer = zeros (size (t), "single");
7814
87865ed7405f Second set of single precision test code and fix of resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
275 %! answer(n+1) = N/2;
87865ed7405f Second set of single precision test code and fix of resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
276 %! answer(N-n+1) = N/2;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
277 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
278 %! assert (S, answer, 4*N*eps ("single"));
7562
c827f5673321 move tests to individual source files
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
279
c827f5673321 move tests to individual source files
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
280 %% Author: David Billinghurst (David.Billinghurst@riotinto.com.au)
c827f5673321 move tests to individual source files
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
281 %% Comalco Research and Technology
c827f5673321 move tests to individual source files
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
282 %% 02 May 2000
c827f5673321 move tests to individual source files
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
283 %!test
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
284 %! N = 64;
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
285 %! n = 7;
7814
87865ed7405f Second set of single precision test code and fix of resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
286 %! t = 2*pi*(0:1:N-1)/N;
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
287 %! s = cos (n*t);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
288 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
289 %! S = zeros (size (t), "single");
7814
87865ed7405f Second set of single precision test code and fix of resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
290 %! S(n+1) = N/2;
87865ed7405f Second set of single precision test code and fix of resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
291 %! S(N-n+1) = N/2;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
292 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
293 %! assert (ifft (S), s, 4*N*eps ("single"));
7562
c827f5673321 move tests to individual source files
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
294 */