Boost logo

Ublas :

Subject: Re: [ublas] Patch/proposal for overloading operator * in ublas
From: K.M.A.Chai_at_[hidden]
Date: 2009-09-07 12:32:23


Hi Gunter,

   The following inclusions into matrix_expression.hpp will allow
"matrix * matrix" and "matrix * vector".

<patch>
   template<class E1, class E2>
   BOOST_UBLAS_INLINE
   typename matrix_matrix_binary_traits<typename E1::value_type, E1,
                                        typename E2::value_type, E2>::result_type
   operator * (const matrix_expression<E1> &e1, const matrix_expression<E2> &e2) {
     return prod (e1, e2);
   }

   template<class E1, class E2>
   BOOST_UBLAS_INLINE
   typename matrix_vector_binary1_traits<typename E1::value_type, E1,
                                         typename E2::value_type, E2>::result_type
   operator * (const matrix_expression<E1> &e1, const vector_expression<E2> &e2) {
     return prod (e1, e2);
   }
</patch>

   A relook at this again makes me wonder why "matrix * vector" is in
matrix_expression.hpp, since this is really a vector expression.

Kian Ming (Adam)

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.