|
Boost : |
From: M.Deij_at_[hidden]
Date: 2005-07-08 02:13:47
Hello,
I've got a problem compiling the next example:
#include <iostream>
#include <boost/numeric/ublas/matrix_sparse.hpp>
#include <boost/numeric/ublas/storage.hpp>
#include <boost/numeric/ublas/io.hpp>
using namespace boost::numeric::ublas;
int main(void)
{
sparse_matrix<unsigned> *m, *n, *r;
m = new sparse_matrix<unsigned>(3,3);
n = new sparse_matrix<unsigned>(3,3);
r = new sparse_matrix<unsigned>(3,3);
for (unsigned i = 0; i < 3; ++i)
for (unsigned j = 0; j < 3; ++j)
(*m)(i,j) = i+j;
*n = *m; //no problems in assignment
*r = *m + *n; //this gives problems!!
std::cout << *r << std::endl;
return 0;
}
This example compiles on a Pentium4 with gcc 3.2.3, but not on an Opteron with
gcc 4.0.0. When the line with addition of the two matrices is commented out, the
example compiles.
I'm not sure if it's a 64-bit problem (P4 vs Opteron) or a gcc version problem.
Anybody got any ideas? The errors I get are listed below:
/usr/include/boost/numeric/ublas/matrix_sparse.hpp: In instantiation of
boost::numeric::ublas::type_traits<boost::numeric::ublas::sparse_matrix_element<boost::numeric::ublas::sparse_matrix<unsigned
int, boost::numeric::ublas::row_major, boost::numeric::ublas::map_std<size_t,
unsigned int, std::allocator<std::pair<const size_t, unsigned int> > > > > >:
/usr/include/boost/numeric/ublas/functional.hpp:183: instantiated from
boost::numeric::ublas::scalar_binary_assign_functor<boost::numeric::ublas::sparse_matrix_element<boost::numeric::ublas::sparse_matrix<unsigned
int, boost::numeric::ublas::row_major, boost::numeric::ublas::map_std<size_t,
unsigned int, std::allocator<std::pair<const size_t, unsigned int> > > > >,
unsigned int>
/usr/include/boost/numeric/ublas/functional.hpp:192: instantiated from
boost::numeric::ublas::scalar_assign<boost::numeric::ublas::sparse_matrix_element<boost::numeric::ublas::sparse_matrix<unsigned
int, boost::numeric::ublas::row_major, boost::numeric::ublas::map_std<size_t,
unsigned int, std::allocator<std::pair<const size_t, unsigned int> > > > >,
unsigned int>
/usr/include/boost/numeric/ublas/matrix_assign.hpp:1265: instantiated from
void boost::numeric::ublas::matrix_assign(F, M&, const
boost::numeric::ublas::matrix_expression<E2>&) [with F =
boost::numeric::ublas::scalar_assign<unsigned int&, unsigned int>, M =
boost::numeric::ublas::sparse_matrix<unsigned int,
boost::numeric::ublas::row_major, boost::numeric::ublas::map_std<size_t,
unsigned int, std::allocator<std::pair<const size_t, unsigned int> > > >, E =
boost::numeric::ublas::matrix_binary<boost::numeric::ublas::sparse_matrix<unsigned
int, boost::numeric::ublas::row_major, boost::numeric::ublas::map_std<size_t,
unsigned int, std::allocator<std::pair<const size_t, unsigned int> > > >,
boost::numeric::ublas::sparse_matrix<unsigned int,
boost::numeric::ublas::row_major, boost::numeric::ublas::map_std<size_t,
unsigned int, std::allocator<std::pair<const size_t, unsigned int> > > >,
boost::numeric::ublas::scalar_plus<unsigned int, unsigned int> >]
/usr/include/boost/numeric/ublas/matrix_sparse.hpp:285: instantiated from
boost::numeric::ublas::sparse_matrix<T, F, A>::sparse_matrix(const
boost::numeric::ublas::matrix_expression<E1>&, typename A::size_type) [with AE =
boost::numeric::ublas::matrix_binary<boost::numeric::ublas::sparse_matrix<unsigned
int, boost::numeric::ublas::row_major, boost::numeric::ublas::map_std<size_t,
unsigned int, std::allocator<std::pair<const size_t, unsigned int> > > >,
boost::numeric::ublas::sparse_matrix<unsigned int,
boost::numeric::ublas::row_major, boost::numeric::ublas::map_std<size_t,
unsigned int, std::allocator<std::pair<const size_t, unsigned int> > > >,
boost::numeric::ublas::scalar_plus<unsigned int, unsigned int> >, T = unsigned
int, F = boost::numeric::ublas::row_major, A =
boost::numeric::ublas::map_std<size_t, unsigned int,
std::allocator<std::pair<const size_t, unsigned int> > >]
/usr/include/boost/numeric/ublas/matrix_sparse.hpp:390: instantiated from
boost::numeric::ublas::sparse_matrix<T, F, A>&
boost::numeric::ublas::sparse_matrix<T, F, A>::operator=(const
boost::numeric::ublas::matrix_expression<E1>&) [with AE =
boost::numeric::ublas::matrix_binary<boost::numeric::ublas::sparse_matrix<unsigned
int, boost::numeric::ublas::row_major, boost::numeric::ublas::map_std<size_t,
unsigned int, std::allocator<std::pair<const size_t, unsigned int> > > >,
boost::numeric::ublas::sparse_matrix<unsigned int,
boost::numeric::ublas::row_major, boost::numeric::ublas::map_std<size_t,
unsigned int, std::allocator<std::pair<const size_t, unsigned int> > > >,
boost::numeric::ublas::scalar_plus<unsigned int, unsigned int> >, T = unsigned
int, F = boost::numeric::ublas::row_major, A =
boost::numeric::ublas::map_std<size_t, unsigned int,
std::allocator<std::pair<const size_t, unsigned int> > >]
comp_mat.cpp:27: instantiated from here
/usr/include/boost/numeric/ublas/matrix_sparse.hpp:156: error: no type named
real_type in struct boost::numeric::ublas::type_traits<unsigned int>
/usr/include/boost/numeric/ublas/matrix_sparse.hpp:157: error: no type named
precision_type in struct boost::numeric::ublas::type_traits<unsigned int>
/usr/include/boost/numeric/ublas/matrix_sparse.hpp:159: error: plus_complexity
is not a member of boost::numeric::ublas::type_traits<unsigned int>
/usr/include/boost/numeric/ublas/matrix_sparse.hpp:160: error:
multiplies_complexity is not a member of
boost::numeric::ublas::type_traits<unsigned int>
/usr/include/boost/numeric/ublas/matrix_sparse.hpp:164: error: no type named
real_type in struct boost::numeric::ublas::type_traits<unsigned int>
/usr/include/boost/numeric/ublas/matrix_sparse.hpp:169: error: no type named
real_type in struct boost::numeric::ublas::type_traits<unsigned int>
/usr/include/boost/numeric/ublas/matrix_sparse.hpp:180: error: no type named
real_type in struct boost::numeric::ublas::type_traits<unsigned int>
/usr/include/boost/numeric/ublas/matrix_sparse.hpp:191: error: no type named
real_type in struct boost::numeric::ublas::type_traits<unsigned int>
/usr/include/boost/numeric/ublas/matrix_sparse.hpp:196: error: no type named
real_type in struct boost::numeric::ublas::type_traits<unsigned int>
/usr/include/boost/numeric/ublas/matrix_sparse.hpp:201: error: no type named
real_type in struct boost::numeric::ublas::type_traits<unsigned int>
Thanks and best wishes,
Menno Deij
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk