# Ublas :

From: ZhiQiang Chen (zqc.chen_at_[hidden])
Date: 2005-08-24 00:59:24

Hello, everyone:

I am writing a Bayesian learning library using uBLAS. Since there are a
bounch of matrix inverse operations, for the time being, I try to use the
lu_factorize() defined in lu.hpp for small data sets only (evetually, I will
have to use umfpack considering sparsity). Here is the simple code I used to
try lu_factorize():

#include <boost/numeric/ublas/io.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/matrix_proxy.hpp>
#include <boost/numeric/ublas/triangular.hpp>
#include <boost/numeric/ublas/lu.hpp> // the header files are complete?

using std::cout;
using std::endl;

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

typedef ublas::vector<double> Vector;
typedef ublas::matrix<double> Matrix;

Matrix m(3,3);

for (unsigned i = 0; i < 3; ++ i)
for (unsigned j = 0; j < 3; ++ j)
m (i, j) = 3 * i + j + 2;

Matrix eye3 = ublas::identity_matrix<double>(3, 3);
m = m + 3 * eye3; // now m is not singular

// test lu factorization
permutation_matrix<std::size_t> pm(3);

cout <<" m = " << m << endl;
cout <<" pm = " << pm << endl;

lu_factorize(m);
// lu_factorize(m, pm);

return 0;
}

What follows is the error message:

/usr/include/boost/numeric/ublas/lu.hpp: In function `typename M::size_type
boost::numeric::ublas::lu_factorize(M&) [with M = main()::Matrix]':
try5.cpp:34: instantiated from here
/usr/include/boost/numeric/ublas/lu.hpp:103: error: no matching function for
call to `project(boost::numeric::ublas::matrix_column<main()::Matrix>&,
boost::numeric::ublas::basic_range<size_t, ptrdiff_t>)'
try5.cpp:34: instantiated from here
/usr/include/boost/numeric/ublas/lu.hpp:107: error: no matching function for
call to `project(boost::numeric::ublas::matrix_column<main()::Matrix>&,
boost::numeric::ublas::basic_range<size_t, ptrdiff_t>)'
try5.cpp:34: instantiated from here
/usr/include/boost/numeric/ublas/lu.hpp:107: error: no matching function for
call to `project(boost::numeric::ublas::matrix_row<main()::Matrix>&,
boost::numeric::ublas::basic_range<size_t, ptrdiff_t>)'

The Boost I use is 1.33 (I downloaded the rpm packages from
http://rpm.pbone.net/, and installed in my suse 9.1 linux box).

Can anybody give me some hints on this? ( Probably similar questions have
been posted here).

-Best

Chen