op_scalar_misc_proto.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2009 NICTA
00002 // 
00003 // Authors:
00004 // - Conrad Sanderson (conradsand at ieee dot org)
00005 // 
00006 // This file is part of the Armadillo C++ library.
00007 // It is provided without any warranty of fitness
00008 // for any purpose. You can redistribute this file
00009 // and/or modify it under the terms of the GNU
00010 // Lesser General Public License (LGPL) as published
00011 // by the Free Software Foundation, either version 3
00012 // of the License or (at your option) any later version.
00013 // (see http://www.opensource.org/licenses for more info)
00014 
00015 
00016 
00017 //! \addtogroup op_scalar_misc
00018 //! @{
00019 
00020 
00021 //! 'add scalar to matrix' operation
00022 class op_scalar_plus
00023   {
00024   public:
00025   
00026   template<typename T1>
00027   inline static void apply(Mat<typename T1::elem_type>& out, const Op<T1,op_scalar_plus>& in);
00028   };
00029 
00030 
00031 
00032 //! 'subtract matrix from a scalar' operation
00033 class op_scalar_minus_pre
00034   {
00035   public:
00036   
00037   template<typename T1>
00038   inline static void apply(Mat<typename T1::elem_type>& out, const Op<T1,op_scalar_minus_pre>& in);
00039   };
00040 
00041 
00042 
00043 //! 'subtract scalar from matrix' operation
00044 class op_scalar_minus_post
00045   {
00046   public:
00047   
00048   template<typename T1>
00049   inline static void apply(Mat<typename T1::elem_type>& out, const Op<T1,op_scalar_minus_post>& in);
00050   };
00051 
00052 
00053 //! 'multiply matrix by a scalar' operation
00054 class op_scalar_times
00055   {
00056   public:
00057   
00058   template<typename T1>
00059   inline static void apply(Mat<typename T1::elem_type>& out, const Op<T1,op_scalar_times>& in);
00060   
00061   template<typename T1, typename T2, typename glue_type>
00062   inline static void apply(Mat<typename T1::elem_type>& out, const Op<Glue<T1,T2,glue_type>,  op_scalar_times>& in);
00063   
00064   template<typename T1, typename T2>
00065   inline static void apply(Mat<typename T1::elem_type>& out, const Op<Glue<T1,T2,glue_plus>,  op_scalar_times>& in);
00066   
00067   template<typename T1, typename T2>
00068   inline static void apply(Mat<typename T1::elem_type>& out, const Op<Glue<T1,T2,glue_minus>, op_scalar_times>& in);
00069   
00070   template<typename T1, typename T2>
00071   inline static void apply(Mat<typename T1::elem_type>& out, const Op<Glue<T1,T2,glue_schur>, op_scalar_times>& in);
00072   
00073   
00074   };
00075 
00076 
00077 
00078 //! 'divide scalar by a matrix' operation
00079 class op_scalar_div_pre
00080   {
00081   public:
00082   
00083   template<typename T1>
00084   inline static void apply(Mat<typename T1::elem_type>& out, const Op<T1,op_scalar_div_pre>& in);
00085   
00086   template<typename eT>
00087   inline static void apply(Mat<eT>& out, const Op<Mat<eT>,op_scalar_div_pre>& in);
00088   
00089   template<typename T1, typename T2, typename glue_type>
00090   inline static void apply(Mat<typename T1::elem_type>& out, const Op<Glue<T1,T2,glue_type>, op_scalar_div_pre>& in);
00091   
00092   template<typename T1, typename T2>
00093   inline static void apply(Mat<typename T1::elem_type>& out, const Op<Glue<T1,T2,glue_plus>,  op_scalar_div_pre>& in);
00094   
00095   template<typename T1, typename T2>
00096   inline static void apply(Mat<typename T1::elem_type>& out, const Op<Glue<T1,T2,glue_minus>, op_scalar_div_pre>& in);
00097   
00098   template<typename T1, typename T2>
00099   inline static void apply(Mat<typename T1::elem_type>& out, const Op<Glue<T1,T2,glue_schur>, op_scalar_div_pre>& in);
00100   
00101   };
00102 
00103 
00104 
00105 //! 'divide matrix by a scalar' operation
00106 class op_scalar_div_post
00107   {
00108   public:
00109   
00110   template<typename T1>
00111   inline static void apply(Mat<typename T1::elem_type>& out, const Op<T1,op_scalar_div_post>& in);
00112   
00113   template<typename eT>
00114   inline static void apply(Mat<eT>& out, const Op<Mat<eT>,op_scalar_div_post>& in);
00115   
00116   template<typename T1, typename T2, typename glue_type>
00117   inline static void apply(Mat<typename T1::elem_type>& out, const Op<Glue<T1,T2,glue_type>, op_scalar_div_post>& in);
00118   
00119   template<typename T1, typename T2>
00120   inline static void apply(Mat<typename T1::elem_type>& out, const Op<Glue<T1,T2,glue_plus>,  op_scalar_div_post>& in);
00121   
00122   template<typename T1, typename T2>
00123   inline static void apply(Mat<typename T1::elem_type>& out, const Op<Glue<T1,T2,glue_minus>, op_scalar_div_post>& in);
00124   
00125   template<typename T1, typename T2>
00126   inline static void apply(Mat<typename T1::elem_type>& out, const Op<Glue<T1,T2,glue_schur>, op_scalar_div_post>& in);
00127   
00128   };
00129 
00130 
00131 
00132 //! @}