boost/numeric/ublas/lu.hpp

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

boost/numeric/ublas/lu.hpp

Brad Bell
I am trying to understand the requirements for the scalar type used with
boost/numeric/ublas/lu.hpp
In particular, the following program; see
     https://github.com/coin-or/CppAD/blob/master/bug/boost_lu.sh
------------
# include <cppad/cppad.hpp>
# include <boost/numeric/ublas/lu.hpp>
int main() {
     typedef CppAD::AD<double> T;
     boost::numeric::ublas::matrix<T> a(5,5);
     boost::numeric::ublas::permutation_matrix<std::size_t> pert(5);
     // lu decomposition
     const std::size_t s = lu_factorize(a, pert);
     return 0;
}
----------
generates an error of the form
... snip ...
/usr/include/boost/numeric/ublas/detail/matrix_assign.hpp:33:35:
     error: no match for ‘operator<’
     ... snip ...
     return norm_inf (e1 - e2) < epsilon *
     ... snip ...

If I make the following change to matrix_assign.hpp, I do not get the
compile error:

Old Text:
     return norm_inf (e1 - e2) < epsilon *
     std::max<S> (std::max<S> (norm_inf (e1), norm_inf (e2)), min_norm);
New Text:
     S norm_1 = norm_inf(e1);
     S norm_2 = norm_inf(e2);
     S norm_diff = norm_inf(e1 - e2);
     return norm_diff < epsilon * std::max( std::max<S>(norm_1, norm_2)
, min_norm );





_______________________________________________
ublas mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/ublas
Sent to: [hidden email]