Boost logo

Ublas :

From: Vincent Acary (vincent.acary_at_[hidden])
Date: 2008-03-20 09:17:06


Hi,

I have some troubles to compile the following code on Mac Intel with
gcc version 4.0.1 (Apple Inc. build 5465).

The same code cause any trouble on Linux Fedora core 6 with gcc 4.1.2
20070626 (Red Hat 4.1.2-13)

Do you have any idea ?

Vincent.

#Include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/matrix_proxy.hpp>
#include <boost/numeric/ublas/io.hpp>
#include <boost/numeric/ublas/matrix_sparse.hpp>
#include <vector>
using namespace boost::numeric::ublas;

typedef std::vector<unsigned int> Index;

typedef matrix<double> matdouble;

typedef compressed_matrix<double,column_major, 0, Index > SparseMat;
int main ()
{

   matdouble m (3, 3);
   SparseMat m2 (3, 3);

   matrix_range<matdouble> mr (m, range (0, 3), range (0, 3));
   for (unsigned i = 0; i < mr.size1 (); ++ i)
     for (unsigned j = 0; j < mr.size2 (); ++ j)
       mr (i, j) = 3 * i + j;
   matrix_range<SparseMat> mr2 (m2, range (0, 3), range (0, 3));
   for (unsigned i = 0; i < mr2.size1 (); ++ i)
     for (unsigned j = 0; j < mr2.size2 (); ++ j)
       mr2 (i, j) = 3 * i + j;
   std::cout << mr2 << std::endl;
}

g++ test.cpp -I/usr/local/include/boost-1_34_1/
test.cpp: In function 'int main()':
test.cpp:22: error: no matching function for call to
'boost
::numeric::ublas::matrix_range<SparseMat>::matrix_range(SparseMat&,
boost::numeric::ublas::range, boost::numeric::ublas::range)'
/usr/local/include/boost-1_34_1/boost/numeric/ublas/matrix_proxy.hpp:
2365: note: candidates are:
boost::numeric::ublas::matrix_range<M>::matrix_range(const typename
boost::mpl::if_<boost::is_const<T>, typename M::const_closure_type,
typename M::closure_type>::type&, const
boost::numeric::ublas::basic_range<typename A::size_type, typename
A::difference_type>&, const
boost::numeric::ublas::basic_range<typename A::size_type, typename
A::difference_type>&, int) [with M = SparseMat]
/usr/local/include/boost-1_34_1/boost/numeric/ublas/matrix_proxy.hpp:
2356: note:
boost::numeric::ublas::matrix_range<M>::matrix_range(M&, const
boost::numeric::ublas::basic_range<typename A::size_type, typename
A::difference_type>&, const
boost::numeric::ublas::basic_range<typename A::size_type, typename
A::difference_type>&) [with M = SparseMat]
/usr/local/include/boost-1_34_1/boost/numeric/ublas/matrix_proxy.hpp:
2329: note:
boost::numeric::ublas::matrix_range<SparseMat>::matrix_range(const
boost::numeric::ublas::matrix_range<SparseMat>&)

g++ -v
Using built-in specs.
Target: i686-apple-darwin9
Configured with: /var/tmp/gcc/gcc-5465~16/src/configure --disable-
checking -enable-werror --prefix=/usr --mandir=/share/man --enable-
languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/
$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/
lib --build=i686-apple-darwin9 --with-arch=apple --with-tune=generic --
host=i686-apple-darwin9 --target=i686-apple-darwin9
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5465)

--
Vincent  
ACARY                                                           Chargé  
de recherche
INRIA Rhône-Alpes    Equipe-Projet BIPOP        http://bipop.inrialpes.fr/
Bureau E220         tel:+33 (0)4 76 61 52 29     fax:+33 (0)4 76 61 54  
77