comparison src/ifft.cc @ 1:78fd87e624cb

[project @ 1993-08-08 01:13:40 by jwe] Initial revision
author jwe
date Sun, 08 Aug 1993 01:13:40 +0000
parents
children d68036bcad4c
comparison
equal deleted inserted replaced
0:22412e3a4641 1:78fd87e624cb
1 // tc-ifft.cc -*- C++ -*-
2 /*
3
4 Copyright (C) 1993 John W. Eaton
5
6 This file is part of Octave.
7
8 Octave is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 2, or (at your option) any
11 later version.
12
13 Octave is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with Octave; see the file COPYING. If not, write to the Free
20 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21
22 */
23
24 #ifdef __GNUG__
25 #pragma implementation
26 #endif
27
28 #include "Matrix.h"
29
30 #include "tree-const.h"
31 #include "user-prefs.h"
32 #include "gripes.h"
33 #include "error.h"
34
35 #ifdef WITH_DLD
36 tree_constant *
37 builtin_ifft_2 (tree_constant *args, int nargin, int nargout)
38 {
39 tree_constant *retval = new tree_constant [2];
40 retval[0] = ifft (args[1]);
41 return retval;
42 }
43 #endif
44
45 tree_constant
46 ifft (tree_constant& a)
47 {
48 tree_constant retval;
49
50 tree_constant tmp = a.make_numeric ();;
51
52 if (tmp.rows () == 0 || tmp.columns () == 0)
53 {
54 int flag = user_pref.propagate_empty_matrices;
55 if (flag != 0)
56 {
57 if (flag < 0)
58 gripe_empty_arg ("ifft", 0);
59 Matrix m;
60 retval = tree_constant (m);
61 }
62 else
63 gripe_empty_arg ("ifft", 1);
64
65 return retval;
66 }
67
68 switch (tmp.const_type ())
69 {
70 case tree_constant_rep::matrix_constant:
71 {
72 Matrix m = tmp.matrix_value ();
73 ComplexMatrix mifft = m.ifourier ();
74 retval = tree_constant (mifft);
75 }
76 break;
77 case tree_constant_rep::complex_matrix_constant:
78 {
79 ComplexMatrix m = tmp.complex_matrix_value ();
80 ComplexMatrix mifft = m.ifourier ();
81 retval = tree_constant (mifft);
82 }
83 break;
84 case tree_constant_rep::scalar_constant:
85 case tree_constant_rep::complex_scalar_constant:
86 error ("ifft: invalid scalar arguement");
87 break;
88 default:
89 panic_impossible ();
90 break;
91 }
92 return retval;
93 }
94
95
96 /*
97 ;;; Local Variables: ***
98 ;;; mode: C++ ***
99 ;;; page-delimiter: "^/\\*" ***
100 ;;; End: ***
101 */