comparison src/DLD-FUNCTIONS/fft2.cc @ 10154:40dfc0c99116

DLD-FUNCTIONS/*.cc: untabify
author John W. Eaton <jwe@octave.org>
date Wed, 20 Jan 2010 17:33:41 -0500
parents 483c4b09b788
children d0ce5e973937
comparison
equal deleted inserted replaced
10153:2c28f9d0360f 10154:40dfc0c99116
61 61
62 if (nargin > 1) 62 if (nargin > 1)
63 { 63 {
64 double dval = args(1).double_value (); 64 double dval = args(1).double_value ();
65 if (xisnan (dval)) 65 if (xisnan (dval))
66 error ("%s: NaN is invalid as the N_ROWS", fcn); 66 error ("%s: NaN is invalid as the N_ROWS", fcn);
67 else 67 else
68 { 68 {
69 n_rows = NINTbig (dval); 69 n_rows = NINTbig (dval);
70 if (n_rows < 0) 70 if (n_rows < 0)
71 error ("%s: number of rows must be greater than zero", fcn); 71 error ("%s: number of rows must be greater than zero", fcn);
72 } 72 }
73 } 73 }
74 74
75 if (error_state) 75 if (error_state)
76 return retval; 76 return retval;
77 77
78 octave_idx_type n_cols = -1; 78 octave_idx_type n_cols = -1;
79 if (nargin > 2) 79 if (nargin > 2)
80 { 80 {
81 double dval = args(2).double_value (); 81 double dval = args(2).double_value ();
82 if (xisnan (dval)) 82 if (xisnan (dval))
83 error ("%s: NaN is invalid as the N_COLS", fcn); 83 error ("%s: NaN is invalid as the N_COLS", fcn);
84 else 84 else
85 { 85 {
86 n_cols = NINTbig (dval); 86 n_cols = NINTbig (dval);
87 if (n_cols < 0) 87 if (n_cols < 0)
88 error ("%s: number of columns must be greater than zero", fcn); 88 error ("%s: number of columns must be greater than zero", fcn);
89 } 89 }
90 } 90 }
91 91
92 if (error_state) 92 if (error_state)
93 return retval; 93 return retval;
94 94
107 dims (1) = n_cols; 107 dims (1) = n_cols;
108 108
109 if (dims.all_zero () || n_rows == 0 || n_cols == 0) 109 if (dims.all_zero () || n_rows == 0 || n_cols == 0)
110 { 110 {
111 if (arg.is_single_type ()) 111 if (arg.is_single_type ())
112 return octave_value (FloatMatrix ()); 112 return octave_value (FloatMatrix ());
113 else 113 else
114 return octave_value (Matrix ()); 114 return octave_value (Matrix ());
115 } 115 }
116 116
117 if (arg.is_single_type ()) 117 if (arg.is_single_type ())
118 { 118 {
119 if (arg.is_real_type ()) 119 if (arg.is_real_type ())
120 { 120 {
121 FloatNDArray nda = arg.float_array_value (); 121 FloatNDArray nda = arg.float_array_value ();
122 122
123 if (! error_state) 123 if (! error_state)
124 { 124 {
125 nda.resize (dims, 0.0); 125 nda.resize (dims, 0.0);
126 retval = (type != 0 ? nda.ifourier2d () : nda.fourier2d ()); 126 retval = (type != 0 ? nda.ifourier2d () : nda.fourier2d ());
127 } 127 }
128 } 128 }
129 else 129 else
130 { 130 {
131 FloatComplexNDArray cnda = arg.float_complex_array_value (); 131 FloatComplexNDArray cnda = arg.float_complex_array_value ();
132 132
133 if (! error_state) 133 if (! error_state)
134 { 134 {
135 cnda.resize (dims, 0.0); 135 cnda.resize (dims, 0.0);
136 retval = (type != 0 ? cnda.ifourier2d () : cnda.fourier2d ()); 136 retval = (type != 0 ? cnda.ifourier2d () : cnda.fourier2d ());
137 } 137 }
138 } 138 }
139 } 139 }
140 else 140 else
141 { 141 {
142 if (arg.is_real_type ()) 142 if (arg.is_real_type ())
143 { 143 {
144 NDArray nda = arg.array_value (); 144 NDArray nda = arg.array_value ();
145 145
146 if (! error_state) 146 if (! error_state)
147 { 147 {
148 nda.resize (dims, 0.0); 148 nda.resize (dims, 0.0);
149 retval = (type != 0 ? nda.ifourier2d () : nda.fourier2d ()); 149 retval = (type != 0 ? nda.ifourier2d () : nda.fourier2d ());
150 } 150 }
151 } 151 }
152 else if (arg.is_complex_type ()) 152 else if (arg.is_complex_type ())
153 { 153 {
154 ComplexNDArray cnda = arg.complex_array_value (); 154 ComplexNDArray cnda = arg.complex_array_value ();
155 155
156 if (! error_state) 156 if (! error_state)
157 { 157 {
158 cnda.resize (dims, 0.0); 158 cnda.resize (dims, 0.0);
159 retval = (type != 0 ? cnda.ifourier2d () : cnda.fourier2d ()); 159 retval = (type != 0 ? cnda.ifourier2d () : cnda.fourier2d ());
160 } 160 }
161 } 161 }
162 else 162 else
163 { 163 {
164 gripe_wrong_type_arg (fcn, arg); 164 gripe_wrong_type_arg (fcn, arg);
165 } 165 }
166 } 166 }
167 167
168 return retval; 168 return retval;
169 } 169 }
170 170