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


Brad Bell
I am trying to understand the requirements for the scalar type used with
In particular, the following program; see
# 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 ...
     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]
Sent to: [hidden email]