Skip to content

Commit

Permalink
Merge pull request #12 from auto-differentiation/feature/fixes-for-bo…
Browse files Browse the repository at this point in the history
…ost-183

Specialises boost::math::tools::evaluate_polynomial for Boost 1.83 compatibility
  • Loading branch information
xcelerit-team authored Nov 15, 2023
2 parents f7a756b + 110e733 commit 3933e6b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions ql/qlxad.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <boost/accumulators/statistics/tail_quantile.hpp>
#include <boost/math/special_functions/math_fwd.hpp>
#include <boost/math/tools/promotion.hpp>
#include <boost/math/tools/rational.hpp>
#include <boost/numeric/ublas/operations.hpp>
#include <boost/type_traits/is_arithmetic.hpp>
#include <boost/type_traits/is_floating_point.hpp>
Expand Down Expand Up @@ -79,7 +80,7 @@ namespace boost {
// used by boost math functions a lot
namespace tools {
template <>
struct promote_args_2<xad::AReal<double>, xad::AReal<double> > {
struct promote_args_2<xad::AReal<double>, xad::AReal<double>> {
typedef xad::AReal<double> type;
};

Expand All @@ -89,7 +90,7 @@ namespace boost {
};

template <class T>
struct promote_args_2<T, xad::AReal<double> > {
struct promote_args_2<T, xad::AReal<double>> {
typedef xad::AReal<double> type;
};
}
Expand Down Expand Up @@ -125,6 +126,17 @@ namespace boost {
return boost::math::erfc_inv(xad::AReal<double>(z), pol);
}

namespace tools {
// boost/tools/rational.hpp, as it's called from erfc with expressions since boost 1.83

template <std::size_t N, class T, class Op, class Expr1, class Expr2>
xad::AReal<double> evaluate_polynomial(const T (&a)[N],
xad::BinaryExpr<double, Op, Expr1, Expr2> val) {
return evaluate_polynomial(a, xad::AReal<double>(val));
}
}


template <class RT1, class Op, class Expr, class RT3, class Policy>
inline xad::AReal<double>
ibetac(RT1 a, xad::UnaryExpr<double, Op, Expr> b, RT3 x, const Policy& pol) {
Expand Down

0 comments on commit 3933e6b

Please sign in to comment.