Skip to content

Commit

Permalink
Merge pull request #1193 from boostorg/GPU10
Browse files Browse the repository at this point in the history
GPU Batch 10
  • Loading branch information
mborland authored Sep 9, 2024
2 parents 84a7bdd + e9cd6c9 commit 937107a
Show file tree
Hide file tree
Showing 211 changed files with 24,666 additions and 701 deletions.
16 changes: 9 additions & 7 deletions doc/distributions/inverse_gaussian.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
typedef RealType value_type;
typedef Policy policy_type;

inverse_gaussian_distribution(RealType mean = 1, RealType scale = 1);
BOOST_MATH_GPU_ENABLED inverse_gaussian_distribution(RealType mean = 1, RealType scale = 1);

RealType mean()const; // mean default 1.
RealType scale()const; // Optional scale, default 1 (unscaled).
RealType shape()const; // Shape = scale/mean.
BOOST_MATH_GPU_ENABLED RealType mean()const; // mean default 1.
BOOST_MATH_GPU_ENABLED RealType scale()const; // Optional scale, default 1 (unscaled).
BOOST_MATH_GPU_ENABLED RealType shape()const; // Shape = scale/mean.
};
typedef inverse_gaussian_distribution<double> inverse_gaussian;

Expand Down Expand Up @@ -90,26 +90,28 @@ Another related parameterisation, the __wald_distrib (where mean [mu] is unity)

[h4 Member Functions]

inverse_gaussian_distribution(RealType df = 1, RealType scale = 1); // optionally scaled.
BOOST_MATH_GPU_ENABLED inverse_gaussian_distribution(RealType df = 1, RealType scale = 1); // optionally scaled.

Constructs an inverse_gaussian distribution with [mu] mean,
and scale [lambda], with both default values 1.

Requires that both the mean [mu] parameter and scale [lambda] are greater than zero,
otherwise calls __domain_error.

RealType mean()const;
BOOST_MATH_GPU_ENABLED RealType mean()const;

Returns the mean [mu] parameter of this distribution.

RealType scale()const;
BOOST_MATH_GPU_ENABLED RealType scale()const;

Returns the scale [lambda] parameter of this distribution.

[h4 Non-member Accessors]

All the [link math_toolkit.dist_ref.nmp usual non-member accessor functions] that are generic to all
distributions are supported: __usual_accessors.
For this distribution all non-member accessor functions are marked with `BOOST_MATH_GPU_ENABLED` and can
be run on both host and device.

The domain of the random variate is \[0,+[infin]).
[note Unlike some definitions, this implementation supports a random variate
Expand Down
14 changes: 8 additions & 6 deletions doc/distributions/lognormal.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
typedef RealType value_type;
typedef Policy policy_type;
// Construct:
lognormal_distribution(RealType location = 0, RealType scale = 1);
BOOST_MATH_GPU_ENABLED lognormal_distribution(RealType location = 0, RealType scale = 1);
// Accessors:
RealType location()const;
RealType scale()const;
BOOST_MATH_GPU_ENABLED RealType location()const;
BOOST_MATH_GPU_ENABLED RealType scale()const;
};

}} // namespaces
Expand Down Expand Up @@ -51,7 +51,7 @@ The next graph illustrates the effect of the scale parameter on the PDF:

[h4 Member Functions]

lognormal_distribution(RealType location = 0, RealType scale = 1);
BOOST_MATH_GPU_ENABLED lognormal_distribution(RealType location = 0, RealType scale = 1);

Constructs a lognormal distribution with location /location/ and
scale /scale/.
Expand All @@ -65,18 +65,20 @@ logarithm of the random variate.
Requires that the scale parameter is greater than zero, otherwise calls
__domain_error.

RealType location()const;
BOOST_MATH_GPU_ENABLED RealType location()const;

Returns the /location/ parameter of this distribution.

RealType scale()const;
BOOST_MATH_GPU_ENABLED RealType scale()const;

Returns the /scale/ parameter of this distribution.

[h4 Non-member Accessors]

All the [link math_toolkit.dist_ref.nmp usual non-member accessor functions] that are generic to all
distributions are supported: __usual_accessors.
For this distribution all non-member accessor functions are marked with `BOOST_MATH_GPU_ENABLED` and can
be run on both host and device.

The domain of the random variable is \[0,+[infin]\].

Expand Down
18 changes: 10 additions & 8 deletions doc/distributions/nc_beta.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
typedef Policy policy_type;

