| eop_core_proto.hpp | | eop_core_proto.hpp | |
| | | | |
| skipping to change at line 26 | | skipping to change at line 26 | |
| //! \addtogroup eop_core | | //! \addtogroup eop_core | |
| //! @{ | | //! @{ | |
| | | | |
| template<typename eop_type> | | template<typename eop_type> | |
| class eop_core | | class eop_core | |
| { | | { | |
| public: | | public: | |
| | | | |
| arma_inline static const char* error_msg() { return ""; } | | arma_inline static const char* error_msg() { return ""; } | |
| | | | |
|
| arma_inline static const bool size_ok(const u32 n_rows, const u32 n_cols)
{ return true; } | | arma_inline static bool size_ok(const u32 n_rows, const u32 n_cols)
{ return true; } | |
| | | | |
| template<typename T1> arma_hot arma_inline static typename T1::elem_type
get_elem(const eOp<T1, eop_type>& x, const u32 i); | | template<typename T1> arma_hot arma_inline static typename T1::elem_type
get_elem(const eOp<T1, eop_type>& x, const u32 i); | |
| 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); | | 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); | |
| | | | |
| 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); | | 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); | |
| | | | |
| template<typename T1> arma_hot arma_inline static void apply(Mat<typename
T1::elem_type>& out, const eOp<T1, eop_type>& x); | | template<typename T1> arma_hot arma_inline static void apply(Mat<typename
T1::elem_type>& out, const eOp<T1, eop_type>& x); | |
| | | | |
| template<typename T1> arma_hot inline static void apply_proxy (Mat<typena
me T1::elem_type>& out, const eOp<T1, eop_type>& x); | | template<typename T1> arma_hot inline static void apply_proxy (Mat<typena
me T1::elem_type>& out, const eOp<T1, eop_type>& x); | |
| template<typename T1> arma_hot inline static void apply_unwrap(Mat<typena
me T1::elem_type>& out, const eOp<T1, eop_type>& x); | | template<typename T1> arma_hot inline static void apply_unwrap(Mat<typena
me T1::elem_type>& out, const eOp<T1, eop_type>& x); | |
| | | | |
| skipping to change at line 83 | | skipping to change at line 83 | |
| class eop_conj : public eop_core<eop_conj> {}; | | class eop_conj : public eop_core<eop_conj> {}; | |
| class eop_pow : public eop_core<eop_pow> {}; | | class eop_pow : public eop_core<eop_pow> {}; | |
| class eop_pow_int : public eop_core<eop_pow_int> {}; | | class eop_pow_int : public eop_core<eop_pow_int> {}; | |
| | | | |
| class eop_ones_diag : public eop_core<eop_ones_diag> | | class eop_ones_diag : public eop_core<eop_ones_diag> | |
| { | | { | |
| public: | | public: | |
| | | | |
| arma_inline static const char* error_msg() { return "eye(): given size is
not square"; } | | arma_inline static const char* error_msg() { return "eye(): given size is
not square"; } | |
| | | | |
|
| arma_inline static const bool size_ok(const u32 n_rows, const u32 n_cols)
{ return (n_rows == n_cols); } | | arma_inline static bool size_ok(const u32 n_rows, const u32 n_cols) { ret
urn (n_rows == n_cols); } | |
| }; | | }; | |
| | | | |
| class eop_ones_full : public eop_core<eop_ones_full>{}; | | class eop_ones_full : public eop_core<eop_ones_full>{}; | |
| class eop_randu : public eop_core<eop_randu> {}; | | class eop_randu : public eop_core<eop_randu> {}; | |
| class eop_randn : public eop_core<eop_randn> {}; | | class eop_randn : public eop_core<eop_randn> {}; | |
| class eop_zeros : public eop_core<eop_zeros> {}; | | class eop_zeros : public eop_core<eop_zeros> {}; | |
| | | | |
| template<typename T1> struct is_generator { static const boo
l value = false; }; | | template<typename T1> struct is_generator { static const boo
l value = false; }; | |
| template<> struct is_generator<eop_ones_full> { static const boo
l value = true; }; | | template<> struct is_generator<eop_ones_full> { static const boo
l value = true; }; | |
| template<> struct is_generator<eop_randu> { static const boo
l value = true; }; | | template<> struct is_generator<eop_randu> { static const boo
l value = true; }; | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 2 lines changed or added | |
|
| upgrade_val.hpp | | upgrade_val.hpp | |
| | | | |
| skipping to change at line 30 | | skipping to change at line 30 | |
| //! values are upgraded only where necessary. | | //! values are upgraded only where necessary. | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| struct upgrade_val | | struct upgrade_val | |
| { | | { | |
| typedef typename promote_type<T1,T2>::result T1_result; | | typedef typename promote_type<T1,T2>::result T1_result; | |
| typedef typename promote_type<T1,T2>::result T2_result; | | typedef typename promote_type<T1,T2>::result T2_result; | |
| | | | |
| arma_inline | | arma_inline | |
| static | | static | |
|
| const typename promote_type<T1,T2>::result | | typename promote_type<T1,T2>::result | |
| apply(const T1 x) | | apply(const T1 x) | |
| { | | { | |
| typedef typename promote_type<T1,T2>::result out_type; | | typedef typename promote_type<T1,T2>::result out_type; | |
| return out_type(x); | | return out_type(x); | |
| } | | } | |
| | | | |
| arma_inline | | arma_inline | |
| static | | static | |
|
| const typename promote_type<T1,T2>::result | | typename promote_type<T1,T2>::result | |
| apply(const T2 x) | | apply(const T2 x) | |
| { | | { | |
| typedef typename promote_type<T1,T2>::result out_type; | | typedef typename promote_type<T1,T2>::result out_type; | |
| return out_type(x); | | return out_type(x); | |
| } | | } | |
| | | | |
| }; | | }; | |
| | | | |
| // template<> | | // template<> | |
| template<typename T> | | template<typename T> | |
| | | | |
| skipping to change at line 68 | | skipping to change at line 68 | |
| //! upgrade a type to allow multiplication with a complex type | | //! upgrade a type to allow multiplication with a complex type | |
| //! e.g. the int in "int * complex<double>" is upgraded to a double | | //! e.g. the int in "int * complex<double>" is upgraded to a double | |
| // template<> | | // template<> | |
| template<typename T, typename T2> | | template<typename T, typename T2> | |
| struct upgrade_val< std::complex<T>, T2 > | | struct upgrade_val< std::complex<T>, T2 > | |
| { | | { | |
| typedef std::complex<T> T1_result; | | typedef std::complex<T> T1_result; | |
| typedef T T2_result; | | typedef T T2_result; | |
| | | | |
| arma_inline static const std::complex<T>& apply(const std::complex<T>& x)
{ return x; } | | arma_inline static const std::complex<T>& apply(const std::complex<T>& x)
{ return x; } | |
|
| arma_inline static const T apply(const T2 x)
{ return T(x); } | | arma_inline static T apply(const T2 x)
{ return T(x); } | |
| }; | | }; | |
| | | | |
| // template<> | | // template<> | |
| template<typename T1, typename T> | | template<typename T1, typename T> | |
| struct upgrade_val< T1, std::complex<T> > | | struct upgrade_val< T1, std::complex<T> > | |
| { | | { | |
| typedef T T1_result; | | typedef T T1_result; | |
| typedef std::complex<T> T2_result; | | typedef std::complex<T> T2_result; | |
| | | | |
|
| arma_inline static const T apply(const T1 x)
{ return T(x); } | | arma_inline static T apply(const T1 x)
{ return T(x); } | |
| arma_inline static const std::complex<T>& apply(const std::complex<T>& x)
{ return x; } | | arma_inline static const std::complex<T>& apply(const std::complex<T>& x)
{ return x; } | |
| }; | | }; | |
| | | | |
| //! ensure we don't lose precision when multiplying a complex number with a
higher precision real number | | //! ensure we don't lose precision when multiplying a complex number with a
higher precision real number | |
| template<> | | template<> | |
| struct upgrade_val< std::complex<float>, double > | | struct upgrade_val< std::complex<float>, double > | |
| { | | { | |
| typedef std::complex<double> T1_result; | | typedef std::complex<double> T1_result; | |
| typedef double T2_result; | | typedef double T2_result; | |
| | | | |
| arma_inline static const std::complex<double> apply(const std::complex<fl
oat>& x) { return std::complex<double>(x); } | | arma_inline static const std::complex<double> apply(const std::complex<fl
oat>& x) { return std::complex<double>(x); } | |
|
| arma_inline static const double apply(const double x)
{ return x; } | | arma_inline static double apply(const double x)
{ return x; } | |
| }; | | }; | |
| | | | |
| template<> | | template<> | |
| struct upgrade_val< double, std::complex<float> > | | struct upgrade_val< double, std::complex<float> > | |
| { | | { | |
| typedef double T1_result; | | typedef double T1_result; | |
| typedef std::complex<float> T2_result; | | typedef std::complex<float> T2_result; | |
| | | | |
|
| arma_inline static const double apply(const double x)
{ return x; } | | arma_inline static double apply(const double x)
{ return x; } | |
| arma_inline static const std::complex<double> apply(const std::complex<fl
oat>& x) { return std::complex<double>(x); } | | arma_inline static const std::complex<double> apply(const std::complex<fl
oat>& x) { return std::complex<double>(x); } | |
| }; | | }; | |
| | | | |
| //! ensure we don't lose precision when multiplying complex numbers with di
fferent underlying types | | //! ensure we don't lose precision when multiplying complex numbers with di
fferent underlying types | |
| template<> | | template<> | |
| struct upgrade_val< std::complex<float>, std::complex<double> > | | struct upgrade_val< std::complex<float>, std::complex<double> > | |
| { | | { | |
| typedef std::complex<double> T1_result; | | typedef std::complex<double> T1_result; | |
| typedef std::complex<double> T2_result; | | typedef std::complex<double> T2_result; | |
| | | | |
| | | | |
| skipping to change at line 132 | | skipping to change at line 132 | |
| }; | | }; | |
| | | | |
| //! work around limitations in the complex class (at least as present in gc
c 4.1 & 4.3) | | //! work around limitations in the complex class (at least as present in gc
c 4.1 & 4.3) | |
| template<> | | template<> | |
| struct upgrade_val< std::complex<double>, float > | | struct upgrade_val< std::complex<double>, float > | |
| { | | { | |
| typedef std::complex<double> T1_result; | | typedef std::complex<double> T1_result; | |
| typedef double T2_result; | | typedef double T2_result; | |
| | | | |
| arma_inline static const std::complex<double>& apply(const std::complex<d
ouble>& x) { return x; } | | arma_inline static const std::complex<double>& apply(const std::complex<d
ouble>& x) { return x; } | |
|
| arma_inline static const double apply(const float x)
{ return double(x); } | | arma_inline static double apply(const float x)
{ return double(x); } | |
| }; | | }; | |
| | | | |
| template<> | | template<> | |
| struct upgrade_val< float, std::complex<double> > | | struct upgrade_val< float, std::complex<double> > | |
| { | | { | |
| typedef double T1_result; | | typedef double T1_result; | |
| typedef std::complex<double> T2_result; | | typedef std::complex<double> T2_result; | |
| | | | |
|
| arma_inline static const double apply(const float x)
{ return double(x); } | | arma_inline static double apply(const float x)
{ return double(x); } | |
| arma_inline static const std::complex<double>& apply(const std::complex<d
ouble>& x) { return x; } | | arma_inline static const std::complex<double>& apply(const std::complex<d
ouble>& x) { return x; } | |
| }; | | }; | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 8 change blocks. |
| 8 lines changed or deleted | | 8 lines changed or added | |
|