Mercurial > hg > octave-lyh
comparison src/DLD-FUNCTIONS/lookup.cc @ 7789:82be108cc558
First attempt at single precision tyeps
* * *
corrections to qrupdate single precision routines
* * *
prefer demotion to single over promotion to double
* * *
Add single precision support to log2 function
* * *
Trivial PROJECT file update
* * *
Cache optimized hermitian/transpose methods
* * *
Add tests for tranpose/hermitian and ChangeLog entry for new transpose code
author | David Bateman <dbateman@free.fr> |
---|---|
date | Sun, 27 Apr 2008 22:34:17 +0200 |
parents | 4fbaba9abec1 |
children | 9d080df0c843 |
comparison
equal
deleted
inserted
replaced
7788:45f5faba05a2 | 7789:82be108cc558 |
---|---|
178 right_inf = contains_char (opt, 'r'); | 178 right_inf = contains_char (opt, 'r'); |
179 } | 179 } |
180 | 180 |
181 // in the case of a complex array, absolute values will be used for compatibility | 181 // in the case of a complex array, absolute values will be used for compatibility |
182 // (though it's not too meaningful). | 182 // (though it's not too meaningful). |
183 | 183 ArrayN<octave_idx_type> idx; |
184 NDArray table = (argtable.is_complex_type ()) | 184 |
185 ? argtable.complex_array_value ().abs () | 185 if (argtable.is_single_type () || argy.is_single_type ()) |
186 : argtable.array_value (); | 186 { |
187 | 187 FloatNDArray table = (argtable.is_complex_type ()) |
188 NDArray y = (argy.is_complex_type ()) | 188 ? argtable.float_complex_array_value ().abs () |
189 ? argy.complex_array_value ().abs () | 189 : argtable.float_array_value (); |
190 : argy.array_value (); | 190 |
191 | 191 FloatNDArray y = (argy.is_complex_type ()) |
192 ArrayN<octave_idx_type> idx (y.dims ()); | 192 ? argy.float_complex_array_value ().abs () |
193 | 193 : argy.float_array_value (); |
194 // determine whether the array is descending. | 194 |
195 bool desc = is_descending (table.data (), table.length ()); | 195 idx = ArrayN<octave_idx_type> (y.dims ()); |
196 octave_idx_type offset = left_inf ? 1 : 0; | 196 |
197 octave_idx_type size = table.length () - offset - (right_inf ? 1 : 0); | 197 // determine whether the array is descending. |
198 if (size < 0) | 198 bool desc = is_descending (table.data (), table.length ()); |
199 size = 0; | 199 octave_idx_type offset = left_inf ? 1 : 0; |
200 | 200 octave_idx_type size = table.length () - offset - (right_inf ? 1 : 0); |
201 if (desc) | 201 if (size < 0) |
202 seq_lookup (table.data (), offset, size, | 202 size = 0; |
203 y.data (), y.length (), idx.fortran_vec (), | 203 |
204 std::greater<double> ()); | 204 if (desc) |
205 seq_lookup (table.data (), offset, size, | |
206 y.data (), y.length (), idx.fortran_vec (), | |
207 std::greater<float> ()); | |
208 else | |
209 seq_lookup (table.data (), offset, size, | |
210 y.data (), y.length (), idx.fortran_vec (), | |
211 std::less<float> ()); | |
212 } | |
205 else | 213 else |
206 seq_lookup (table.data (), offset, size, | 214 { |
207 y.data (), y.length (), idx.fortran_vec (), | 215 NDArray table = (argtable.is_complex_type ()) |
208 std::less<double> ()); | 216 ? argtable.complex_array_value ().abs () |
209 | 217 : argtable.array_value (); |
218 | |
219 NDArray y = (argy.is_complex_type ()) | |
220 ? argy.complex_array_value ().abs () | |
221 : argy.array_value (); | |
222 | |
223 idx = ArrayN<octave_idx_type> (y.dims ()); | |
224 | |
225 // determine whether the array is descending. | |
226 bool desc = is_descending (table.data (), table.length ()); | |
227 octave_idx_type offset = left_inf ? 1 : 0; | |
228 octave_idx_type size = table.length () - offset - (right_inf ? 1 : 0); | |
229 if (size < 0) | |
230 size = 0; | |
231 | |
232 if (desc) | |
233 seq_lookup (table.data (), offset, size, | |
234 y.data (), y.length (), idx.fortran_vec (), | |
235 std::greater<double> ()); | |
236 else | |
237 seq_lookup (table.data (), offset, size, | |
238 y.data (), y.length (), idx.fortran_vec (), | |
239 std::less<double> ()); | |
240 } | |
210 | 241 |
211 //retval(0) = idx; | 242 //retval(0) = idx; |
212 assign (retval(0), idx); | 243 assign (retval(0), idx); |
213 } | 244 } |
214 else if (str_case) | 245 else if (str_case) |