// Constructor:
non_central_beta_distribution(RealType alpha, RealType beta, RealType lambda);
BOOST_MATH_GPU_ENABLED non_central_beta_distribution(RealType alpha, RealType beta, RealType lambda);

// Accessor to shape parameters:
RealType alpha()const;
RealType beta()const;
BOOST_MATH_GPU_ENABLED RealType alpha()const;
BOOST_MATH_GPU_ENABLED RealType beta()const;

// Accessor to non-centrality parameter lambda:
RealType non_centrality()const;
BOOST_MATH_GPU_ENABLED RealType non_centrality()const;
};

}} // namespaces
Expand Down Expand Up @@ -59,22 +59,22 @@ for different values of [lambda]:

[h4 Member Functions]

non_central_beta_distribution(RealType a, RealType b, RealType lambda);
BOOST_MATH_GPU_ENABLED non_central_beta_distribution(RealType a, RealType b, RealType lambda);

Constructs a noncentral beta distribution with shape parameters /a/ and /b/
and non-centrality parameter /lambda/.

Requires a > 0, b > 0 and lambda >= 0, otherwise calls __domain_error.

RealType alpha()const;
BOOST_MATH_GPU_ENABLED RealType alpha()const;

Returns the parameter /a/ from which this object was constructed.

RealType beta()const;
BOOST_MATH_GPU_ENABLED RealType beta()const;

Returns the parameter /b/ from which this object was constructed.

RealType non_centrality()const;
BOOST_MATH_GPU_ENABLED RealType non_centrality()const;

Returns the parameter /lambda/ from which this object was constructed.

Expand All @@ -83,6 +83,8 @@ Returns the parameter /lambda/ from which this object was constructed.
Most of the [link math_toolkit.dist_ref.nmp usual non-member accessor functions]
are supported: __cdf, __pdf, __quantile, __mean, __variance, __sd,
__median, __mode, __hazard, __chf, __range and __support.
For this distribution these functions are marked with `BOOST_MATH_GPU_ENABLED` and can
be run on both host and device.

Mean and variance are implemented using hypergeometric pfq functions and relations given in
[@http://reference.wolfram.com/mathematica/ref/NoncentralBetaDistribution.html Wolfram Noncentral Beta Distribution].
Expand Down
35 changes: 18 additions & 17 deletions doc/distributions/nc_chi_squared.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@
typedef Policy policy_type;

// Constructor:
non_central_chi_squared_distribution(RealType v, RealType lambda);
BOOST_MATH_GPU_ENABLED non_central_chi_squared_distribution(RealType v, RealType lambda);

// Accessor to degrees of freedom parameter v:
RealType degrees_of_freedom()const;
BOOST_MATH_GPU_ENABLED RealType degrees_of_freedom()const;

// Accessor to non centrality parameter lambda:
RealType non_centrality()const;
BOOST_MATH_GPU_ENABLED RealType non_centrality()const;

// Parameter finders:
static RealType find_degrees_of_freedom(RealType lambda, RealType x, RealType p);
BOOST_MATH_GPU_ENABLED static RealType find_degrees_of_freedom(RealType lambda, RealType x, RealType p);
template <class A, class B, class C>
static RealType find_degrees_of_freedom(const complemented3_type<A,B,C>& c);
BOOST_MATH_GPU_ENABLED static RealType find_degrees_of_freedom(const complemented3_type<A,B,C>& c);

static RealType find_non_centrality(RealType v, RealType x, RealType p);
BOOST_MATH_GPU_ENABLED static RealType find_non_centrality(RealType v, RealType x, RealType p);
template <class A, class B, class C>
static RealType find_non_centrality(const complemented3_type<A,B,C>& c);
BOOST_MATH_GPU_ENABLED static RealType find_non_centrality(const complemented3_type<A,B,C>& c);
};

}} // namespaces
Expand Down Expand Up @@ -70,43 +70,42 @@ for different values of [lambda]:

[h4 Member Functions]

non_central_chi_squared_distribution(RealType v, RealType lambda);
BOOST_MATH_GPU_ENABLED non_central_chi_squared_distribution(RealType v, RealType lambda);

Constructs a Chi-Squared distribution with [nu] degrees of freedom
and non-centrality parameter /lambda/.

Requires [nu] > 0 and lambda >= 0, otherwise calls __domain_error.

RealType degrees_of_freedom()const;
BOOST_MATH_GPU_ENABLED RealType degrees_of_freedom()const;

Returns the parameter [nu] from which this object was constructed.

RealType non_centrality()const;
BOOST_MATH_GPU_ENABLED RealType non_centrality()const;

Returns the parameter /lambda/ from which this object was constructed.


