Boost logo

Ublas :

From: Dave Steffen (dgsteffen_at_[hidden])
Date: 2006-07-27 11:38:13


Hi Folks,

This is my first excursion into uBlas. I'm getting an "ambiguous
overload for 'operator*' in 'a * b' " sort of error out of this:

#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/matrix_expression.hpp>
namespace UB
{
    using namespace boost::numeric::ublas;

    template <int N> struct Type
    {
        typedef matrix<double, row_major, bounded_array<double, N*N> > matrix;
    };
}

// elsewhere...

   typename UB::Type<N>::matrix a(N,N), b(N,N);

    for (int i = 0; i < N; ++i)
        for (int j = 0; j < N; ++j)
            {
                a(i,j) = 1.0 / (i + j+1);
                b(i,j) = 1.0 / (i + j+1);
            }

    a * b;

The error (from GCC 3.4.6) is this ugly thing:

/usr/local/home/dgsteffen/local/GCC34/Boost/1_32/boost/numeric/ublas/matrix_expression.hpp:3632:
note: candidates are: typename boost::numeric::ublas::matrix_binary_scalar2_traits<E1, const
T2, boost::numeric::ublas::scalar_multiplies<typename E1::value_type, T2>,
boost::numeric::ublas::scalar_reference<const T2> >::result_type
boost::numeric::ublas::operator*(const boost::numeric::ublas::matrix_expression<E>&, const
T2&) [with E1 = boost::numeric::ublas::matrix<double, boost::numeric::ublas::row_major,
boost::numeric::ublas::bounded_array<double, 441u, std::allocator<double> > >, T2 =
boost::numeric::ublas::matrix<double, boost::numeric::ublas::row_major,
boost::numeric::ublas::bounded_array<double, 441u, std::allocator<double> >
>]
/usr/local/home/dgsteffen/local/GCC34/Boost/1_32/boost/numeric/ublas/matrix_expression.hpp:3162:
note: typename boost::numeric::ublas::matrix_binary_scalar1_traits<const T1, E2,
boost::numeric::ublas::scalar_multiplies<T1, typename E2::value_type>,
boost::numeric::ublas::scalar_reference<const T1> >::result_type
boost::numeric::ublas::operator*(const T1&, const
boost::numeric::ublas::matrix_expression<E2>&) [with T1 =
boost::numeric::ublas::matrix<double, boost::numeric::ublas::row_major,
boost::numeric::ublas::bounded_array<double, 441u, std::allocator<double> > >, E2 =
boost::numeric::ublas::matrix<double, boost::numeric::ublas::row_major,
boost::numeric::ublas::bounded_array<double, 441u, std::allocator<double> > >]

Any thoughts on what I'm doing wrong?

Thanks!

----------------------------------------------------------------------
Dave Steffen, Ph.D.
Software Engineer IV Disobey this command!
Numerica Corporation
ph (970) 419-8343 x27
fax (970) 223-6797 - Douglas Hofstadter
dgsteffen_at_[hidden]
___________________
Numerica Disclaimer:
This message and any attachments are intended only for the individual
or entity to which the message is addressed. It is proprietary and
may contain privileged information. If you are neither the intended
recipient nor the agent responsible for delivering the message to the
intended recipient, you are hereby notified that any review,
retransmission, dissemination, or taking of any action in reliance
upon, the information in this communication is strictly prohibited,
and may be unlawful. If you feel you have received this communication
in error, please notify us immediately by returning this Email to the
sender and deleting it from your computer.