compilation errors with ublas / cppad
Hi,
I think this has been asked before, but since I am not aware of any
answer, I would like to bring up the topic again:
When using CppAD::AD<double> with boost ublas, certain compilation
errors show up. I attach a small example (ublas_cppad.cpp) and the
(start of the) error messages I get (compilation_errors.txt, produced
with boost 1.59.0, g++ 4.9.3, CppAD-20151124).
The problem is in matrix_assign.hpp; when changing
template
#include
Hi,
I think this has been asked before, but since I am not aware of any answer, I would like to bring up the topic again:
When using CppAD::AD<double> with boost ublas, certain compilation errors show up. I attach a small example (ublas_cppad.cpp) and the (start of the) error messages I get (compilation_errors.txt, produced with boost 1.59.0, g++ 4.9.3, CppAD-20151124).
The problem is in matrix_assign.hpp; when changing
template
BOOST_UBLAS_INLINE bool equals (const matrix_expression<E1> &e1, const matrix_expression<E2> &e2, S epsilon, S min_norm) { return norm_inf (e1 - e2) < epsilon * std::max<S> (std::max<S> (norm_inf (e1), norm_inf (e2)), min_norm); } to
template
BOOST_UBLAS_INLINE bool equals (const matrix_expression<E1> &e1, const matrix_expression<E2> &e2, S epsilon, S min_norm) { S tmp = norm_inf (e1 - e2); return tmp < epsilon * std::max<S> (std::max<S> (norm_inf (e1), norm_inf (e2)), min_norm); } the example code compiles without errors. Can someone point out, how this should be fixed (either on boost or CppAD side)? In general, are there requirements for a type T to cooperate with ublas matrices one should be aware of?
Thank you Peter
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Hi Oleg, thank you. I am aware of this workaround. I was looking for a clean fix and some background, since for example the multiprecision classes from boost seem to work in the same context. It would be great if someone could give some insight into this. Best regards Peter On 30 November 2015 at 16:28, Oleg Labutin
#include
#include typedef CppAD::AD<double> my_dbl;
namespace boost { namespace numeric { namespace ublas { template<class M> class sparse_matrix_element;
template
class compressed_matrix; template
class unbounded_array; namespace detail {
template
inline bool operator < (Left const& left, CppAD::AD<Base> const& right) { return left. operator my_dbl() < right; } } } } } int main() {
boost::numeric::ublas::matrix
a(3, 3); boost::numeric::ublas::permutation_matrix<int> pert(3); const int singular = lu_factorize(a, pert);
return 0; }
2015-11-24 20:22 GMT+02:00 Peter Caspers
: Hi,
I think this has been asked before, but since I am not aware of any answer, I would like to bring up the topic again:
When using CppAD::AD<double> with boost ublas, certain compilation errors show up. I attach a small example (ublas_cppad.cpp) and the (start of the) error messages I get (compilation_errors.txt, produced with boost 1.59.0, g++ 4.9.3, CppAD-20151124).
The problem is in matrix_assign.hpp; when changing
template
BOOST_UBLAS_INLINE bool equals (const matrix_expression<E1> &e1, const matrix_expression<E2> &e2, S epsilon, S min_norm) { return norm_inf (e1 - e2) < epsilon * std::max<S> (std::max<S> (norm_inf (e1), norm_inf (e2)), min_norm); } to
template
BOOST_UBLAS_INLINE bool equals (const matrix_expression<E1> &e1, const matrix_expression<E2> &e2, S epsilon, S min_norm) { S tmp = norm_inf (e1 - e2); return tmp < epsilon * std::max<S> (std::max<S> (norm_inf (e1), norm_inf (e2)), min_norm); } the example code compiles without errors. Can someone point out, how this should be fixed (either on boost or CppAD side)? In general, are there requirements for a type T to cooperate with ublas matrices one should be aware of?
Thank you Peter
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Hi Caspers,
in gennerally we can get information about operators or convertible for
distanation classes. Or implement traits for operators < like std::less
e.g. for using inside ublas.
Best regards
2015-11-30 22:34 GMT+02:00 Peter Caspers
Hi Oleg,
thank you. I am aware of this workaround. I was looking for a clean fix and some background, since for example the multiprecision classes from boost seem to work in the same context. It would be great if someone could give some insight into this.
Best regards Peter
On 30 November 2015 at 16:28, Oleg Labutin
wrote: #include
#include typedef CppAD::AD<double> my_dbl;
namespace boost { namespace numeric { namespace ublas { template<class M> class sparse_matrix_element;
template
class compressed_matrix; template
class unbounded_array; namespace detail {
template
inline bool operator < (Left const& left, CppAD::AD<Base> const& right) { return left. operator my_dbl() < right; } } } } } int main() {
boost::numeric::ublas::matrix
a(3, 3); boost::numeric::ublas::permutation_matrix<int> pert(3); const int singular = lu_factorize(a, pert);
return 0; }
2015-11-24 20:22 GMT+02:00 Peter Caspers
: Hi,
I think this has been asked before, but since I am not aware of any answer, I would like to bring up the topic again:
When using CppAD::AD<double> with boost ublas, certain compilation errors show up. I attach a small example (ublas_cppad.cpp) and the (start of the) error messages I get (compilation_errors.txt, produced with boost 1.59.0, g++ 4.9.3, CppAD-20151124).
The problem is in matrix_assign.hpp; when changing
template
BOOST_UBLAS_INLINE bool equals (const matrix_expression<E1> &e1, const matrix_expression<E2> &e2, S epsilon, S min_norm) { return norm_inf (e1 - e2) < epsilon * std::max<S> (std::max<S> (norm_inf (e1), norm_inf (e2)), min_norm); } to
template
BOOST_UBLAS_INLINE bool equals (const matrix_expression<E1> &e1, const matrix_expression<E2> &e2, S epsilon, S min_norm) { S tmp = norm_inf (e1 - e2); return tmp < epsilon * std::max<S> (std::max<S> (norm_inf (e1), norm_inf (e2)), min_norm); } the example code compiles without errors. Can someone point out, how this should be fixed (either on boost or CppAD side)? In general, are there requirements for a type T to cooperate with ublas matrices one should be aware of?
Thank you Peter
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (2)
-
Oleg Labutin
-
Peter Caspers