static RealType find_degrees_of_freedom(RealType lambda, RealType x, RealType p);
BOOST_MATH_GPU_ENABLED static RealType find_degrees_of_freedom(RealType lambda, RealType x, RealType p);

This function returns the number of degrees of freedom [nu] such that:
`cdf(non_central_chi_squared<RealType, Policy>(v, lambda), x) == p`

template <class A, class B, class C>
static RealType find_degrees_of_freedom(const complemented3_type<A,B,C>& c);
template <class A, class B, class C>
BOOST_MATH_GPU_ENABLED static RealType find_degrees_of_freedom(const complemented3_type<A,B,C>& c);

When called with argument `boost::math::complement(lambda, x, q)`
this function returns the number of degrees of freedom [nu] such that:

`cdf(complement(non_central_chi_squared<RealType, Policy>(v, lambda), x)) == q`.

static RealType find_non_centrality(RealType v, RealType x, RealType p);
BOOST_MATH_GPU_ENABLED static RealType find_non_centrality(RealType v, RealType x, RealType p);

This function returns the non centrality parameter /lambda/ such that:

`cdf(non_central_chi_squared<RealType, Policy>(v, lambda), x) == p`

template <class A, class B, class C>
static RealType find_non_centrality(const complemented3_type<A,B,C>& c);
template <class A, class B, class C>
BOOST_MATH_GPU_ENABLED static RealType find_non_centrality(const complemented3_type<A,B,C>& c);

When called with argument `boost::math::complement(v, x, q)`
this function returns the non centrality parameter /lambda/ such that:
Expand All @@ -117,6 +116,8 @@ this function returns the non centrality parameter /lambda/ such that:

All the [link math_toolkit.dist_ref.nmp usual non-member accessor functions]
that are generic to all distributions are supported: __usual_accessors.
For this distribution all non-member accessor functions are marked with `BOOST_MATH_GPU_ENABLED` and can
be run on both host and device.

The domain of the random variable is \[0, +[infin]\].

Expand Down
18 changes: 10 additions & 8 deletions doc/distributions/nc_f.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
typedef Policy policy_type;

// Constructor:
non_central_f_distribution(RealType v1, RealType v2, RealType lambda);
BOOST_MATH_GPU_ENABLED non_central_f_distribution(RealType v1, RealType v2, RealType lambda);

// Accessor to degrees_of_freedom parameters v1 & v2:
RealType degrees_of_freedom1()const;
RealType degrees_of_freedom2()const;
BOOST_MATH_GPU_ENABLED RealType degrees_of_freedom1()const;
BOOST_MATH_GPU_ENABLED RealType degrees_of_freedom2()const;

// Accessor to non-centrality parameter lambda:
RealType non_centrality()const;
BOOST_MATH_GPU_ENABLED RealType non_centrality()const;
};

}} // namespaces
Expand Down Expand Up @@ -55,29 +55,31 @@ for different values of [lambda]:

[h4 Member Functions]

non_central_f_distribution(RealType v1, RealType v2, RealType lambda);
BOOST_MATH_GPU_ENABLED non_central_f_distribution(RealType v1, RealType v2, RealType lambda);

Constructs a non-central beta distribution with parameters /v1/ and /v2/
and non-centrality parameter /lambda/.

Requires /v1/ > 0, /v2/ > 0 and lambda >= 0, otherwise calls __domain_error.

RealType degrees_of_freedom1()const;
BOOST_MATH_GPU_ENABLED RealType degrees_of_freedom1()const;

Returns the parameter /v1/ from which this object was constructed.

RealType degrees_of_freedom2()const;
BOOST_MATH_GPU_ENABLED RealType degrees_of_freedom2()const;

Returns the parameter /v2/ from which this object was constructed.

RealType non_centrality()const;
BOOST_MATH_GPU_ENABLED RealType non_centrality()const;

Returns the non-centrality parameter /lambda/ from which this object was constructed.

[h4 Non-member Accessors]

All the [link math_toolkit.dist_ref.nmp usual non-member accessor functions]
that are generic to all distributions are supported: __usual_accessors.
For this distribution all non-member accessor functions are marked with `BOOST_MATH_GPU_ENABLED` and can
be run on both host and device.

The domain of the random variable is \[0, +[infin]\].

Expand Down
30 changes: 16 additions & 14 deletions doc/distributions/negative_binomial.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,28 @@
typedef RealType value_type;
typedef Policy policy_type;
// Constructor from successes and success_fraction:
negative_binomial_distribution(RealType r, RealType p);
BOOST_MATH_GPU_ENABLED negative_binomial_distribution(RealType r, RealType p);

