$search
00001 // Copyright (C) 2009-2010 NICTA (www.nicta.com.au) 00002 // Copyright (C) 2009-2010 Conrad Sanderson 00003 // Copyright (C) 2009-2010 Dimitrios Bouzas 00004 // 00005 // This file is part of the Armadillo C++ library. 00006 // It is provided without any warranty of fitness 00007 // for any purpose. You can redistribute this file 00008 // and/or modify it under the terms of the GNU 00009 // Lesser General Public License (LGPL) as published 00010 // by the Free Software Foundation, either version 3 00011 // of the License or (at your option) any later version. 00012 // (see http://www.opensource.org/licenses for more info) 00013 00014 00017 00018 00019 00023 template<typename T1, typename T2> 00024 arma_inline 00025 const Glue<T1,T2,glue_kron> 00026 kron(const Base<typename T1::elem_type,T1>& A, const Base<typename T1::elem_type,T2>& B) 00027 { 00028 arma_extra_debug_sigprint(); 00029 00030 return Glue<T1, T2, glue_kron>(A.get_ref(), B.get_ref()); 00031 } 00032 00033 00034 00038 template<typename T, typename T1, typename T2> 00039 inline 00040 Mat<typename eT_promoter<T1,T2>::eT> 00041 kron(const Base<std::complex<T>,T1>& X, const Base<T,T2>& Y) 00042 { 00043 arma_extra_debug_sigprint(); 00044 00045 typedef typename std::complex<T> eT1; 00046 00047 promote_type<eT1,T>::check(); 00048 00049 const unwrap<T1> tmp1(X.get_ref()); 00050 const unwrap<T2> tmp2(Y.get_ref()); 00051 00052 const Mat<eT1>& A = tmp1.M; 00053 const Mat<T >& B = tmp2.M; 00054 00055 Mat<eT1> out; 00056 00057 glue_kron::direct_kron(out, A, B); 00058 00059 return out; 00060 } 00061 00062 00063 00067 template<typename T, typename T1, typename T2> 00068 inline 00069 Mat<typename eT_promoter<T1,T2>::eT> 00070 kron(const Base<T,T1>& X, const Base<std::complex<T>,T2>& Y) 00071 { 00072 arma_extra_debug_sigprint(); 00073 00074 typedef typename std::complex<T> eT2; 00075 00076 promote_type<T,eT2>::check(); 00077 00078 const unwrap<T1> tmp1(X.get_ref()); 00079 const unwrap<T2> tmp2(Y.get_ref()); 00080 00081 const Mat<T >& A = tmp1.M; 00082 const Mat<eT2>& B = tmp2.M; 00083 00084 Mat<eT2> out; 00085 00086 glue_kron::direct_kron(out, A, B); 00087 00088 return out; 00089 } 00090 00091 00092