Mercurial > octave-nkf
comparison libinterp/corefcn/fft.cc @ 20587:f90c8372b7ba
eliminate many more simple uses of error_state
* Cell.cc, __ichol__.cc, __ilu__.cc, balance.cc, bsxfun.cc, colloc.cc,
det.cc, dlmread.cc, dynamic-ld.cc, eig.cc, fft.cc, fft2.cc, fftn.cc,
gcd.cc, getgrent.cc, getpwent.cc, givens.cc, hess.cc, input.cc,
levenshtein.cc, load-path.cc, lookup.cc, ls-mat-ascii.cc, ls-mat4.cc,
lsode.cc, lu.cc, max.cc, md5sum.cc, mex.cc, pager.cc, pinv.cc,
pr-output.cc, qz.cc, schur.cc, sparse.cc, sqrtm.cc, str2double.cc,
strfns.cc, sub2ind.cc, sysdep.cc, time.cc, toplev.cc, tril.cc,
tsearch.cc, typecast.cc, __init_gnuplot__.cc, __magick_read__.cc,
__osmesa_print__.cc, amd.cc, audiodevinfo.cc, dmperm.cc, fftw.cc,
symrcm.cc, ov-base-diag.cc, ov-base-sparse.cc, ov-base.cc,
ov-bool-sparse.cc, ov-builtin.cc, ov-complex.cc, ov-cx-diag.cc,
ov-cx-mat.cc, ov-cx-sparse.cc, ov-fcn-handle.cc, ov-fcn-inline.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-lazy-idx.cc, ov-mex-fcn.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, op-bm-b.cc, op-bm-bm.cc, op-sbm-b.cc,
op-sbm-bm.cc, op-str-m.cc, op-str-s.cc, oct-parse.in.yy, pt-cbinop.cc,
pt-colon.cc, pt-decl.cc, pt-exp.cc, pt-id.cc, pt-misc.cc,
pt-select.cc, pt-unop.cc: Eliminate simple uses of error_state.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 05 Oct 2015 19:29:36 -0400 |
parents | b2100e1659ac |
children |
comparison
equal
deleted
inserted
replaced
20586:b7ac1e94266e | 20587:f90c8372b7ba |
---|---|
72 fcn); | 72 fcn); |
73 } | 73 } |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 if (error_state) | |
78 return retval; | |
79 | |
80 if (nargin > 2) | 77 if (nargin > 2) |
81 { | 78 { |
82 double dval = args(2).double_value (); | 79 double dval = args(2).double_value (); |
83 if (xisnan (dval)) | 80 if (xisnan (dval)) |
84 error ("%s: DIM cannot be NaN", fcn); | 81 error ("%s: DIM cannot be NaN", fcn); |
88 else | 85 else |
89 // to be safe, cast it back to int since dim is an int | 86 // to be safe, cast it back to int since dim is an int |
90 dim = NINT (dval) - 1; | 87 dim = NINT (dval) - 1; |
91 } | 88 } |
92 | 89 |
93 if (error_state) | |
94 return retval; | |
95 | |
96 for (octave_idx_type i = 0; i < dims.length (); i++) | 90 for (octave_idx_type i = 0; i < dims.length (); i++) |
97 if (dims(i) < 0) | 91 if (dims(i) < 0) |
98 return retval; | 92 return retval; |
99 | 93 |
100 if (dim < 0) | 94 if (dim < 0) |
128 { | 122 { |
129 if (arg.is_real_type ()) | 123 if (arg.is_real_type ()) |
130 { | 124 { |
131 FloatNDArray nda = arg.float_array_value (); | 125 FloatNDArray nda = arg.float_array_value (); |
132 | 126 |
133 if (! error_state) | 127 nda.resize (dims, 0.0); |
134 { | 128 retval = (type != 0 ? nda.ifourier (dim) : nda.fourier (dim)); |
135 nda.resize (dims, 0.0); | |
136 retval = (type != 0 ? nda.ifourier (dim) : nda.fourier (dim)); | |
137 } | |
138 } | 129 } |
139 else | 130 else |
140 { | 131 { |
141 FloatComplexNDArray cnda = arg.float_complex_array_value (); | 132 FloatComplexNDArray cnda = arg.float_complex_array_value (); |
142 | 133 |
143 if (! error_state) | 134 cnda.resize (dims, 0.0); |
144 { | 135 retval = (type != 0 ? cnda.ifourier (dim) : cnda.fourier (dim)); |
145 cnda.resize (dims, 0.0); | |
146 retval = (type != 0 ? cnda.ifourier (dim) : cnda.fourier (dim)); | |
147 } | |
148 } | 136 } |
149 } | 137 } |
150 else | 138 else |
151 { | 139 { |
152 if (arg.is_real_type ()) | 140 if (arg.is_real_type ()) |
153 { | 141 { |
154 NDArray nda = arg.array_value (); | 142 NDArray nda = arg.array_value (); |
155 | 143 |
156 if (! error_state) | 144 nda.resize (dims, 0.0); |
157 { | 145 retval = (type != 0 ? nda.ifourier (dim) : nda.fourier (dim)); |
158 nda.resize (dims, 0.0); | |
159 retval = (type != 0 ? nda.ifourier (dim) : nda.fourier (dim)); | |
160 } | |
161 } | 146 } |
162 else if (arg.is_complex_type ()) | 147 else if (arg.is_complex_type ()) |
163 { | 148 { |
164 ComplexNDArray cnda = arg.complex_array_value (); | 149 ComplexNDArray cnda = arg.complex_array_value (); |
165 | 150 |
166 if (! error_state) | 151 cnda.resize (dims, 0.0); |
167 { | 152 retval = (type != 0 ? cnda.ifourier (dim) : cnda.fourier (dim)); |
168 cnda.resize (dims, 0.0); | |
169 retval = (type != 0 ? cnda.ifourier (dim) : cnda.fourier (dim)); | |
170 } | |
171 } | 153 } |
172 else | 154 else |
173 { | 155 gripe_wrong_type_arg (fcn, arg); |
174 gripe_wrong_type_arg (fcn, arg); | |
175 } | |
176 } | 156 } |
177 | 157 |
178 return retval; | 158 return retval; |
179 } | 159 } |
180 | 160 |