// Parameter accessors:
RealType success_fraction() const;
RealType successes() const;
BOOST_MATH_GPU_ENABLED RealType success_fraction() const;
BOOST_MATH_GPU_ENABLED RealType successes() const;

// Bounds on success fraction:
static RealType find_lower_bound_on_p(
BOOST_MATH_GPU_ENABLED static RealType find_lower_bound_on_p(
RealType trials,
RealType successes,
RealType probability); // alpha
static RealType find_upper_bound_on_p(
BOOST_MATH_GPU_ENABLED static RealType find_upper_bound_on_p(
RealType trials,
RealType successes,
RealType probability); // alpha

// Estimate min/max number of trials:
static RealType find_minimum_number_of_trials(
BOOST_MATH_GPU_ENABLED static RealType find_minimum_number_of_trials(
RealType k, // Number of failures.
RealType p, // Success fraction.
RealType probability); // Probability threshold alpha.
static RealType find_maximum_number_of_trials(
BOOST_MATH_GPU_ENABLED static RealType find_maximum_number_of_trials(
RealType k, // Number of failures.
RealType p, // Success fraction.
RealType probability); // Probability threshold alpha.
Expand Down Expand Up @@ -112,7 +112,7 @@ poisson([lambda]) = lim [sub r [rarr] [infin]] negative_binomial(r, r / ([lambda

[h5 Construct]

negative_binomial_distribution(RealType r, RealType p);
BOOST_MATH_GPU_ENABLED negative_binomial_distribution(RealType r, RealType p);

Constructor: /r/ is the total number of successes, /p/ is the
probability of success of a single trial.
Expand All @@ -121,11 +121,11 @@ Requires: `r > 0` and `0 <= p <= 1`.

[h5 Accessors]

RealType success_fraction() const; // successes / trials (0 <= p <= 1)
BOOST_MATH_GPU_ENABLED RealType success_fraction() const; // successes / trials (0 <= p <= 1)

Returns the parameter /p/ from which this distribution was constructed.

RealType successes() const; // required successes (r > 0)
BOOST_MATH_GPU_ENABLED RealType successes() const; // required successes (r > 0)

Returns the parameter /r/ from which this distribution was constructed.

Expand All @@ -134,7 +134,7 @@ see __binomial_distrib for more discussion.

[h5 Lower Bound on Parameter p]

static RealType find_lower_bound_on_p(
BOOST_MATH_GPU_ENABLED static RealType find_lower_bound_on_p(
RealType failures,
RealType successes,
RealType probability) // (0 <= alpha <= 1), 0.05 equivalent to 95% confidence.
Expand Down Expand Up @@ -170,7 +170,7 @@ Computational statistics and data analysis, 2005, vol. 48, no3, 605-621].

[h5 Upper Bound on Parameter p]

static RealType find_upper_bound_on_p(
BOOST_MATH_GPU_ENABLED static RealType find_upper_bound_on_p(
RealType trials,
RealType successes,
RealType alpha); // (0 <= alpha <= 1), 0.05 equivalent to 95% confidence.
Expand Down Expand Up @@ -206,7 +206,7 @@ Computational statistics and data analysis, 2005, vol. 48, no3, 605-621].

[h5 Estimating Number of Trials to Ensure at Least a Certain Number of Failures]

static RealType find_minimum_number_of_trials(
BOOST_MATH_GPU_ENABLED static RealType find_minimum_number_of_trials(
RealType k, // number of failures.
RealType p, // success fraction.
RealType alpha); // probability threshold (0.05 equivalent to 95%).
Expand Down Expand Up @@ -236,7 +236,7 @@ of observing k failures or fewer.

[h5 Estimating Number of Trials to Ensure a Maximum Number of Failures or Less]

static RealType find_maximum_number_of_trials(
BOOST_MATH_GPU_ENABLED static RealType find_maximum_number_of_trials(
RealType k, // number of failures.
RealType p, // success fraction.
RealType alpha); // probability threshold (0.05 equivalent to 95%).
Expand Down Expand Up @@ -266,6 +266,8 @@ of observing more than k failures.

All the [link math_toolkit.dist_ref.nmp usual non-member accessor functions]
that are generic to all distributions are supported: __usual_accessors.
For this distribution all non-member accessor functions are marked with `BOOST_MATH_GPU_ENABLED` and can
be run on both host and device.

However it's worth taking a moment to define what these actually mean in
the context of this distribution:
Expand Down
Loading

0 comments on commit 937107a

Please sign in to comment.