Mercurial > octave-nkf
comparison src/DLD-FUNCTIONS/__convn__.cc @ 10154:40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 20 Jan 2010 17:33:41 -0500 |
parents | 30b952e90c29 |
children | 12884915a8e4 |
comparison
equal
deleted
inserted
replaced
10153:2c28f9d0360f | 10154:40dfc0c99116 |
---|---|
80 | 80 |
81 // Allocate output | 81 // Allocate output |
82 dim_vector out_size (a_size); | 82 dim_vector out_size (a_size); |
83 for (octave_idx_type n = 0; n < ndims; n++) | 83 for (octave_idx_type n = 0; n < ndims; n++) |
84 out_size(n) = std::max (a_size(n) - b_size(n) + 1, | 84 out_size(n) = std::max (a_size(n) - b_size(n) + 1, |
85 static_cast<octave_idx_type> (0)); | 85 static_cast<octave_idx_type> (0)); |
86 | 86 |
87 typedef typename octave_convn_traits<MTa, MTb>::TR MTout; | 87 typedef typename octave_convn_traits<MTa, MTb>::TR MTout; |
88 | 88 |
89 MTout out (out_size); | 89 MTout out (out_size); |
90 | 90 |
137 octave_value retval; | 137 octave_value retval; |
138 | 138 |
139 if (args.length () == 2) | 139 if (args.length () == 2) |
140 { | 140 { |
141 if (args(0).is_single_type() || args(1).is_single_type()) | 141 if (args(0).is_single_type() || args(1).is_single_type()) |
142 { | 142 { |
143 if (args(0).is_real_type ()) | 143 if (args(0).is_real_type ()) |
144 { | 144 { |
145 if (args(1).is_real_type ()) | 145 if (args(1).is_real_type ()) |
146 { | 146 { |
147 const FloatNDArray a = args (0).float_array_value (); | 147 const FloatNDArray a = args (0).float_array_value (); |
148 const FloatNDArray b = args (1).float_array_value (); | 148 const FloatNDArray b = args (1).float_array_value (); |
149 | 149 |
150 if (! error_state) | 150 if (! error_state) |
151 retval = convn (a, b); | 151 retval = convn (a, b); |
152 } | 152 } |
153 else if (args(1).is_complex_type ()) | 153 else if (args(1).is_complex_type ()) |
154 { | 154 { |
155 const FloatNDArray a = args (0).float_array_value (); | 155 const FloatNDArray a = args (0).float_array_value (); |
156 const FloatComplexNDArray b = args (1).float_complex_array_value (); | 156 const FloatComplexNDArray b = args (1).float_complex_array_value (); |
157 | 157 |
158 if (! error_state) | 158 if (! error_state) |
159 retval = convn (a, b); | 159 retval = convn (a, b); |
160 } | 160 } |
161 else | 161 else |
162 error ("__convn__: invalid call"); | 162 error ("__convn__: invalid call"); |
163 } | 163 } |
164 else if (args(0).is_complex_type ()) | 164 else if (args(0).is_complex_type ()) |
165 { | 165 { |
166 if (args(1).is_complex_type ()) | 166 if (args(1).is_complex_type ()) |
167 { | 167 { |
168 const FloatComplexNDArray a = args (0).float_complex_array_value (); | 168 const FloatComplexNDArray a = args (0).float_complex_array_value (); |
169 const FloatComplexNDArray b = args (1).float_complex_array_value (); | 169 const FloatComplexNDArray b = args (1).float_complex_array_value (); |
170 | 170 |
171 if (! error_state) | 171 if (! error_state) |
172 retval = convn (a, b); | 172 retval = convn (a, b); |
173 } | 173 } |
174 else if (args(1).is_real_type ()) | 174 else if (args(1).is_real_type ()) |
175 { | 175 { |
176 const FloatComplexNDArray a = args (0).float_complex_array_value (); | 176 const FloatComplexNDArray a = args (0).float_complex_array_value (); |
177 const FloatNDArray b = args (1).float_array_value (); | 177 const FloatNDArray b = args (1).float_array_value (); |
178 | 178 |
179 if (! error_state) | 179 if (! error_state) |
180 retval = convn (a, b); | 180 retval = convn (a, b); |
181 } | 181 } |
182 else | 182 else |
183 error ("__convn__: invalid call"); | 183 error ("__convn__: invalid call"); |
184 } | 184 } |
185 else | 185 else |
186 error ("__convn__: invalid call"); | 186 error ("__convn__: invalid call"); |
187 } | 187 } |
188 else | 188 else |
189 { | 189 { |
190 if (args(0).is_real_type ()) | 190 if (args(0).is_real_type ()) |
191 { | 191 { |
192 if (args(1).is_real_type ()) | 192 if (args(1).is_real_type ()) |
193 { | 193 { |
194 const NDArray a = args (0).array_value (); | 194 const NDArray a = args (0).array_value (); |
195 const NDArray b = args (1).array_value (); | 195 const NDArray b = args (1).array_value (); |
196 | 196 |
197 if (! error_state) | 197 if (! error_state) |
198 retval = convn (a, b); | 198 retval = convn (a, b); |
199 } | 199 } |
200 else if (args(1).is_complex_type ()) | 200 else if (args(1).is_complex_type ()) |
201 { | 201 { |
202 const NDArray a = args (0).array_value (); | 202 const NDArray a = args (0).array_value (); |
203 const ComplexNDArray b = args (1).complex_array_value (); | 203 const ComplexNDArray b = args (1).complex_array_value (); |
204 | 204 |
205 if (! error_state) | 205 if (! error_state) |
206 retval = convn (a, b); | 206 retval = convn (a, b); |
207 } | 207 } |
208 else | 208 else |
209 error ("__convn__: invalid call"); | 209 error ("__convn__: invalid call"); |
210 } | 210 } |
211 else if (args(0).is_complex_type ()) | 211 else if (args(0).is_complex_type ()) |
212 { | 212 { |
213 if (args(1).is_complex_type ()) | 213 if (args(1).is_complex_type ()) |
214 { | 214 { |
215 const ComplexNDArray a = args (0).complex_array_value (); | 215 const ComplexNDArray a = args (0).complex_array_value (); |
216 const ComplexNDArray b = args (1).complex_array_value (); | 216 const ComplexNDArray b = args (1).complex_array_value (); |
217 | 217 |
218 if (! error_state) | 218 if (! error_state) |
219 retval = convn (a, b); | 219 retval = convn (a, b); |
220 } | 220 } |
221 else if (args(1).is_real_type ()) | 221 else if (args(1).is_real_type ()) |
222 { | 222 { |
223 const ComplexNDArray a = args (0).complex_array_value (); | 223 const ComplexNDArray a = args (0).complex_array_value (); |
224 const NDArray b = args (1).array_value (); | 224 const NDArray b = args (1).array_value (); |
225 | 225 |
226 if (! error_state) | 226 if (! error_state) |
227 retval = convn (a, b); | 227 retval = convn (a, b); |
228 } | 228 } |
229 else | 229 else |
230 error ("__convn__: invalid call"); | 230 error ("__convn__: invalid call"); |
231 } | 231 } |
232 else | 232 else |
233 error ("__convn__: invalid call"); | 233 error ("__convn__: invalid call"); |
234 } | 234 } |
235 } | 235 } |
236 else | 236 else |
237 print_usage (); | 237 print_usage (); |
238 | 238 |
239 return retval; | 239 return retval; |