Boost C++ Libraries: Ticket #4860: Rational does not play well with uBlas https://svn.boost.org/trac10/ticket/4860 <p> I'm trying to solve a rational linear system using boost/rational + uBlas. I've tried to copy many examples on the web that all follow the same line: </p> <pre class="wiki"> typedef permutation_matrix&lt;rational_t&gt; pmatrix; pmatrix pm(a.size1()); matrix_t inverse(a.size1(), a.size2()); lu_factorize(a, pm); inverse.assign(identity_matrix&lt;rational_t&gt;(a.size1())); lu_substitute(a, pm, inverse); </pre><p> a is of type matrix_t, which is defined as follows: </p> <pre class="wiki">typedef rational&lt;long long int&gt; rational_t; typedef matrix&lt;rational_t&gt; matrix_t; </pre><p> Compilation fails on the lu_factorize function call with the following error messages: </p> <pre class="wiki">In file included from interpolator.cpp:5: /usr/local/include/boost/numeric/ublas/lu.hpp: In function ‘void boost::numeric::ublas::swap_rows(const PM&amp;, MV&amp;, boost::numeric::ublas::matrix_tag) [with PM = boost::numeric::ublas::permutation_matrix&lt;boost::rational&lt;long long int&gt;, boost::numeric::ublas::unbounded_array&lt;boost::rational&lt;long long int&gt;, std::allocator&lt;boost::rational&lt;long long int&gt; &gt; &gt; &gt;, MV = boost::numeric::ublas::matrix&lt;boost::rational&lt;long long int&gt;, boost::numeric::ublas::basic_row_major&lt;long unsigned int, long int&gt;, boost::numeric::ublas::unbounded_array&lt;boost::rational&lt;long long int&gt;, std::allocator&lt;boost::rational&lt;long long int&gt; &gt; &gt; &gt;]’: /usr/local/include/boost/numeric/ublas/lu.hpp:90: instantiated from ‘void boost::numeric::ublas::swap_rows(const PM&amp;, MV&amp;) [with PM = boost::numeric::ublas::permutation_matrix&lt;boost::rational&lt;long long int&gt;, boost::numeric::ublas::unbounded_array&lt;boost::rational&lt;long long int&gt;, std::allocator&lt;boost::rational&lt;long long int&gt; &gt; &gt; &gt;, MV = boost::numeric::ublas::lu_factorize(M&amp;, PM&amp;) [with M = matrix_t, PM = main()::pmatrix]::matrix_type]’ /usr/local/include/boost/numeric/ublas/lu.hpp:165: instantiated from ‘typename M::size_type boost::numeric::ublas::lu_factorize(M&amp;, PM&amp;) [with M = matrix_t, PM = main()::pmatrix]’ interpolator.cpp:122: instantiated from here /usr/local/include/boost/numeric/ublas/lu.hpp:83: error: no matching function for call to ‘row(boost::numeric::ublas::matrix&lt;boost::rational&lt;long long int&gt;, boost::numeric::ublas::basic_row_major&lt;long unsigned int, long int&gt;, boost::numeric::ublas::unbounded_array&lt;boost::rational&lt;long long int&gt;, std::allocator&lt;boost::rational&lt;long long int&gt; &gt; &gt; &gt;&amp;, const boost::rational&lt;long long int&gt;&amp;)’ /usr/local/include/boost/numeric/ublas/matrix_proxy.hpp:466: note: candidates are: boost::numeric::ublas::matrix_row&lt;M&gt; boost::numeric::ublas::row(M&amp;, typename M::size_type) [with M = boost::numeric::ublas::matrix&lt;boost::rational&lt;long long int&gt;, boost::numeric::ublas::basic_row_major&lt;long unsigned int, long int&gt;, boost::numeric::ublas::unbounded_array&lt;boost::rational&lt;long long int&gt;, std::allocator&lt;boost::rational&lt;long long int&gt; &gt; &gt; &gt;] /usr/local/include/boost/numeric/ublas/matrix_proxy.hpp:471: note: const boost::numeric::ublas::matrix_row&lt;const M&gt; boost::numeric::ublas::row(const M&amp;, typename M::size_type) [with M = boost::numeric::ublas::matrix&lt;boost::rational&lt;long long int&gt;, boost::numeric::ublas::basic_row_major&lt;long unsigned int, long int&gt;, boost::numeric::ublas::unbounded_array&lt;boost::rational&lt;long long int&gt;, std::allocator&lt;boost::rational&lt;long long int&gt; &gt; &gt; &gt;] </pre><p> It looks like the two libraries do not play well together, which means that Boost is basically useless for what I'm trying to do :-/ </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4860 Trac 1.4.3