Mercurial > hg > segmenter-vamp-plugin
comparison armadillo-3.900.4/include/armadillo_bits/fn_kron.hpp @ 49:1ec0e2823891
Switch to using subrepo copies of qm-dsp, nnls-chroma, vamp-plugin-sdk; update Armadillo version; assume build without external BLAS/LAPACK
author | Chris Cannam |
---|---|
date | Thu, 13 Jun 2013 10:25:24 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
48:69251e11a913 | 49:1ec0e2823891 |
---|---|
1 // Copyright (C) 2009-2010 NICTA (www.nicta.com.au) | |
2 // Copyright (C) 2009-2010 Conrad Sanderson | |
3 // Copyright (C) 2009-2010 Dimitrios Bouzas | |
4 // | |
5 // This Source Code Form is subject to the terms of the Mozilla Public | |
6 // License, v. 2.0. If a copy of the MPL was not distributed with this | |
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
8 | |
9 | |
10 //! \addtogroup fn_kron | |
11 //! @{ | |
12 | |
13 | |
14 | |
15 //! \brief | |
16 //! kronecker product of two matrices, | |
17 //! with the matrices having the same element type | |
18 template<typename T1, typename T2> | |
19 arma_inline | |
20 const Glue<T1,T2,glue_kron> | |
21 kron(const Base<typename T1::elem_type,T1>& A, const Base<typename T1::elem_type,T2>& B) | |
22 { | |
23 arma_extra_debug_sigprint(); | |
24 | |
25 return Glue<T1, T2, glue_kron>(A.get_ref(), B.get_ref()); | |
26 } | |
27 | |
28 | |
29 | |
30 //! \brief | |
31 //! kronecker product of two matrices, | |
32 //! with the matrices having different element types | |
33 template<typename T, typename T1, typename T2> | |
34 inline | |
35 Mat<typename eT_promoter<T1,T2>::eT> | |
36 kron(const Base<std::complex<T>,T1>& X, const Base<T,T2>& Y) | |
37 { | |
38 arma_extra_debug_sigprint(); | |
39 | |
40 typedef typename std::complex<T> eT1; | |
41 | |
42 promote_type<eT1,T>::check(); | |
43 | |
44 const unwrap<T1> tmp1(X.get_ref()); | |
45 const unwrap<T2> tmp2(Y.get_ref()); | |
46 | |
47 const Mat<eT1>& A = tmp1.M; | |
48 const Mat<T >& B = tmp2.M; | |
49 | |
50 Mat<eT1> out; | |
51 | |
52 glue_kron::direct_kron(out, A, B); | |
53 | |
54 return out; | |
55 } | |
56 | |
57 | |
58 | |
59 //! \brief | |
60 //! kronecker product of two matrices, | |
61 //! with the matrices having different element types | |
62 template<typename T, typename T1, typename T2> | |
63 inline | |
64 Mat<typename eT_promoter<T1,T2>::eT> | |
65 kron(const Base<T,T1>& X, const Base<std::complex<T>,T2>& Y) | |
66 { | |
67 arma_extra_debug_sigprint(); | |
68 | |
69 typedef typename std::complex<T> eT2; | |
70 | |
71 promote_type<T,eT2>::check(); | |
72 | |
73 const unwrap<T1> tmp1(X.get_ref()); | |
74 const unwrap<T2> tmp2(Y.get_ref()); | |
75 | |
76 const Mat<T >& A = tmp1.M; | |
77 const Mat<eT2>& B = tmp2.M; | |
78 | |
79 Mat<eT2> out; | |
80 | |
81 glue_kron::direct_kron(out, A, B); | |
82 | |
83 return out; | |
84 } | |
85 | |
86 | |
87 | |
88 //! @} |