00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef MTL_VEC_VEC_OP_EXPR_INCLUDE
00016 #define MTL_VEC_VEC_OP_EXPR_INCLUDE
00017
00018 #include <boost/numeric/mtl/vector/vec_expr.hpp>
00019
00020 namespace mtl { namespace vector {
00021
00022
00023 template <typename E1, typename E2, typename SFunctor>
00024 struct vec_vec_op_expr
00025 : public vec_expr< vec_vec_op_expr<E1, E2, SFunctor> >
00026 {
00027 typedef vec_expr< vec_vec_op_expr<E1, E2, SFunctor> > expr_base;
00028 typedef vec_vec_op_expr self;
00029
00030
00031
00032
00033 typedef typename SFunctor::result_type value_type;
00034
00035
00036 typedef typename E1::size_type size_type;
00037
00038
00039 typedef value_type const_dereference_type ;
00040
00041 typedef E1 first_argument_type ;
00042 typedef E2 second_argument_type ;
00043
00044 public:
00045 vec_vec_op_expr( first_argument_type const& v1, second_argument_type const& v2 )
00046 : first( v1 ), second( v2 )
00047 {
00048 std::cerr << "vec_vec_op_expr.vec_vec_op_expr() " << first.size() << " " << second.size() << "\n";
00049
00050 first.delay_assign();
00051 second.delay_assign();
00052 }
00053
00054 void delay_assign() const {}
00055
00056 size_type size() const
00057 {
00058 std::cerr << "vec_vec_op_expr.size() " << first.size() << " " << second.size() << "\n";
00059 assert( first.size() == second.size() ) ;
00060 return first.size() ;
00061 }
00062
00063 const_dereference_type operator() ( size_type i ) const
00064 {
00065 return SFunctor::apply( first( i ), second( i ) ) ;
00066
00067 }
00068
00069 const_dereference_type operator[] ( size_type i ) const
00070 {
00071 return SFunctor::apply( first( i ), second( i ) ) ;
00072
00073 }
00074
00075 private:
00076 first_argument_type const& first ;
00077 second_argument_type const& second ;
00078 } ;
00079
00080
00081
00082 } }
00083
00084
00085 #endif
00086