Mercurial > octave
comparison src/DLD-FUNCTIONS/conv2.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 | a1dbe9d80eee |
children | 87865ed7405f |
comparison
equal
deleted
inserted
replaced
7788:45f5faba05a2 | 7789:82be108cc558 |
---|---|
38 extern MArray2<double> | 38 extern MArray2<double> |
39 conv2 (MArray<double>&, MArray<double>&, MArray2<double>&, Shape); | 39 conv2 (MArray<double>&, MArray<double>&, MArray2<double>&, Shape); |
40 | 40 |
41 extern MArray2<Complex> | 41 extern MArray2<Complex> |
42 conv2 (MArray<Complex>&, MArray<Complex>&, MArray2<Complex>&, Shape); | 42 conv2 (MArray<Complex>&, MArray<Complex>&, MArray2<Complex>&, Shape); |
43 | |
44 extern MArray2<float> | |
45 conv2 (MArray<float>&, MArray<float>&, MArray2<float>&, Shape); | |
46 | |
47 extern MArray2<FloatComplex> | |
48 conv2 (MArray<FloatComplex>&, MArray<FloatComplex>&, MArray2<FloatComplex>&, Shape); | |
43 #endif | 49 #endif |
44 | 50 |
45 template <class T> | 51 template <class T> |
46 MArray2<T> | 52 MArray2<T> |
47 conv2 (MArray<T>& R, MArray<T>& C, MArray2<T>& A, Shape ishape) | 53 conv2 (MArray<T>& R, MArray<T>& C, MArray2<T>& A, Shape ishape) |
140 extern MArray2<double> | 146 extern MArray2<double> |
141 conv2 (MArray2<double>&, MArray2<double>&, Shape); | 147 conv2 (MArray2<double>&, MArray2<double>&, Shape); |
142 | 148 |
143 extern MArray2<Complex> | 149 extern MArray2<Complex> |
144 conv2 (MArray2<Complex>&, MArray2<Complex>&, Shape); | 150 conv2 (MArray2<Complex>&, MArray2<Complex>&, Shape); |
151 | |
152 extern MArray2<float> | |
153 conv2 (MArray2<float>&, MArray2<float>&, Shape); | |
154 | |
155 extern MArray2<FloatComplex> | |
156 conv2 (MArray2<FloatComplex>&, MArray2<FloatComplex>&, Shape); | |
145 #endif | 157 #endif |
146 | 158 |
147 template <class T> | 159 template <class T> |
148 MArray2<T> | 160 MArray2<T> |
149 conv2 (MArray2<T>&A, MArray2<T>&B, Shape ishape) | 161 conv2 (MArray2<T>&A, MArray2<T>&B, Shape ishape) |
302 { | 314 { |
303 print_usage (); | 315 print_usage (); |
304 return retval; | 316 return retval; |
305 } | 317 } |
306 | 318 |
307 if (args(0).is_complex_type () | 319 if (args(0).is_single_type () || |
308 || args(1).is_complex_type () | 320 args(1).is_single_type () || |
309 || args(2).is_complex_type ()) | 321 args(2).is_single_type ()) |
310 { | 322 { |
311 ComplexColumnVector v1 (args(0).complex_vector_value ()); | 323 if (args(0).is_complex_type () |
312 ComplexColumnVector v2 (args(1).complex_vector_value ()); | 324 || args(1).is_complex_type () |
313 ComplexMatrix a (args(2).complex_matrix_value ()); | 325 || args(2).is_complex_type ()) |
314 ComplexMatrix c (conv2 (v1, v2, a, ishape)); | 326 { |
315 if (! error_state) | 327 FloatComplexColumnVector v1 (args(0).float_complex_vector_value ()); |
316 retval = c; | 328 FloatComplexColumnVector v2 (args(1).float_complex_vector_value ()); |
317 } | 329 FloatComplexMatrix a (args(2).float_complex_matrix_value ()); |
330 FloatComplexMatrix c (conv2 (v1, v2, a, ishape)); | |
331 if (! error_state) | |
332 retval = c; | |
333 } | |
334 else | |
335 { | |
336 FloatColumnVector v1 (args(0).float_vector_value ()); | |
337 FloatColumnVector v2 (args(1).float_vector_value ()); | |
338 FloatMatrix a (args(2).float_matrix_value ()); | |
339 FloatMatrix c (conv2 (v1, v2, a, ishape)); | |
340 if (! error_state) | |
341 retval = c; | |
342 } | |
343 } | |
318 else | 344 else |
319 { | 345 { |
320 ColumnVector v1 (args(0).vector_value ()); | 346 if (args(0).is_complex_type () |
321 ColumnVector v2 (args(1).vector_value ()); | 347 || args(1).is_complex_type () |
322 Matrix a (args(2).matrix_value ()); | 348 || args(2).is_complex_type ()) |
323 Matrix c (conv2 (v1, v2, a, ishape)); | 349 { |
324 if (! error_state) | 350 ComplexColumnVector v1 (args(0).complex_vector_value ()); |
325 retval = c; | 351 ComplexColumnVector v2 (args(1).complex_vector_value ()); |
326 } | 352 ComplexMatrix a (args(2).complex_matrix_value ()); |
353 ComplexMatrix c (conv2 (v1, v2, a, ishape)); | |
354 if (! error_state) | |
355 retval = c; | |
356 } | |
357 else | |
358 { | |
359 ColumnVector v1 (args(0).vector_value ()); | |
360 ColumnVector v2 (args(1).vector_value ()); | |
361 Matrix a (args(2).matrix_value ()); | |
362 Matrix c (conv2 (v1, v2, a, ishape)); | |
363 if (! error_state) | |
364 retval = c; | |
365 } | |
366 } | |
327 } // if (separable) | 367 } // if (separable) |
328 else | 368 else |
329 { | 369 { |
330 if (args(0).is_complex_type () | 370 if (args(0).is_single_type () || |
331 || args(1).is_complex_type ()) | 371 args(1).is_single_type ()) |
332 { | 372 { |
333 ComplexMatrix a (args(0).complex_matrix_value ()); | 373 if (args(0).is_complex_type () |
334 ComplexMatrix b (args(1).complex_matrix_value ()); | 374 || args(1).is_complex_type ()) |
335 ComplexMatrix c (conv2 (a, b, ishape)); | 375 { |
336 if (! error_state) | 376 FloatComplexMatrix a (args(0).float_complex_matrix_value ()); |
337 retval = c; | 377 FloatComplexMatrix b (args(1).float_complex_matrix_value ()); |
338 } | 378 FloatComplexMatrix c (conv2 (a, b, ishape)); |
379 if (! error_state) | |
380 retval = c; | |
381 } | |
382 else | |
383 { | |
384 FloatMatrix a (args(0).float_matrix_value ()); | |
385 FloatMatrix b (args(1).float_matrix_value ()); | |
386 FloatMatrix c (conv2 (a, b, ishape)); | |
387 if (! error_state) | |
388 retval = c; | |
389 } | |
390 } | |
339 else | 391 else |
340 { | 392 { |
341 Matrix a (args(0).matrix_value ()); | 393 if (args(0).is_complex_type () |
342 Matrix b (args(1).matrix_value ()); | 394 || args(1).is_complex_type ()) |
343 Matrix c (conv2 (a, b, ishape)); | 395 { |
344 if (! error_state) | 396 ComplexMatrix a (args(0).complex_matrix_value ()); |
345 retval = c; | 397 ComplexMatrix b (args(1).complex_matrix_value ()); |
346 } | 398 ComplexMatrix c (conv2 (a, b, ishape)); |
399 if (! error_state) | |
400 retval = c; | |
401 } | |
402 else | |
403 { | |
404 Matrix a (args(0).matrix_value ()); | |
405 Matrix b (args(1).matrix_value ()); | |
406 Matrix c (conv2 (a, b, ishape)); | |
407 if (! error_state) | |
408 retval = c; | |
409 } | |
410 } | |
347 | 411 |
348 } // if (separable) | 412 } // if (separable) |
349 | 413 |
350 return retval; | 414 return retval; |
351 } | 415 } |