$search
00001 // Copyright (C) 2008-2010 NICTA (www.nicta.com.au) 00002 // Copyright (C) 2008-2010 Conrad Sanderson 00003 // 00004 // This file is part of the Armadillo C++ library. 00005 // It is provided without any warranty of fitness 00006 // for any purpose. You can redistribute this file 00007 // and/or modify it under the terms of the GNU 00008 // Lesser General Public License (LGPL) as published 00009 // by the Free Software Foundation, either version 3 00010 // of the License or (at your option) any later version. 00011 // (see http://www.opensource.org/licenses for more info) 00012 00013 00016 00017 00018 00023 00024 template<typename glue_type, typename T1> 00025 struct depth_lhs 00026 { 00027 static const uword num = 0; 00028 }; 00029 00030 template<typename glue_type, typename T1, typename T2> 00031 struct depth_lhs< glue_type, Glue<T1,T2,glue_type> > 00032 { 00033 static const uword num = 1 + depth_lhs<glue_type, T1>::num; 00034 }; 00035 00036 00037 00038 template<uword N> 00039 struct glue_times_redirect 00040 { 00041 template<typename T1, typename T2> 00042 inline static void apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glue_times>& X); 00043 }; 00044 00045 00046 template<> 00047 struct glue_times_redirect<3> 00048 { 00049 template<typename T1, typename T2, typename T3> 00050 inline static void apply(Mat<typename T1::elem_type>& out, const Glue< Glue<T1,T2,glue_times>,T3,glue_times>& X); 00051 }; 00052 00053 00054 template<> 00055 struct glue_times_redirect<4> 00056 { 00057 template<typename T1, typename T2, typename T3, typename T4> 00058 inline static void apply(Mat<typename T1::elem_type>& out, const Glue< Glue< Glue<T1,T2,glue_times>, T3, glue_times>, T4, glue_times>& X); 00059 }; 00060 00061 00062 00064 class glue_times 00065 { 00066 public: 00067 00068 00069 template<typename T1, typename T2> 00070 inline static void apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glue_times>& X); 00071 00072 00073 template<typename T1> 00074 inline static void apply_inplace(Mat<typename T1::elem_type>& out, const T1& X); 00075 00076 template<typename T1, typename T2> 00077 arma_hot inline static void apply_inplace_plus(Mat<typename T1::elem_type>& out, const Glue<T1, T2, glue_times>& X, const sword sign); 00078 00079 template<typename eT1, typename eT2> 00080 inline static void apply_mixed(Mat<typename promote_type<eT1,eT2>::result>& out, const Mat<eT1>& X, const Mat<eT2>& Y); 00081 00082 00083 template<typename eT> 00084 arma_inline static uword mul_storage_cost(const Mat<eT>& A, const Mat<eT>& B, const bool do_trans_A, const bool do_trans_B); 00085 00086 template<typename eT> 00087 arma_hot inline static void apply(Mat<eT>& out, const Mat<eT>& A, const Mat<eT>& B, const eT val, const bool do_trans_A, const bool do_trans_B, const bool do_scalar_times); 00088 00089 template<typename eT> 00090 inline static void apply(Mat<eT>& out, const Mat<eT>& A, const Mat<eT>& B, const Mat<eT>& C, const eT val, const bool do_trans_A, const bool do_trans_B, const bool do_trans_C, const bool do_scalar_times); 00091 00092 template<typename eT> 00093 inline static void apply(Mat<eT>& out, const Mat<eT>& A, const Mat<eT>& B, const Mat<eT>& C, const Mat<eT>& 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); 00094 00095 }; 00096 00097 00098 00099 class glue_times_diag 00100 { 00101 public: 00102 00103 template<typename T1, typename T2> 00104 arma_hot inline static void apply(Mat<typename T1::elem_type>& out, const Glue<T1, T2, glue_times_diag>& X); 00105 00106 }; 00107 00108 00109 00111