Boost logo

Boost Users :

From: agiatojon (JonAgiato_at_[hidden])
Date: 2002-11-13 21:16:48


Ok, I fixed some of my mistakes but it now appears the overloaded
operators aren't being seen so I must be missing another header or
something. Once again here's the code compiled under VS.NET, debug,
boost version 1_29_0, with the resultant error messages following.

#include <iostream>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/matrix_expression.hpp>

int main()
{
    using namespace boost::numeric::ublas;

    matrix<double> m1(3, 3), m2(3, 3);

    for(unsigned int i = 0; i < std::min(m1.size1(), m2.size1());
++i)
       for(unsigned int j = 0; j < std::min(m1.size2(), m2.size2());
++j)
            m1(i, j) = m2(i, j) = 3 * i + j;
        
    std::cout << m1 + m2 << std::endl;

    std::cout << m1 - m2 << std::endl;

    std::cin.get();
    return EXIT_SUCCESS;
}

c:\Documents and Settings\Agiato\My Documents\Visual Studio
Projects\test5\matrixAddSub.cpp(15): error C2679: binary '<<' : no
operator found which takes a right-hand operand of
type 'boost::numeric::ublas::matrix_binary_traits<E1,E2,F>::result_ty
pe' (or there is no acceptable conversion)
        with
        [
            
E1=boost::numeric::ublas::matrix<double,boost::numeric::ublas::row_ma
jor,boost::numeric::ublas::unbounded_array<double>>,
            
E2=boost::numeric::ublas::matrix<double,boost::numeric::ublas::row_ma
jor,boost::numeric::ublas::unbounded_array<double>>,
            
F=boost::numeric::ublas::scalar_plus<boost::numeric::ublas::matrix<do
uble,boost::numeric::ublas::row_major,boost::numeric::ublas::unbounde
d_array<double>>::value_type,boost::numeric::ublas::matrix<double,boo
st::numeric::ublas::row_major,boost::numeric::ublas::unbounded_array<
double>>::value_type>
        ]
c:\Documents and Settings\Agiato\My Documents\Visual Studio
Projects\test5\matrixAddSub.cpp(17): error C2679: binary '<<' : no
operator found which takes a right-hand operand of
type 'boost::numeric::ublas::matrix_binary_traits<E1,E2,F>::result_ty
pe' (or there is no acceptable conversion)
        with
        [
            
E1=boost::numeric::ublas::matrix<double,boost::numeric::ublas::row_ma
jor,boost::numeric::ublas::unbounded_array<double>>,
            
E2=boost::numeric::ublas::matrix<double,boost::numeric::ublas::row_ma
jor,boost::numeric::ublas::unbounded_array<double>>,
            
F=boost::numeric::ublas::scalar_minus<boost::numeric::ublas::matrix<d
ouble,boost::numeric::ublas::row_major,boost::numeric::ublas::unbound
ed_array<double>>::value_type,boost::numeric::ublas::matrix<double,bo
ost::numeric::ublas::row_major,boost::numeric::ublas::unbounded_array
<double>>::value_type>
        ]

Thanks to all for their help!

Jon Agiato
JonAgiato_at_[hidden]


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net