template<typename T, typename F, class DeviceType>
&& requires(const T& obj, Kokkos::Random_XorShift1024<DeviceType>& gen)
{
{
obj.draw(gen)
} -> std::same_as<F>;
{
obj.mean()
} -> std::same_as<F>;
{
obj.var()
} -> std::same_as<F>;
{
obj.skewness()
} -> std::same_as<F>;
}
Concept for probability distribution laws.
Definition prng_extension.hpp:52
Concept for probability distribution laws.
The ProbabilityLaw concept defines the requirements for a type T to model a probability distribution with floating-point computations. It ensures that the type provides methods for drawing random samples and computing common statistical measures such as mean, variance, and skewness.
- Template Parameters
-
| T | The type representing a probability distribution. |
| F | The floating-point type used for computations. |
| DeviceType | The execution device type for random number generation. |
Requirements:
- T must support sampling using a Kokkos random number generator.
- T must provide methods to compute statistical properties:
- mean(): Returns the expected value (mean) of the distribution.
- var(): Returns the variance of the distribution.
- skewness(): Returns the skewness, measuring asymmetry.
Example usage:
struct NormalDistribution {
double mean() const { return mu; }
double var() const { return sigma * sigma; }
double skewness() const { return 0.0; }
double draw(Kokkos::Random_XorShift1024<DeviceType>& gen) {return 0.; }
};
static_assert(ProbabilityLaw<NormalDistribution, double, DeviceType>);