max@0: // Copyright (C) 2009-2010 NICTA (www.nicta.com.au) max@0: // Copyright (C) 2009-2010 Conrad Sanderson max@0: // Copyright (C) 2009-2010 Dimitrios Bouzas max@0: // max@0: // This file is part of the Armadillo C++ library. max@0: // It is provided without any warranty of fitness max@0: // for any purpose. You can redistribute this file max@0: // and/or modify it under the terms of the GNU max@0: // Lesser General Public License (LGPL) as published max@0: // by the Free Software Foundation, either version 3 max@0: // of the License or (at your option) any later version. max@0: // (see http://www.opensource.org/licenses for more info) max@0: max@0: max@0: //! \addtogroup fn_kron max@0: //! @{ max@0: max@0: max@0: max@0: //! \brief max@0: //! kronecker product of two matrices, max@0: //! with the matrices having the same element type max@0: template max@0: arma_inline max@0: const Glue max@0: kron(const Base& A, const Base& B) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: return Glue(A.get_ref(), B.get_ref()); max@0: } max@0: max@0: max@0: max@0: //! \brief max@0: //! kronecker product of two matrices, max@0: //! with the matrices having different element types max@0: template max@0: inline max@0: Mat::eT> max@0: kron(const Base,T1>& X, const Base& Y) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: typedef typename std::complex eT1; max@0: max@0: promote_type::check(); max@0: max@0: const unwrap tmp1(X.get_ref()); max@0: const unwrap tmp2(Y.get_ref()); max@0: max@0: const Mat& A = tmp1.M; max@0: const Mat& B = tmp2.M; max@0: max@0: Mat out; max@0: max@0: glue_kron::direct_kron(out, A, B); max@0: max@0: return out; max@0: } max@0: max@0: max@0: max@0: //! \brief max@0: //! kronecker product of two matrices, max@0: //! with the matrices having different element types max@0: template max@0: inline max@0: Mat::eT> max@0: kron(const Base& X, const Base,T2>& Y) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: typedef typename std::complex eT2; max@0: max@0: promote_type::check(); max@0: max@0: const unwrap tmp1(X.get_ref()); max@0: const unwrap tmp2(Y.get_ref()); max@0: max@0: const Mat& A = tmp1.M; max@0: const Mat& B = tmp2.M; max@0: max@0: Mat out; max@0: max@0: glue_kron::direct_kron(out, A, B); max@0: max@0: return out; max@0: } max@0: max@0: max@0: max@0: //! @}