Error on ublas/lu library of boost

First, I’ve wrote some source code,

#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/triangular.hpp>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/lu.hpp>
#include <boost/numeric/ublas/io.hpp>

// calc inverted-matrix
ublas::matrix<double> mat_lu(lc_param);
ublas::matrix<double> lc_conj;
ublas::permutation_matrix<> lu_exc(lc_param.size1());
lc_conj = ublas::identity_matrix<double>(lc_param.size1());
ublas::lu_factorize(mat_lu, lu_exc);
ublas::lu_substitute(mat_lu, lu_exc, lc_conj);

and gcc 4.1.2 arises error,

cc -Wall -Wextra -g -I./ -I../ -o hvltest.o -c hvltest.cc
/usr/include/boost/numeric/ublas/lu.hpp: In function ‘typename M::size_type boost::numeric::ublas::lu_factorize(M&, PM&) [with M = boost::numeric::ublas::matrix, boost::numeric::ublas::unbounded_array > >, PM = boost::numeric::ublas::permutation_matrix > >]’:
hvltest.cc:1332: instantiated from here
/usr/include/boost/numeric/ublas/lu.hpp:137: error: no matching function for call to ‘project(boost::numeric::ublas::matrix_column, boost::numeric::ublas::unbounded_array > > >&, boost::numeric::ublas::basic_range)’
hvltest.cc:1332: instantiated from here
/usr/include/boost/numeric/ublas/lu.hpp:146: error: no matching function for call to ‘project(boost::numeric::ublas::matrix_column, boost::numeric::ublas::unbounded_array > > >&, boost::numeric::ublas::basic_range)’
hvltest.cc:1332: instantiated from here
/usr/include/boost/numeric/ublas/lu.hpp:150: error: no matching function for call to ‘project(boost::numeric::ublas::matrix_column, boost::numeric::ublas::unbounded_array > > >&, boost::numeric::ublas::basic_range)’
/usr/include/boost/numeric/ublas/lu.hpp:150: error: no matching function for call to ‘project(boost::numeric::ublas::matrix_row, boost::numeric::ublas::unbounded_array > > >&, boost::numeric::ublas::basic_range)’

To fix this, I need to include “boost/numeric/ublas/vector_proxy.hpp” like

#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/triangular.hpp>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/vector_proxy.hpp>
#include <boost/numeric/ublas/lu.hpp>
#include <boost/numeric/ublas/io.hpp>

hrm..

Leave a Reply »