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 a matrix/cube' operation
00022 class op_scalar_plus
00023   {
00024   public:
00025   
00026   template<typename T1> inline static void apply( Mat<typename T1::elem_type>& out, const     Op<T1,op_scalar_plus>& in);
00027   template<typename T1> inline static void apply(Cube<typename T1::elem_type>& out, const OpCube<T1,op_scalar_plus>& in);
00028   };
00029 
00030 
00031 
00032 //! 'subtract matrix/cube from a scalar' operation
00033 class op_scalar_minus_pre
00034   {
00035   public:
00036   
00037   template<typename T1> inline static void apply( Mat<typename T1::elem_type>& out, const     Op<T1,op_scalar_minus_pre>& in);
00038   template<typename T1> inline static void apply(Cube<typename T1::elem_type>& out, const OpCube<T1,op_scalar_minus_pre>& in);
00039   };
00040 
00041 
00042 
00043 //! 'subtract scalar from a matrix/cube' operation
00044 class op_scalar_minus_post
00045   {
00046   public:
00047   
00048   template<typename T1> inline static void apply( Mat<typename T1::elem_type>& out, const     Op<T1,op_scalar_minus_post>& in);
00049   template<typename T1> inline static void apply(Cube<typename T1::elem_type>& out, const OpCube<T1,op_scalar_minus_post>& in);
00050   };
00051 
00052 
00053 //! 'multiply matrix/cube by a scalar' operation
00054 class op_scalar_times
00055   {
00056   public:
00057   
00058   template<typename T1> inline static void apply( Mat<typename T1::elem_type>& out, const     Op<T1,op_scalar_times>& in);
00059   template<typename T1> inline static void apply(Cube<typename T1::elem_type>& out, const OpCube<T1,op_scalar_times>& in);
00060   
00061   #if defined(ARMA_GOOD_COMPILER)
00062   
00063   template<typename T1, typename T2> inline static void apply( Mat<typename T1::elem_type>& out, const     Op<    Glue<T1,T2,     glue_plus>,  op_scalar_times>& in);
00064   template<typename T1, typename T2> inline static void apply(Cube<typename T1::elem_type>& out, const OpCube<GlueCube<T1,T2,glue_cube_plus>,  op_scalar_times>& in);
00065   
00066   template<typename T1, typename T2> inline static void apply( Mat<typename T1::elem_type>& out, const     Op<    Glue<T1,T2,     glue_minus>, op_scalar_times>& in);
00067   template<typename T1, typename T2> inline static void apply(Cube<typename T1::elem_type>& out, const OpCube<GlueCube<T1,T2,glue_cube_minus>, op_scalar_times>& in);
00068   
00069   template<typename T1, typename T2> inline static void apply( Mat<typename T1::elem_type>& out, const     Op<    Glue<T1,T2,     glue_schur>, op_scalar_times>& in);
00070   template<typename T1, typename T2> inline static void apply(Cube<typename T1::elem_type>& out, const OpCube<GlueCube<T1,T2,glue_cube_schur>, op_scalar_times>& in);
00071   
00072   #endif
00073   };
00074 
00075 
00076 
00077 //! 'divide scalar by a matrix/cube' operation
00078 class op_scalar_div_pre
00079   {
00080   public:
00081   
00082   template<typename T1> inline static void apply( Mat<typename T1::elem_type>& out, const     Op<T1,op_scalar_div_pre>& in);
00083   template<typename T1> inline static void apply(Cube<typename T1::elem_type>& out, const OpCube<T1,op_scalar_div_pre>& in);
00084   
00085   #if defined(ARMA_GOOD_COMPILER)
00086 
00087   template<typename T1, typename T2> inline static void apply( Mat<typename T1::elem_type>& out, const     Op<    Glue<T1,T2,     glue_plus>,  op_scalar_div_pre>& in);
00088   template<typename T1, typename T2> inline static void apply(Cube<typename T1::elem_type>& out, const OpCube<GlueCube<T1,T2,glue_cube_plus>,  op_scalar_div_pre>& in);
00089   
00090   template<typename T1, typename T2> inline static void apply( Mat<typename T1::elem_type>& out, const     Op<    Glue<T1,T2,     glue_minus>, op_scalar_div_pre>& in);
00091   template<typename T1, typename T2> inline static void apply(Cube<typename T1::elem_type>& out, const OpCube<GlueCube<T1,T2,glue_cube_minus>, op_scalar_div_pre>& in);
00092   
00093   template<typename T1, typename T2> inline static void apply( Mat<typename T1::elem_type>& out, const     Op<    Glue<T1,T2,     glue_schur>, op_scalar_div_pre>& in);
00094   template<typename T1, typename T2> inline static void apply(Cube<typename T1::elem_type>& out, const OpCube<GlueCube<T1,T2,glue_cube_schur>, op_scalar_div_pre>& in);
00095 
00096   #endif
00097   };
00098 
00099 
00100 
00101 //! 'divide matrix/cube by a scalar' operation
00102 class op_scalar_div_post
00103   {
00104   public:
00105   
00106   template<typename T1> inline static void apply( Mat<typename T1::elem_type>& out, const     Op<T1,op_scalar_div_post>& in);
00107   template<typename T1> inline static void apply(Cube<typename T1::elem_type>& out, const OpCube<T1,op_scalar_div_post>& in);
00108   
00109   
00110   #if defined(ARMA_GOOD_COMPILER)
00111   
00112   template<typename T1, typename T2> inline static void apply( Mat<typename T1::elem_type>& out, const     Op<    Glue<T1,T2,     glue_plus>,  op_scalar_div_post>& in);
00113   template<typename T1, typename T2> inline static void apply(Cube<typename T1::elem_type>& out, const OpCube<GlueCube<T1,T2,glue_cube_plus>,  op_scalar_div_post>& in);
00114   
00115   template<typename T1, typename T2> inline static void apply( Mat<typename T1::elem_type>& out, const     Op<    Glue<T1,T2,     glue_minus>, op_scalar_div_post>& in);
00116   template<typename T1, typename T2> inline static void apply(Cube<typename T1::elem_type>& out, const OpCube<GlueCube<T1,T2,glue_cube_minus>, op_scalar_div_post>& in);
00117   
00118   template<typename T1, typename T2> inline static void apply( Mat<typename T1::elem_type>& out, const     Op<    Glue<T1,T2,     glue_schur>, op_scalar_div_post>& in);
00119   template<typename T1, typename T2> inline static void apply(Cube<typename T1::elem_type>& out, const OpCube<GlueCube<T1,T2,glue_cube_schur>, op_scalar_div_post>& in);
00120   
00121   #endif
00122   };
00123 
00124 
00125 
00126 //! @}