Mercurial > octave
diff src/DLD-FUNCTIONS/kron.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 | fe332ce262b5 |
children | eb63fbe60fab |
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/kron.cc Wed May 14 18:09:56 2008 +0200 +++ b/src/DLD-FUNCTIONS/kron.cc Sun Apr 27 22:34:17 2008 +0200 @@ -40,6 +40,13 @@ extern void kron (const Array2<Complex>&, const Array2<Complex>&, Array2<Complex>&); + +extern void +kron (const Array2<float>&, const Array2<float>&, Array2<float>&); + +extern void +kron (const Array2<FlaotComplex>&, const Array2<FloatComplex>&, + Array2<FloatComplex>&); #endif template <class T> @@ -69,6 +76,12 @@ template void kron (const Array2<Complex>&, const Array2<Complex>&, Array2<Complex>&); +template void +kron (const Array2<float>&, const Array2<float>&, Array2<float>&); + +template void +kron (const Array2<FloatComplex>&, const Array2<FloatComplex>&, + Array2<FloatComplex>&); #if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) extern void @@ -171,28 +184,58 @@ } else { - if (args(0).is_complex_type () || args(1).is_complex_type ()) + if (args(0).is_single_type () || args(1).is_single_type ()) { - ComplexMatrix a (args(0).complex_matrix_value()); - ComplexMatrix b (args(1).complex_matrix_value()); + if (args(0).is_complex_type () || args(1).is_complex_type ()) + { + FloatComplexMatrix a (args(0).float_complex_matrix_value()); + FloatComplexMatrix b (args(1).float_complex_matrix_value()); - if (! error_state) + if (! error_state) + { + FloatComplexMatrix c; + kron (a, b, c); + retval(0) = c; + } + } + else { - ComplexMatrix c; - kron (a, b, c); - retval(0) = c; + FloatMatrix a (args(0).float_matrix_value ()); + FloatMatrix b (args(1).float_matrix_value ()); + + if (! error_state) + { + FloatMatrix c; + kron (a, b, c); + retval (0) = c; + } } } else { - Matrix a (args(0).matrix_value ()); - Matrix b (args(1).matrix_value ()); + if (args(0).is_complex_type () || args(1).is_complex_type ()) + { + ComplexMatrix a (args(0).complex_matrix_value()); + ComplexMatrix b (args(1).complex_matrix_value()); - if (! error_state) + if (! error_state) + { + ComplexMatrix c; + kron (a, b, c); + retval(0) = c; + } + } + else { - Matrix c; - kron (a, b, c); - retval (0) = c; + Matrix a (args(0).matrix_value ()); + Matrix b (args(1).matrix_value ()); + + if (! error_state) + { + Matrix c; + kron (a, b, c); + retval (0) = c; + } } } }