max@0: // Copyright (C) 2008-2010 NICTA (www.nicta.com.au) max@0: // Copyright (C) 2008-2010 Conrad Sanderson 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 glue_times max@0: //! @{ max@0: max@0: max@0: max@0: //! \brief max@0: //! Template metaprogram depth_lhs max@0: //! calculates the number of Glue instances on the left hand side argument of Glue max@0: //! i.e. it recursively expands each Tx, until the type of Tx is not "Glue<..,.., glue_type>" (i.e the "glue_type" changes) max@0: max@0: template max@0: struct depth_lhs max@0: { max@0: static const uword num = 0; max@0: }; max@0: max@0: template max@0: struct depth_lhs< glue_type, Glue > max@0: { max@0: static const uword num = 1 + depth_lhs::num; max@0: }; max@0: max@0: max@0: max@0: template max@0: struct glue_times_redirect max@0: { max@0: template max@0: inline static void apply(Mat& out, const Glue& X); max@0: }; max@0: max@0: max@0: template<> max@0: struct glue_times_redirect<3> max@0: { max@0: template max@0: inline static void apply(Mat& out, const Glue< Glue,T3,glue_times>& X); max@0: }; max@0: max@0: max@0: template<> max@0: struct glue_times_redirect<4> max@0: { max@0: template max@0: inline static void apply(Mat& out, const Glue< Glue< Glue, T3, glue_times>, T4, glue_times>& X); max@0: }; max@0: max@0: max@0: max@0: //! Class which implements the immediate multiplication of two or more matrices max@0: class glue_times max@0: { max@0: public: max@0: max@0: max@0: template max@0: inline static void apply(Mat& out, const Glue& X); max@0: max@0: max@0: template max@0: inline static void apply_inplace(Mat& out, const T1& X); max@0: max@0: template max@0: arma_hot inline static void apply_inplace_plus(Mat& out, const Glue& X, const sword sign); max@0: max@0: template max@0: inline static void apply_mixed(Mat::result>& out, const Mat& X, const Mat& Y); max@0: max@0: max@0: template max@0: arma_inline static uword mul_storage_cost(const Mat& A, const Mat& B, const bool do_trans_A, const bool do_trans_B); max@0: max@0: template max@0: arma_hot inline static void apply(Mat& out, const Mat& A, const Mat& B, const eT val, const bool do_trans_A, const bool do_trans_B, const bool do_scalar_times); max@0: max@0: template max@0: inline static void apply(Mat& out, const Mat& A, const Mat& B, const Mat& C, const eT val, const bool do_trans_A, const bool do_trans_B, const bool do_trans_C, const bool do_scalar_times); max@0: max@0: template max@0: inline static void apply(Mat& out, const Mat& A, const Mat& B, const Mat& C, const Mat& D, const eT val, const bool do_trans_A, const bool do_trans_B, const bool do_trans_C, const bool do_trans_D, const bool do_scalar_times); max@0: max@0: }; max@0: max@0: max@0: max@0: class glue_times_diag max@0: { max@0: public: max@0: max@0: template max@0: arma_hot inline static void apply(Mat& out, const Glue& X); max@0: max@0: }; max@0: max@0: max@0: max@0: //! @} max@0: