$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 00020 template<typename T1> 00021 arma_inline 00022 const BaseCube<typename T1::elem_type,T1>& 00023 operator+ 00024 ( 00025 const BaseCube<typename T1::elem_type,T1>& X 00026 ) 00027 { 00028 arma_extra_debug_sigprint(); 00029 00030 return X; 00031 } 00032 00033 00034 00036 template<typename T1> 00037 arma_inline 00038 const eOpCube<T1, eop_scalar_plus> 00039 operator+ 00040 ( 00041 const BaseCube<typename T1::elem_type,T1>& X, 00042 const typename T1::elem_type k 00043 ) 00044 { 00045 arma_extra_debug_sigprint(); 00046 00047 return eOpCube<T1, eop_scalar_plus>(X.get_ref(), k); 00048 } 00049 00050 00051 00053 template<typename T1> 00054 arma_inline 00055 const eOpCube<T1, eop_scalar_plus> 00056 operator+ 00057 ( 00058 const typename T1::elem_type k, 00059 const BaseCube<typename T1::elem_type,T1>& X 00060 ) 00061 { 00062 arma_extra_debug_sigprint(); 00063 00064 return eOpCube<T1, eop_scalar_plus>(X.get_ref(), k); 00065 } 00066 00067 00068 00070 template<typename T1> 00071 arma_inline 00072 const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_plus> 00073 operator+ 00074 ( 00075 const BaseCube<typename T1::pod_type, T1>& X, 00076 const std::complex<typename T1::pod_type>& k 00077 ) 00078 { 00079 arma_extra_debug_sigprint(); 00080 00081 return mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_plus>('j', X.get_ref(), k); 00082 } 00083 00084 00085 00087 template<typename T1> 00088 arma_inline 00089 const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_plus> 00090 operator+ 00091 ( 00092 const std::complex<typename T1::pod_type>& k, 00093 const BaseCube<typename T1::pod_type, T1>& X 00094 ) 00095 { 00096 arma_extra_debug_sigprint(); 00097 00098 return mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_plus>('j', X.get_ref(), k); // NOTE: order is swapped 00099 } 00100 00101 00102 00104 template<typename T1, typename T2> 00105 arma_inline 00106 const eGlueCube<T1, T2, eglue_plus> 00107 operator+ 00108 ( 00109 const BaseCube<typename T1::elem_type,T1>& X, 00110 const BaseCube<typename T1::elem_type,T2>& Y 00111 ) 00112 { 00113 arma_extra_debug_sigprint(); 00114 00115 return eGlueCube<T1, T2, eglue_plus>(X.get_ref(), Y.get_ref()); 00116 } 00117 00118 00119 00121 template<typename T1, typename T2> 00122 inline 00123 const mtGlueCube<typename promote_type<typename T1::elem_type, typename T2::elem_type>::result, T1, T2, glue_mixed_plus> 00124 operator+ 00125 ( 00126 const BaseCube< typename force_different_type<typename T1::elem_type, typename T2::elem_type>::T1_result, T1>& X, 00127 const BaseCube< typename force_different_type<typename T1::elem_type, typename T2::elem_type>::T2_result, T2>& Y 00128 ) 00129 { 00130 arma_extra_debug_sigprint(); 00131 00132 typedef typename T1::elem_type eT1; 00133 typedef typename T2::elem_type eT2; 00134 00135 typedef typename promote_type<eT1,eT2>::result out_eT; 00136 00137 promote_type<eT1,eT2>::check(); 00138 00139 return mtGlueCube<out_eT, T1, T2, glue_mixed_plus>( X.get_ref(), Y.get_ref() ); 00140 } 00141 00142 00143