Index: matrix_expression.hpp =================================================================== --- matrix_expression.hpp (revision 3489) +++ matrix_expression.hpp (working copy) @@ -14,6 +14,9 @@ #define _BOOST_UBLAS_MATRIX_EXPRESSION_ #include +//JP ADDED +#include +#include // Expression templates based on ideas of Todd Veldhuizen and Geoffrey Furnish // Iterators based on ideas of Jeremy Siek @@ -2940,7 +2943,7 @@ // (t * m) [i] [j] = t * m [i] [j] template BOOST_UBLAS_INLINE - typename matrix_binary_scalar1_traits >::result_type + typename matrix_binary_scalar1_traits::value, T1>::type, E2, scalar_multiplies >::result_type operator * (const T1 &e1, const matrix_expression &e2) { typedef typename matrix_binary_scalar1_traits >::expression_type expression_type; @@ -3373,7 +3376,7 @@ // (m * t) [i] [j] = m [i] [j] * t template BOOST_UBLAS_INLINE - typename matrix_binary_scalar2_traits >::result_type + typename matrix_binary_scalar2_traits::value, T2>::type, scalar_multiplies >::result_type operator * (const matrix_expression &e1, const T2 &e2) { typedef typename matrix_binary_scalar2_traits >::expression_type expression_type; @@ -3721,8 +3724,19 @@ return prod (e1, e2, storage_category (), orientation_category ()); } + + //Operator * for matrices JP MODIFIED. template BOOST_UBLAS_INLINE + typename matrix_vector_binary1_traits::result_type + operator * (const matrix_expression &e1, const vector_expression &e2) { + //Forward to the prod implementation. + return prod(e1, e2); + } + + template + BOOST_UBLAS_INLINE typename matrix_vector_binary1_traits::precision_type, E1, typename type_traits::precision_type, E2>::result_type prec_prod (const matrix_expression &e1, @@ -4110,6 +4124,15 @@ typename E2::value_type, E2>::orientation_category orientation_category; return prod (e1, e2, storage_category (), orientation_category ()); } + //Operator * for matrices JP MODIFIED. + template + BOOST_UBLAS_INLINE + typename matrix_vector_binary2_traits::result_type + operator * (const vector_expression &e1, + const matrix_expression &e2) { + return prod(e1, e2); + } template BOOST_UBLAS_INLINE @@ -4816,8 +4839,18 @@ return prod (e1, e2, storage_category (), orientation_category ()); } + //Operator * overloading. JP Modified. template BOOST_UBLAS_INLINE + typename matrix_matrix_binary_traits::result_type + operator * (const matrix_expression &e1, + const matrix_expression &e2) { + return prod(e1, e2); + } + + template + BOOST_UBLAS_INLINE typename matrix_matrix_binary_traits::precision_type, E1, typename type_traits::precision_type, E2>::result_type prec_prod (const matrix_expression &e1, Index: vector_expression.hpp =================================================================== --- vector_expression.hpp (revision 3489) +++ vector_expression.hpp (working copy) @@ -14,8 +14,10 @@ #define _BOOST_UBLAS_VECTOR_EXPRESSION_ #include +//JP ADDED +#include +#include - // Expression templates based on ideas of Todd Veldhuizen and Geoffrey Furnish // Iterators based on ideas of Jeremy Siek // @@ -1169,9 +1171,11 @@ // (t * v) [i] = t * v [i] template - BOOST_UBLAS_INLINE - typename vector_binary_scalar1_traits >::result_type - operator * (const T1 &e1, + BOOST_UBLAS_INLINE //JP MODIFIED + typename vector_binary_scalar1_traits< const typename boost::enable_if_c::value, T1>::type, + E2, + scalar_multiplies >::result_type + operator * (const T1 &e1, const vector_expression &e2) { typedef typename vector_binary_scalar1_traits >::expression_type expression_type; return expression_type (e1, e2 ()); @@ -1395,9 +1399,9 @@ // (v * t) [i] = v [i] * t template BOOST_UBLAS_INLINE - typename vector_binary_scalar2_traits >::result_type + typename vector_binary_scalar2_traits::value, T2>::type, scalar_multiplies >::result_type operator * (const vector_expression &e1, - const T2 &e2) { + const T2 &e2){ //JP MODIFIED typedef typename vector_binary_scalar2_traits >::expression_type expression_type; return expression_type (e1 (), e2); }