00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MY_EXPRESSION_HPP
00020 #define MY_EXPRESSION_HPP
00021
00022 #include <boost/numeric/ublas/expression_types.hpp>
00023 #include <boost/numeric/ublas/functional.hpp>
00024
00025 namespace boost { namespace numeric { namespace ublas {
00026
00027
00028 template<class OP, class E>
00029 BOOST_UBLAS_INLINE
00030 typename vector_unary_traits<E, OP>::result_type
00031 apply_to_all (const vector_expression<E> &e, const OP& op = OP() ) {
00032 typedef typename vector_unary_traits<E, OP>::expression_type expression_type;
00033 return expression_type (e ());
00034 };
00035
00036
00037 template<class OP, class E>
00038 BOOST_UBLAS_INLINE
00039 typename matrix_unary1_traits<E, OP>::result_type
00040 apply_to_all (const matrix_expression<E> &e, const OP& op = OP() ) {
00041 typedef typename matrix_unary1_traits<E, OP>::expression_type expression_type;
00042 return expression_type (e ());
00043 };
00044
00045 }}}
00046
00047 namespace boost { namespace numeric { namespace ublas {
00048 template<class T>
00049 struct scalar_exp:
00050 public scalar_real_unary_functor<T> {
00051 typedef typename scalar_real_unary_functor<T>::value_type value_type;
00052 typedef typename scalar_real_unary_functor<T>::argument_type argument_type;
00053 typedef typename scalar_real_unary_functor<T>::result_type result_type;
00054
00055 static BOOST_UBLAS_INLINE
00056 result_type apply (argument_type t) {
00057 return std::exp(t);
00058 }
00059 };
00060
00061 }}}
00062
00063 #endif