eop_core_proto.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2010 NICTA and the authors listed below
00002 // http://nicta.com.au
00003 // 
00004 // Authors:
00005 // - Conrad Sanderson (conradsand at ieee dot org)
00006 // 
00007 // This file is part of the Armadillo C++ library.
00008 // It is provided without any warranty of fitness
00009 // for any purpose. You can redistribute this file
00010 // and/or modify it under the terms of the GNU
00011 // Lesser General Public License (LGPL) as published
00012 // by the Free Software Foundation, either version 3
00013 // of the License or (at your option) any later version.
00014 // (see http://www.opensource.org/licenses for more info)
00015 
00016 
00017 //! \addtogroup eop_core
00018 //! @{
00019 
00020 
00021 
00022 template<typename eop_type>
00023 class eop_core
00024   {
00025   public:
00026   
00027   arma_inline static const char* error_msg() { return ""; }
00028   
00029   arma_inline static       bool size_ok(const u32 n_rows, const u32 n_cols) { return true; }
00030 
00031   
00032   template<typename T1> arma_hot arma_inline static typename T1::elem_type get_elem(const eOp<T1, eop_type>& x, const u32 i);
00033   template<typename T1> arma_hot arma_inline static typename T1::elem_type get_elem(const eOp<T1, eop_type>& x, const u32 row, const u32 col);
00034   
00035   template<typename T1> arma_hot arma_inline static typename T1::elem_type process(const eOp<T1, eop_type>& x, const typename T1::elem_type val);
00036 
00037   template<typename T1> arma_hot arma_inline static void apply(Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x);
00038   
00039   template<typename T1> arma_hot inline static void apply_proxy (Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x);
00040   template<typename T1> arma_hot inline static void apply_unwrap(Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x);
00041   
00042   template<typename T1> arma_hot inline static void apply_inplace_plus (Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x);
00043   template<typename T1> arma_hot inline static void apply_inplace_minus(Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x);
00044   template<typename T1> arma_hot inline static void apply_inplace_schur(Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x);
00045   template<typename T1> arma_hot inline static void apply_inplace_div  (Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x);
00046   
00047   };
00048 
00049 
00050 
00051 class eop_neg               : public eop_core<eop_neg>               {};
00052 class eop_scalar_plus       : public eop_core<eop_scalar_plus>       {};
00053 class eop_scalar_minus_pre  : public eop_core<eop_scalar_minus_pre>  {};
00054 class eop_scalar_minus_post : public eop_core<eop_scalar_minus_post> {};
00055 class eop_scalar_times      : public eop_core<eop_scalar_times>      {};
00056 class eop_scalar_div_pre    : public eop_core<eop_scalar_div_pre>    {};
00057 class eop_scalar_div_post   : public eop_core<eop_scalar_div_post>   {};
00058 class eop_square            : public eop_core<eop_square>            {};
00059 class eop_sqrt              : public eop_core<eop_sqrt>              {};
00060 class eop_log10             : public eop_core<eop_log10>             {};
00061 class eop_log               : public eop_core<eop_log>               {};
00062 class eop_trunc_log         : public eop_core<eop_trunc_log>         {};
00063 class eop_exp               : public eop_core<eop_exp>               {};
00064 class eop_trunc_exp         : public eop_core<eop_trunc_exp>         {};
00065 class eop_cos               : public eop_core<eop_cos>               {};
00066 class eop_sin               : public eop_core<eop_sin>               {};
00067 class eop_tan               : public eop_core<eop_tan>               {};
00068 class eop_acos              : public eop_core<eop_acos>              {};
00069 class eop_asin              : public eop_core<eop_asin>              {};
00070 class eop_atan              : public eop_core<eop_atan>              {};
00071 class eop_cosh              : public eop_core<eop_cosh>              {};
00072 class eop_sinh              : public eop_core<eop_sinh>              {};
00073 class eop_tanh              : public eop_core<eop_tanh>              {};
00074 class eop_acosh             : public eop_core<eop_acosh>             {};
00075 class eop_asinh             : public eop_core<eop_asinh>             {};
00076 class eop_atanh             : public eop_core<eop_atanh>             {};
00077 class eop_eps               : public eop_core<eop_eps>               {};
00078 class eop_abs               : public eop_core<eop_abs>               {};
00079 class eop_conj              : public eop_core<eop_conj>              {};
00080 class eop_pow               : public eop_core<eop_pow>               {};
00081 class eop_pow_int           : public eop_core<eop_pow_int>           {};
00082 
00083 class eop_ones_diag : public eop_core<eop_ones_diag>
00084   {
00085   public:
00086   
00087   arma_inline static const char* error_msg() { return "eye(): given size is not square"; }
00088   
00089   arma_inline static bool size_ok(const u32 n_rows, const u32 n_cols) { return (n_rows == n_cols); }
00090   };
00091 
00092 
00093 class eop_ones_full : public eop_core<eop_ones_full>{};
00094 class eop_randu     : public eop_core<eop_randu>    {};
00095 class eop_randn     : public eop_core<eop_randn>    {};
00096 class eop_zeros     : public eop_core<eop_zeros>    {};
00097 
00098 template<typename T1> struct is_generator                { static const bool value = false; };
00099 template<>            struct is_generator<eop_ones_full> { static const bool value = true;  };
00100 template<>            struct is_generator<eop_randu>     { static const bool value = true;  };
00101 template<>            struct is_generator<eop_randn>     { static const bool value = true;  };
00102 template<>            struct is_generator<eop_zeros>     { static const bool value = true;  };
00103 
00104 
00105 
00106 //! @}