operator_plus.hpp
Go to the documentation of this file.
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 Base<typename T1::elem_type,T1>&
00023 operator+
00024 (const Base<typename T1::elem_type,T1>& X)
00025   {
00026   arma_extra_debug_sigprint();
00027   
00028   return X;
00029   }
00030 
00031 
00032 
00034 template<typename T1>
00035 arma_inline
00036 const eOp<T1, eop_scalar_plus>
00037 operator+
00038 (const Base<typename T1::elem_type,T1>& X, const typename T1::elem_type k)
00039   {
00040   arma_extra_debug_sigprint();
00041   
00042   return eOp<T1, eop_scalar_plus>(X.get_ref(), k);
00043   }
00044 
00045 
00046 
00048 template<typename T1>
00049 arma_inline
00050 const eOp<T1, eop_scalar_plus>
00051 operator+
00052 (const typename T1::elem_type k, const Base<typename T1::elem_type,T1>& X)
00053   {
00054   arma_extra_debug_sigprint();
00055   
00056   return eOp<T1, eop_scalar_plus>(X.get_ref(), k);  // NOTE: order is swapped
00057   }
00058 
00059 
00060 
00062 template<typename T1>
00063 arma_inline
00064 const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_plus>
00065 operator+
00066   (
00067   const Base<typename T1::pod_type, T1>&     X,
00068   const std::complex<typename T1::pod_type>& k
00069   )
00070   {
00071   arma_extra_debug_sigprint();
00072   
00073   return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_plus>('j', X.get_ref(), k);
00074   }
00075 
00076 
00077 
00079 template<typename T1>
00080 arma_inline
00081 const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_plus>
00082 operator+
00083   (
00084   const std::complex<typename T1::pod_type>& k,
00085   const Base<typename T1::pod_type, T1>&     X
00086   )
00087   {
00088   arma_extra_debug_sigprint();
00089   
00090   return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_plus>('j', X.get_ref(), k);  // NOTE: order is swapped
00091   }
00092 
00093 
00094 
00096 template<typename T1, typename T2>
00097 arma_inline
00098 const eGlue<T1, T2, eglue_plus>
00099 operator+
00100   (
00101   const Base<typename T1::elem_type,T1>& X,
00102   const Base<typename T1::elem_type,T2>& Y
00103   )
00104   {
00105   arma_extra_debug_sigprint();
00106   
00107   return eGlue<T1, T2, eglue_plus>(X.get_ref(), Y.get_ref());
00108   }
00109 
00110 
00111 
00113 template<typename T1, typename T2>
00114 inline
00115 const mtGlue<typename promote_type<typename T1::elem_type, typename T2::elem_type>::result, T1, T2, glue_mixed_plus>
00116 operator+
00117   (
00118   const Base< typename force_different_type<typename T1::elem_type, typename T2::elem_type>::T1_result, T1>& X,
00119   const Base< typename force_different_type<typename T1::elem_type, typename T2::elem_type>::T2_result, T2>& Y
00120   )
00121   {
00122   arma_extra_debug_sigprint();
00123   
00124   typedef typename T1::elem_type eT1;
00125   typedef typename T2::elem_type eT2;
00126   
00127   typedef typename promote_type<eT1,eT2>::result out_eT;
00128   
00129   promote_type<eT1,eT2>::check();
00130   
00131   return mtGlue<out_eT, T1, T2, glue_mixed_plus>( X.get_ref(), Y.get_ref() );
00132   }
00133 
00134 
00135 


armadillo_matrix
Author(s): Conrad Sanderson - NICTA (www.nicta.com.au), (Wrapper by Sjoerd van den Dries)
autogenerated on Tue Jan 7 2014 11:42:05