2
0
mirror of https://github.com/boostorg/math.git synced 2026-02-24 04:02:18 +00:00

Added boost tuple support

This commit is contained in:
Jacob Hass
2026-01-02 10:29:52 -08:00
parent ed3289df1a
commit 55e2b17b02
2 changed files with 24 additions and 2 deletions

View File

@@ -17,6 +17,7 @@
#include <boost/math/distributions/detail/generic_mode.hpp>
#include <boost/math/special_functions/pow.hpp>
#include <boost/math/policies/policy.hpp>
#include <boost/math/distributions/complement.hpp> // complements
namespace boost
{
@@ -24,8 +25,6 @@ namespace boost
{
namespace detail
{
/* Need to rewrite this according to `find_non_centrality` in
non_central_chi_squared.hpp */
template <class RealType, class Policy>
struct non_centrality_finder_f
{
@@ -128,6 +127,27 @@ namespace boost
result,
function);
}
template <class A, class B, class C, class D>
BOOST_MATH_GPU_ENABLED static RealType find_non_centrality(const complemented4_type<A,B,C, D>& c)
{
constexpr auto function = "non_central_f_distribution<%1%>::find_non_centrality";
typedef typename policies::evaluation<RealType, Policy>::type eval_type;
typedef typename policies::normalise<
Policy,
policies::promote_float<false>,
policies::promote_double<false>,
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
eval_type result = detail::find_non_centrality_f(
static_cast<eval_type>(c.dist),
static_cast<eval_type>(c.param1),
static_cast<eval_type>(c.param2),
static_cast<eval_type>(c.param3),
forwarding_policy());
return policies::checked_narrowing_cast<RealType, forwarding_policy>(
result,
function);
}
private:
// Data member, initialized by constructor.
RealType v1; // alpha.

View File

@@ -143,6 +143,8 @@ void test_spot(
quantile(complement(dist, Q)), x, tol * 10);
BOOST_CHECK_CLOSE(
dist.find_non_centrality(a, b, P, x), ncp, tol * 10);
BOOST_CHECK_CLOSE(
dist.find_non_centrality(boost::math::complement(a, b, P, x)), ncp, tol * 10);
}
if(boost::math::tools::digits<RealType>() > 50)
{