I have a very simple piece of code that treats matrices. Here's a short excerpt:
typedef boost::multiprecision::cpp_dec_float_100 SuperFloat;
typedef boost::numeric::ublas::matrix<SuperFloat> Matrix;
int function(Matrix& matrix){
boost::numeric::ublas::permutation_matrix<std::size_t> pm(matrix.size1());
int res = lu_factorize(matrix,pm); // this is a problem
return res;
}
The code perfectly compiles and runs on my notebook, using g++ 5.2.0 and boost 1.58. However, when I try to compile the same code on my desktop machine at work, which is using gcc 4.9.2 and boost 1.53, I get a horrible error message (miles of template arguments), that ultimately comes to this:
cannot convert ‘boost::numeric::ublas::norm_inf
# gazillions of template arguments
to type ‘const bool&’
std::max<S> (std::max<S> (norm_inf (e1), norm_inf (e2)), min_norm);
stl_algobase.h:261:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
I'm a bit puzzled now. It seems like the template resolution of the arguments fails, which leads to the two arguments of max
being of a different type. Unfortunately, I cannot explicitly typecast them, because the actual call causing the problem is buried somewhere in boost uBLAS
.
Since I'm able to compile the same code with a different gcc and boost version on my notebook, there must be some sort of version issue here. Is there some particular change from gcc4.9 to 5.2 that affects the template resolution, or is there an issue with uBLAS in boost that causes this problem?
What is the suggested way of overcoming problems like these? While the obvious solution would be to update the gcc and boost on my work computer, it's certainly not very advisable to write code that relies on certain versions of gcc or boost to be used to compile it.