Ticket #4442: operator_star_enable_if.patch

File operator_star_enable_if.patch, 5.5 KB (added by Jesse Perla <jesseperla@…>, 12 years ago)
  • matrix_expression.hpp

     
    29402940    // (t * m) [i] [j] = t * m [i] [j]
    29412941    template<class T1, class E2>
    29422942    BOOST_UBLAS_INLINE
    2943     typename enable_if< is_convertible<T1, typename E2::value_type >,
     2943    typename enable_if< is_arithmetic<T1>,
    29442944    typename matrix_binary_scalar1_traits<const T1, E2, scalar_multiplies<T1, typename E2::value_type> >::result_type
    29452945    >::type
    2946     operator * (const T1 &e1,
     2946        operator * (const T1 &e1,
    29472947                const matrix_expression<E2> &e2) {
    29482948        typedef typename matrix_binary_scalar1_traits<const T1, E2, scalar_multiplies<T1, typename E2::value_type> >::expression_type expression_type;
    29492949        return expression_type (e1, e2 ());
     
    33753375    // (m * t) [i] [j] = m [i] [j] * t
    33763376    template<class E1, class T2>
    33773377    BOOST_UBLAS_INLINE
    3378     typename enable_if< is_convertible<T2, typename E1::value_type>,
     3378    typename enable_if< is_arithmetic<T2>,
    33793379    typename matrix_binary_scalar2_traits<E1, const T2, scalar_multiplies<typename E1::value_type, T2> >::result_type
    33803380    >::type
    3381     operator * (const matrix_expression<E1> &e1,
     3381        operator * (const matrix_expression<E1> &e1,
    33823382                const T2 &e2) {
    33833383        typedef typename matrix_binary_scalar2_traits<E1, const T2, scalar_multiplies<typename E1::value_type, T2> >::expression_type expression_type;
    33843384        return expression_type (e1 (), e2);
     
    37253725        return prod (e1, e2, storage_category (), orientation_category ());
    37263726    }
    37273727
     3728        template<class E1, class E2>
     3729        BOOST_UBLAS_INLINE
     3730                typename matrix_vector_binary1_traits<typename E1::value_type, E1,
     3731                typename E2::value_type, E2>::result_type
     3732                operator * (const matrix_expression<E1> &e1,
     3733                const vector_expression<E2> &e2) {
     3734                        BOOST_STATIC_ASSERT (E2::complexity == 0);
     3735                        typedef typename matrix_vector_binary1_traits<typename E1::value_type, E1,
     3736                                typename E2::value_type, E2>::storage_category storage_category;
     3737                        typedef typename matrix_vector_binary1_traits<typename E1::value_type, E1,
     3738                                typename E2::value_type, E2>::orientation_category orientation_category;
     3739                        return prod (e1, e2, storage_category (), orientation_category ());
     3740        }
     3741
     3742
    37283743    template<class E1, class E2>
    37293744    BOOST_UBLAS_INLINE
    37303745    typename matrix_vector_binary1_traits<typename type_traits<typename E1::value_type>::precision_type, E1,
     
    41154130        return prod (e1, e2, storage_category (), orientation_category ());
    41164131    }
    41174132
     4133        template<class E1, class E2>
     4134        BOOST_UBLAS_INLINE
     4135                typename matrix_vector_binary2_traits<typename E1::value_type, E1,
     4136                typename E2::value_type, E2>::result_type
     4137                operator* (const vector_expression<E1> &e1,
     4138                const matrix_expression<E2> &e2) {
     4139                        BOOST_STATIC_ASSERT (E1::complexity == 0);
     4140                        typedef typename matrix_vector_binary2_traits<typename E1::value_type, E1,
     4141                                typename E2::value_type, E2>::storage_category storage_category;
     4142                        typedef typename matrix_vector_binary2_traits<typename E1::value_type, E1,
     4143                                typename E2::value_type, E2>::orientation_category orientation_category;
     4144                        return prod (e1, e2, storage_category (), orientation_category ());
     4145        }
     4146
    41184147    template<class E1, class E2>
    41194148    BOOST_UBLAS_INLINE
    41204149    typename matrix_vector_binary2_traits<typename type_traits<typename E1::value_type>::precision_type, E1,
     
    48204849        return prod (e1, e2, storage_category (), orientation_category ());
    48214850    }
    48224851
     4852        template<class E1, class E2>
     4853        BOOST_UBLAS_INLINE
     4854                typename matrix_matrix_binary_traits<typename E1::value_type, E1,
     4855                typename E2::value_type, E2>::result_type
     4856                operator* (const matrix_expression<E1> &e1,
     4857                const matrix_expression<E2> &e2) {
     4858                        BOOST_STATIC_ASSERT (E1::complexity == 0 && E2::complexity == 0);
     4859                        typedef typename matrix_matrix_binary_traits<typename E1::value_type, E1,
     4860                                typename E2::value_type, E2>::storage_category storage_category;
     4861                        typedef typename matrix_matrix_binary_traits<typename E1::value_type, E1,
     4862                                typename E2::value_type, E2>::orientation_category orientation_category;
     4863                        return prod (e1, e2, storage_category (), orientation_category ());
     4864        }
     4865
    48234866    template<class E1, class E2>
    48244867    BOOST_UBLAS_INLINE
    48254868    typename matrix_matrix_binary_traits<typename type_traits<typename E1::value_type>::precision_type, E1,
  • vector_expression.hpp

     
    1515
    1616#include <boost/numeric/ublas/expression_types.hpp>
    1717
    18 
    1918// Expression templates based on ideas of Todd Veldhuizen and Geoffrey Furnish
    2019// Iterators based on ideas of Jeremy Siek
    2120//
     
    11701169    // (t * v) [i] = t * v [i]
    11711170    template<class T1, class E2>
    11721171    BOOST_UBLAS_INLINE
    1173     typename enable_if< is_convertible<T1, typename E2::value_type >,   
     1172    typename enable_if< is_arithmetic<T1>,   
    11741173    typename vector_binary_scalar1_traits<const T1, E2, scalar_multiplies<T1, typename E2::value_type> >::result_type
    11751174    >::type
    11761175    operator * (const T1 &e1,
     
    13971396    // (v * t) [i] = v [i] * t
    13981397    template<class E1, class T2>
    13991398    BOOST_UBLAS_INLINE
    1400     typename enable_if< is_convertible<T2, typename E1::value_type >,   
     1399    typename enable_if< is_arithmetic<T2>,   
    14011400    typename vector_binary_scalar2_traits<E1, const T2, scalar_multiplies<typename E1::value_type, T2> >::result_type
    14021401    >::type
    14031402    operator * (const vector_expression<E1> &e1,