mkl-devel-dpcpp 2025.1.0__py2.py3-none-win_amd64.whl → 2025.2.0__py2.py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mkl-devel-dpcpp might be problematic. Click here for more details.
- {mkl_devel_dpcpp-2025.1.0.data → mkl_devel_dpcpp-2025.2.0.data}/data/Library/lib/mkl_sycl.lib +0 -0
- mkl_devel_dpcpp-2025.2.0.data/data/Library/lib/mkl_sycl_dft_dll.lib +0 -0
- {mkl_devel_dpcpp-2025.1.0.data → mkl_devel_dpcpp-2025.2.0.data}/data/Library/lib/mkl_sycl_dll.lib +0 -0
- mkl_devel_dpcpp-2025.2.0.data/data/Library/lib/mkl_sycl_lapack_dll.lib +0 -0
- {mkl_devel_dpcpp-2025.1.0.data → mkl_devel_dpcpp-2025.2.0.data}/data/Library/lib/mkl_sycl_rng_dll.lib +0 -0
- mkl_devel_dpcpp-2025.2.0.data/data/Library/lib/mkl_sycl_sparse_dll.lib +0 -0
- {mkl_devel_dpcpp-2025.1.0.dist-info → mkl_devel_dpcpp-2025.2.0.dist-info}/METADATA +4 -3
- mkl_devel_dpcpp-2025.2.0.dist-info/RECORD +15 -0
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/bfloat16.hpp +0 -26
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/blas/buffer.hpp +0 -42
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/blas/buffer_decls.hpp +0 -880
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/blas/spec.hpp +0 -42
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/blas/types.hpp +0 -60
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/blas/usm.hpp +0 -42
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/blas/usm_decls.hpp +0 -1240
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/blas.hpp +0 -34
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/dft/spec.hpp +0 -42
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/dft.hpp +0 -254
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/dfti.hpp +0 -22
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/exceptions.hpp +0 -110
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/experimental/data_fitting/interpolate.hpp +0 -67
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/experimental/data_fitting/spline_and_data_params.hpp +0 -68
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/experimental/data_fitting/splines.hpp +0 -177
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/experimental/data_fitting.hpp +0 -22
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/export.hpp +0 -25
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/lapack/concepts.hpp +0 -55
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/lapack/exceptions.hpp +0 -75
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/lapack/lapack.hpp +0 -1096
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/lapack/scratchpad.hpp +0 -107
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/lapack/spec.hpp +0 -42
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/lapack.hpp +0 -24
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/detail/engine_base.hpp +0 -48
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/detail/bernoulli_impl.hpp +0 -89
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/detail/beta_impl.hpp +0 -463
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/detail/bits_impl.hpp +0 -71
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/detail/distribution_base.hpp +0 -85
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/detail/engine_base.hpp +0 -43
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/detail/engine_helpers_base.hpp +0 -54
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/detail/exponential_impl.hpp +0 -116
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/detail/gamma_impl.hpp +0 -285
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/detail/gaussian_impl.hpp +0 -270
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/detail/geometric_impl.hpp +0 -99
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/detail/lognormal_impl.hpp +0 -105
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/detail/mcg31m1_helpers_impl.hpp +0 -117
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/detail/mcg31m1_impl.hpp +0 -223
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/detail/mcg59_helpers_impl.hpp +0 -118
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/detail/mcg59_impl.hpp +0 -266
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/detail/mrg32k3a_helpers_impl.hpp +0 -125
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/detail/mrg32k3a_impl.hpp +0 -385
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/detail/mrg32k3a_skip_ahead_matrix.hpp +0 -3668
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/detail/philox4x32x10_helpers_impl.hpp +0 -141
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/detail/philox4x32x10_impl.hpp +0 -552
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/detail/poisson_impl.hpp +0 -328
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/detail/types.hpp +0 -58
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/detail/uniform_bits_impl.hpp +0 -51
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/detail/uniform_impl.hpp +0 -287
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/detail/vm_wrappers.hpp +0 -183
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/distributions.hpp +0 -700
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/engine_helpers.hpp +0 -116
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/engines.hpp +0 -187
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/functions.hpp +0 -59
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device/types.hpp +0 -79
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/device.hpp +0 -29
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/distributions.hpp +0 -1913
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/engines.hpp +0 -788
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/functions.hpp +0 -163
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng/spec.hpp +0 -42
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/rng.hpp +0 -23
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/spblas/sparse_auxiliary.hpp +0 -111
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/spblas/sparse_operations.hpp +0 -446
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/spblas/sparse_structures.hpp +0 -193
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/spblas/spec.hpp +0 -42
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/spblas.hpp +0 -33
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/spec.hpp +0 -42
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/stats/spec.hpp +0 -42
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/stats.hpp +0 -357
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/types.hpp +0 -321
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/vm/buffer.hpp +0 -3529
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/vm/decls.hpp +0 -280
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/vm/device/detail/decls.hpp +0 -81
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/vm/device/detail/dispatch.hpp +0 -1059
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/vm/device/detail/ep.hpp +0 -861
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/vm/device/detail/ha.hpp +0 -860
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/vm/device/detail/la.hpp +0 -860
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/vm/device/detail/rts.hpp +0 -4608
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/vm/device/detail/scalar.hpp +0 -8963
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/vm/device/vm.hpp +0 -460
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/vm/span.hpp +0 -3813
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/vm/spec.hpp +0 -42
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/vm/usm.hpp +0 -3581
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl/vm.hpp +0 -31
- mkl_devel_dpcpp-2025.1.0.data/data/Library/include/oneapi/mkl.hpp +0 -35
- mkl_devel_dpcpp-2025.1.0.data/data/Library/lib/mkl_sycl_dft_dll.lib +0 -0
- mkl_devel_dpcpp-2025.1.0.data/data/Library/lib/mkl_sycl_lapack_dll.lib +0 -0
- mkl_devel_dpcpp-2025.1.0.data/data/Library/lib/mkl_sycl_sparse_dll.lib +0 -0
- mkl_devel_dpcpp-2025.1.0.dist-info/RECORD +0 -99
- {mkl_devel_dpcpp-2025.1.0.data → mkl_devel_dpcpp-2025.2.0.data}/data/Library/lib/mkl_sycl_blas_dll.lib +0 -0
- {mkl_devel_dpcpp-2025.1.0.data → mkl_devel_dpcpp-2025.2.0.data}/data/Library/lib/mkl_sycl_data_fitting_dll.lib +0 -0
- {mkl_devel_dpcpp-2025.1.0.data → mkl_devel_dpcpp-2025.2.0.data}/data/Library/lib/mkl_sycl_stats_dll.lib +0 -0
- {mkl_devel_dpcpp-2025.1.0.data → mkl_devel_dpcpp-2025.2.0.data}/data/Library/lib/mkl_sycl_vm_dll.lib +0 -0
- {mkl_devel_dpcpp-2025.1.0.dist-info → mkl_devel_dpcpp-2025.2.0.dist-info}/LICENSE.txt +0 -0
- {mkl_devel_dpcpp-2025.1.0.dist-info → mkl_devel_dpcpp-2025.2.0.dist-info}/WHEEL +0 -0
- {mkl_devel_dpcpp-2025.1.0.dist-info → mkl_devel_dpcpp-2025.2.0.dist-info}/top_level.txt +0 -0
|
@@ -1,1913 +0,0 @@
|
|
|
1
|
-
/*******************************************************************************
|
|
2
|
-
* Copyright (C) 2019 Intel Corporation
|
|
3
|
-
*
|
|
4
|
-
* This software and the related documents are Intel copyrighted materials, and
|
|
5
|
-
* your use of them is governed by the express license under which they were
|
|
6
|
-
* provided to you (License). Unless the License provides otherwise, you may not
|
|
7
|
-
* use, modify, copy, publish, distribute, disclose or transmit this software or
|
|
8
|
-
* the related documents without Intel's prior written permission.
|
|
9
|
-
*
|
|
10
|
-
* This software and the related documents are provided as is, with no express
|
|
11
|
-
* or implied warranties, other than those that are expressly stated in the
|
|
12
|
-
* License.
|
|
13
|
-
*******************************************************************************/
|
|
14
|
-
|
|
15
|
-
#ifndef _MKL_RNG_DISTRIBUTIONS_HPP_
|
|
16
|
-
#define _MKL_RNG_DISTRIBUTIONS_HPP_
|
|
17
|
-
|
|
18
|
-
#include <stdexcept>
|
|
19
|
-
#include <vector>
|
|
20
|
-
#include <limits>
|
|
21
|
-
|
|
22
|
-
#include "oneapi/mkl/exceptions.hpp"
|
|
23
|
-
|
|
24
|
-
namespace oneapi {
|
|
25
|
-
namespace mkl {
|
|
26
|
-
namespace rng {
|
|
27
|
-
|
|
28
|
-
// CONTINUOUS AND DISCRETE RANDOM NUMBER DISTRIBUTIONS
|
|
29
|
-
|
|
30
|
-
// Class template oneapi::mkl::rng::uniform
|
|
31
|
-
//
|
|
32
|
-
// Represents continuous and discrete uniform random number distribution
|
|
33
|
-
//
|
|
34
|
-
// Supported types:
|
|
35
|
-
// float
|
|
36
|
-
// double
|
|
37
|
-
// std::int32_t
|
|
38
|
-
// std::uint32_t
|
|
39
|
-
//
|
|
40
|
-
// Supported methods:
|
|
41
|
-
// oneapi::mkl::rng::uniform_method::standard
|
|
42
|
-
// oneapi::mkl::rng::uniform_method::accurate
|
|
43
|
-
//
|
|
44
|
-
// Input arguments:
|
|
45
|
-
// a - left bound. 0.0 by default
|
|
46
|
-
// b - right bound. 1.0 by default (for std::(u)int32_t std::numeric_limits<std::(u)int32_t>::max()
|
|
47
|
-
// is used for accurate method and 2^23 is used for standard method)
|
|
48
|
-
//
|
|
49
|
-
// Note: using (un)signed integer uniform distribution with uniform_method::standard method may
|
|
50
|
-
// cause incorrect statistics of the produced random numbers (due to rounding error) if
|
|
51
|
-
// (abs(b - a) > 2^23) || (abs(b) > 2^23) || (abs(a) > 2^23)
|
|
52
|
-
// Please use uniform_method::accurate method instead
|
|
53
|
-
//
|
|
54
|
-
namespace uniform_method {
|
|
55
|
-
struct standard {};
|
|
56
|
-
struct accurate {};
|
|
57
|
-
using by_default = standard;
|
|
58
|
-
} // namespace uniform_method
|
|
59
|
-
|
|
60
|
-
template <typename Type = float, typename Method = uniform_method::by_default>
|
|
61
|
-
class uniform {
|
|
62
|
-
public:
|
|
63
|
-
static_assert(std::is_same<Method, uniform_method::standard>::value ||
|
|
64
|
-
std::is_same<Method, uniform_method::accurate>::value,
|
|
65
|
-
"oneMKL: rng/uniform: method is incorrect");
|
|
66
|
-
|
|
67
|
-
static_assert(std::is_same<Type, float>::value || std::is_same<Type, double>::value ||
|
|
68
|
-
std::is_same<Type, std::int32_t>::value ||
|
|
69
|
-
std::is_same<Type, std::uint32_t>::value,
|
|
70
|
-
"oneMKL: rng/uniform: type is not supported");
|
|
71
|
-
|
|
72
|
-
using method_type = Method;
|
|
73
|
-
using result_type = Type;
|
|
74
|
-
|
|
75
|
-
struct param_type {
|
|
76
|
-
param_type(Type a, Type b) : a_(a), b_(b) {}
|
|
77
|
-
Type a_;
|
|
78
|
-
Type b_;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
uniform()
|
|
82
|
-
: uniform(static_cast<Type>(0.0),
|
|
83
|
-
std::is_integral<Type>::value
|
|
84
|
-
? (std::is_same<Method, uniform_method::standard>::value
|
|
85
|
-
? (1 << 23)
|
|
86
|
-
: (std::numeric_limits<Type>::max)())
|
|
87
|
-
: static_cast<Type>(1.0)) {}
|
|
88
|
-
|
|
89
|
-
explicit uniform(Type a, Type b) : a_(a), b_(b) {
|
|
90
|
-
if (a >= b) {
|
|
91
|
-
throw oneapi::mkl::invalid_argument("rng", "uniform", "a >= b");
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
explicit uniform(const param_type& pt) : a_(pt.a_), b_(pt.b_) {
|
|
96
|
-
if (pt.a_ >= pt.b_) {
|
|
97
|
-
throw oneapi::mkl::invalid_argument("rng", "uniform", "a >= b");
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
Type a() const {
|
|
102
|
-
return a_;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
Type b() const {
|
|
106
|
-
return b_;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
param_type param() const {
|
|
110
|
-
return param_type(a_, b_);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
void param(const param_type& pt) {
|
|
114
|
-
if (pt.a_ >= pt.b_) {
|
|
115
|
-
throw oneapi::mkl::invalid_argument("rng", "uniform", "a >= b");
|
|
116
|
-
}
|
|
117
|
-
a_ = pt.a_;
|
|
118
|
-
b_ = pt.b_;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
private:
|
|
122
|
-
Type a_;
|
|
123
|
-
Type b_;
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
// Class template oneapi::mkl::rng::gaussian
|
|
127
|
-
//
|
|
128
|
-
// Represents continuous normal random number distribution
|
|
129
|
-
//
|
|
130
|
-
// Supported types:
|
|
131
|
-
// float
|
|
132
|
-
// double
|
|
133
|
-
//
|
|
134
|
-
// Supported methods:
|
|
135
|
-
// oneapi::mkl::rng::gaussian_method::box_muller
|
|
136
|
-
// oneapi::mkl::rng::gaussian_method::box_muller2
|
|
137
|
-
// oneapi::mkl::rng::gaussian_method::icdf
|
|
138
|
-
//
|
|
139
|
-
// Input arguments:
|
|
140
|
-
// mean - mean. 0 by default
|
|
141
|
-
// stddev - standard deviation. 1.0 by default
|
|
142
|
-
|
|
143
|
-
namespace gaussian_method {
|
|
144
|
-
struct icdf {};
|
|
145
|
-
struct box_muller {};
|
|
146
|
-
struct box_muller2 {};
|
|
147
|
-
using by_default = box_muller2;
|
|
148
|
-
} // namespace gaussian_method
|
|
149
|
-
|
|
150
|
-
template <typename RealType = float, typename Method = gaussian_method::by_default>
|
|
151
|
-
class gaussian {
|
|
152
|
-
public:
|
|
153
|
-
static_assert(std::is_same<Method, gaussian_method::icdf>::value ||
|
|
154
|
-
std::is_same<Method, gaussian_method::box_muller>::value ||
|
|
155
|
-
std::is_same<Method, gaussian_method::box_muller2>::value,
|
|
156
|
-
"oneMKL: rng/gaussian: method is incorrect");
|
|
157
|
-
|
|
158
|
-
static_assert(std::is_same<RealType, float>::value || std::is_same<RealType, double>::value,
|
|
159
|
-
"oneMKL: rng/gaussian: type is not supported");
|
|
160
|
-
|
|
161
|
-
using method_type = Method;
|
|
162
|
-
using result_type = RealType;
|
|
163
|
-
|
|
164
|
-
struct param_type {
|
|
165
|
-
param_type(RealType mean, RealType stddev) : mean_(mean), stddev_(stddev) {}
|
|
166
|
-
RealType mean_;
|
|
167
|
-
RealType stddev_;
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
gaussian() : gaussian(static_cast<RealType>(0.0), static_cast<RealType>(1.0)) {}
|
|
171
|
-
|
|
172
|
-
explicit gaussian(RealType mean, RealType stddev) : mean_(mean), stddev_(stddev) {
|
|
173
|
-
if (stddev <= static_cast<RealType>(0.0)) {
|
|
174
|
-
throw oneapi::mkl::invalid_argument("rng", "gaussian", "stddev <= 0");
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
explicit gaussian(const param_type& pt) : mean_(pt.mean_), stddev_(pt.stddev_) {
|
|
179
|
-
if (pt.stddev_ <= static_cast<RealType>(0.0)) {
|
|
180
|
-
throw oneapi::mkl::invalid_argument("rng", "gaussian", "stddev <= 0");
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
RealType mean() const {
|
|
185
|
-
return mean_;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
RealType stddev() const {
|
|
189
|
-
return stddev_;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
param_type param() const {
|
|
193
|
-
return param_type(mean_, stddev_);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
void param(const param_type& pt) {
|
|
197
|
-
if (pt.stddev_ <= static_cast<RealType>(0.0)) {
|
|
198
|
-
throw oneapi::mkl::invalid_argument("rng", "gaussian", "stddev <= 0");
|
|
199
|
-
}
|
|
200
|
-
mean_ = pt.mean_;
|
|
201
|
-
stddev_ = pt.stddev_;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
private:
|
|
205
|
-
RealType mean_;
|
|
206
|
-
RealType stddev_;
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
// Class template oneapi::mkl::rng::gaussian_mv
|
|
210
|
-
//
|
|
211
|
-
// Represents continuous multivariate normal random number distribution
|
|
212
|
-
//
|
|
213
|
-
// Supported types:
|
|
214
|
-
// float
|
|
215
|
-
// double
|
|
216
|
-
//
|
|
217
|
-
// Supported methods:
|
|
218
|
-
// oneapi::mkl::rng::gaussian_mv_method::box_muller
|
|
219
|
-
// oneapi::mkl::rng::gaussian_mv_method::box_muller2
|
|
220
|
-
// oneapi::mkl::rng::gaussian_mv_method::icdf
|
|
221
|
-
//
|
|
222
|
-
// Supported layouts:
|
|
223
|
-
// oneapi::mkl::rng::layout::full
|
|
224
|
-
// oneapi::mkl::rng::layout::packed
|
|
225
|
-
// oneapi::mkl::rng::layout::diagonal
|
|
226
|
-
//
|
|
227
|
-
// Input arguments:
|
|
228
|
-
// dimen - dimension of output random vectors
|
|
229
|
-
// mean - mean vector of dimension d
|
|
230
|
-
// matrix - elements of the lower triangular matrix passed
|
|
231
|
-
// according to the matrix storage scheme
|
|
232
|
-
|
|
233
|
-
// Matrix storage layout for gaussian_mv distribution
|
|
234
|
-
enum class layout : std::uint32_t { full, packed, diagonal };
|
|
235
|
-
|
|
236
|
-
namespace gaussian_mv_method {
|
|
237
|
-
struct icdf {};
|
|
238
|
-
struct box_muller {};
|
|
239
|
-
struct box_muller2 {};
|
|
240
|
-
using by_default = icdf;
|
|
241
|
-
} // namespace gaussian_mv_method
|
|
242
|
-
|
|
243
|
-
template <typename RealType = float, layout Layout = layout::packed,
|
|
244
|
-
typename Method = gaussian_mv_method::by_default>
|
|
245
|
-
class gaussian_mv {
|
|
246
|
-
public:
|
|
247
|
-
static_assert(std::is_same<Method, gaussian_mv_method::icdf>::value ||
|
|
248
|
-
std::is_same<Method, gaussian_mv_method::box_muller>::value ||
|
|
249
|
-
std::is_same<Method, gaussian_mv_method::box_muller2>::value,
|
|
250
|
-
"oneMKL: rng/gaussian_mv: method is incorrect");
|
|
251
|
-
|
|
252
|
-
static_assert((Layout == layout::full) || (Layout == layout::packed) ||
|
|
253
|
-
(Layout == layout::diagonal),
|
|
254
|
-
"oneMKL: rng/gaussian_mv: layout is incorrect");
|
|
255
|
-
|
|
256
|
-
static_assert(std::is_same<RealType, float>::value || std::is_same<RealType, double>::value,
|
|
257
|
-
"oneMKL: rng/gaussian_mv: type is not supported");
|
|
258
|
-
|
|
259
|
-
using method_type = Method;
|
|
260
|
-
using result_type = RealType;
|
|
261
|
-
static constexpr layout layout_type = Layout;
|
|
262
|
-
|
|
263
|
-
struct param_type {
|
|
264
|
-
param_type(std::uint32_t dimen, sycl::span<RealType> mean, sycl::span<RealType> matrix)
|
|
265
|
-
: dimen_(dimen),
|
|
266
|
-
mean_span_(mean),
|
|
267
|
-
matrix_span_(matrix) {}
|
|
268
|
-
|
|
269
|
-
std::uint32_t dimen_;
|
|
270
|
-
sycl::span<RealType> mean_span_;
|
|
271
|
-
sycl::span<RealType> matrix_span_;
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
explicit gaussian_mv(std::uint32_t dimen, sycl::span<RealType> mean,
|
|
275
|
-
sycl::span<RealType> matrix)
|
|
276
|
-
: dimen_(dimen),
|
|
277
|
-
mean_span_(mean),
|
|
278
|
-
matrix_span_(matrix) {
|
|
279
|
-
if ((mean.size() != dimen)) {
|
|
280
|
-
throw oneapi::mkl::invalid_argument("rng", "gaussian_mv", "'mean' vector size is incorrect");
|
|
281
|
-
}
|
|
282
|
-
if ((matrix.size() != dimen * dimen) && (matrix.size() != dimen) &&
|
|
283
|
-
(matrix.size() != dimen * (dimen + 1) / 2)) {
|
|
284
|
-
throw oneapi::mkl::invalid_argument("rng", "gaussian_mv", "'matrix' size is incorrect");
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
explicit gaussian_mv(const param_type& pt)
|
|
289
|
-
: dimen_(pt.dimen_),
|
|
290
|
-
mean_span_(pt.mean_span_),
|
|
291
|
-
matrix_span_(pt.matrix_span_) {
|
|
292
|
-
|
|
293
|
-
if ((pt.mean_span_.size() <= 0)) {
|
|
294
|
-
throw oneapi::mkl::invalid_argument("rng", "gaussian_mv", "'mean' vector size is < 0");
|
|
295
|
-
}
|
|
296
|
-
if ((pt.matrix_span_.size() <= 0)) {
|
|
297
|
-
throw oneapi::mkl::invalid_argument("rng", "gaussian_mv", "'matrix' size is < 0");
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
std::uint32_t dimen() const {
|
|
302
|
-
return dimen_;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
sycl::span<RealType> mean() const {
|
|
306
|
-
return mean_span_;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
sycl::span<RealType> matrix() const {
|
|
310
|
-
return matrix_span_;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
param_type param() const {
|
|
314
|
-
return param_type(dimen_, mean_span_, matrix_span_);
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
void param(const param_type& pt) {
|
|
318
|
-
if ((pt.mean_span_.size() <= 0)) {
|
|
319
|
-
throw oneapi::mkl::invalid_argument("rng", "gaussian_mv", "'mean' vector size is < 0");
|
|
320
|
-
}
|
|
321
|
-
if ((pt.matrix_span_.size() <= 0)) {
|
|
322
|
-
throw oneapi::mkl::invalid_argument("rng", "gaussian_mv", "'matrix' size is < 0");
|
|
323
|
-
}
|
|
324
|
-
dimen_ = pt.dimen_;
|
|
325
|
-
mean_span_ = pt.mean_span_;
|
|
326
|
-
matrix_span_ = pt.matrix_span_;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
private:
|
|
330
|
-
std::uint32_t dimen_;
|
|
331
|
-
sycl::span<RealType> mean_span_;
|
|
332
|
-
sycl::span<RealType> matrix_span_;
|
|
333
|
-
};
|
|
334
|
-
|
|
335
|
-
// Class template oneapi::mkl::rng::lognormal
|
|
336
|
-
//
|
|
337
|
-
// Represents continuous lognormal random number distribution
|
|
338
|
-
//
|
|
339
|
-
// Supported types:
|
|
340
|
-
// float
|
|
341
|
-
// double
|
|
342
|
-
//
|
|
343
|
-
// Supported methods:
|
|
344
|
-
// oneapi::mkl::rng::lognormal_method::box_muller2
|
|
345
|
-
// oneapi::mkl::rng::lognormal_method::icdf
|
|
346
|
-
//
|
|
347
|
-
// Input arguments:
|
|
348
|
-
// m - mean of the subject normal distribution. 0.0 by default
|
|
349
|
-
// s - standard deviation of the subject normal distribution. 1.0 by default
|
|
350
|
-
// displ - displacement. 0.0 by default
|
|
351
|
-
// scale - scalefactor. 1.0 by default
|
|
352
|
-
|
|
353
|
-
namespace lognormal_method {
|
|
354
|
-
struct icdf {};
|
|
355
|
-
struct box_muller2 {};
|
|
356
|
-
struct icdf_accurate {};
|
|
357
|
-
struct box_muller2_accurate {};
|
|
358
|
-
using by_default = box_muller2;
|
|
359
|
-
} // namespace lognormal_method
|
|
360
|
-
|
|
361
|
-
template <typename RealType = float, typename Method = lognormal_method::by_default>
|
|
362
|
-
class lognormal {
|
|
363
|
-
public:
|
|
364
|
-
static_assert(std::is_same<Method, lognormal_method::box_muller2>::value ||
|
|
365
|
-
std::is_same<Method, lognormal_method::icdf>::value ||
|
|
366
|
-
std::is_same<Method, lognormal_method::box_muller2_accurate>::value ||
|
|
367
|
-
std::is_same<Method, lognormal_method::icdf_accurate>::value,
|
|
368
|
-
"oneMKL: rng/lognormal: method is incorrect");
|
|
369
|
-
|
|
370
|
-
static_assert(std::is_same<RealType, float>::value || std::is_same<RealType, double>::value,
|
|
371
|
-
"oneMKL: rng/lognormal: type is not supported");
|
|
372
|
-
|
|
373
|
-
using method_type = Method;
|
|
374
|
-
using result_type = RealType;
|
|
375
|
-
|
|
376
|
-
struct param_type {
|
|
377
|
-
param_type(RealType m, RealType s, RealType displ, RealType scale)
|
|
378
|
-
: m_(m),
|
|
379
|
-
s_(s),
|
|
380
|
-
displ_(displ),
|
|
381
|
-
scale_(scale) {}
|
|
382
|
-
RealType m_;
|
|
383
|
-
RealType s_;
|
|
384
|
-
RealType displ_;
|
|
385
|
-
RealType scale_;
|
|
386
|
-
};
|
|
387
|
-
|
|
388
|
-
lognormal()
|
|
389
|
-
: lognormal(static_cast<RealType>(0.0), static_cast<RealType>(1.0),
|
|
390
|
-
static_cast<RealType>(0.0), static_cast<RealType>(1.0)) {}
|
|
391
|
-
|
|
392
|
-
explicit lognormal(RealType m, RealType s, RealType displ = static_cast<RealType>(0.0),
|
|
393
|
-
RealType scale = static_cast<RealType>(1.0))
|
|
394
|
-
: m_(m),
|
|
395
|
-
s_(s),
|
|
396
|
-
displ_(displ),
|
|
397
|
-
scale_(scale) {
|
|
398
|
-
if (s <= static_cast<RealType>(0.0)) {
|
|
399
|
-
throw oneapi::mkl::invalid_argument("rng", "lognormal", "s <= 0");
|
|
400
|
-
}
|
|
401
|
-
if (scale <= static_cast<RealType>(0.0)) {
|
|
402
|
-
throw oneapi::mkl::invalid_argument("rng", "lognormal", "scale <= 0");
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
explicit lognormal(const param_type& pt)
|
|
407
|
-
: m_(pt.m_),
|
|
408
|
-
s_(pt.s_),
|
|
409
|
-
displ_(pt.displ_),
|
|
410
|
-
scale_(pt.scale_) {
|
|
411
|
-
if (pt.s_ <= static_cast<RealType>(0.0)) {
|
|
412
|
-
throw oneapi::mkl::invalid_argument("rng", "lognormal", "s <= 0");
|
|
413
|
-
}
|
|
414
|
-
if (pt.scale_ <= static_cast<RealType>(0.0)) {
|
|
415
|
-
throw oneapi::mkl::invalid_argument("rng", "lognormal", "scale <= 0");
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
RealType m() const {
|
|
420
|
-
return m_;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
RealType s() const {
|
|
424
|
-
return s_;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
RealType displ() const {
|
|
428
|
-
return displ_;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
RealType scale() const {
|
|
432
|
-
return scale_;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
param_type param() const {
|
|
436
|
-
return param_type(m_, s_, displ_, scale_);
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
void param(const param_type& pt) {
|
|
440
|
-
if (pt.s_ <= static_cast<RealType>(0.0)) {
|
|
441
|
-
throw oneapi::mkl::invalid_argument("rng", "lognormal", "s <= 0");
|
|
442
|
-
}
|
|
443
|
-
if (pt.scale_ <= static_cast<RealType>(0.0)) {
|
|
444
|
-
throw oneapi::mkl::invalid_argument("rng", "lognormal", "scale <= 0");
|
|
445
|
-
}
|
|
446
|
-
m_ = pt.m_;
|
|
447
|
-
s_ = pt.s_;
|
|
448
|
-
displ_ = pt.displ_;
|
|
449
|
-
scale_ = pt.scale_;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
private:
|
|
453
|
-
RealType m_;
|
|
454
|
-
RealType s_;
|
|
455
|
-
RealType displ_;
|
|
456
|
-
RealType scale_;
|
|
457
|
-
};
|
|
458
|
-
|
|
459
|
-
// Class template oneapi::mkl::rng::beta
|
|
460
|
-
//
|
|
461
|
-
// Represents continuous beta random number distribution
|
|
462
|
-
//
|
|
463
|
-
// Supported types:
|
|
464
|
-
// float
|
|
465
|
-
// double
|
|
466
|
-
//
|
|
467
|
-
// Supported methods:
|
|
468
|
-
// oneapi::mkl::rng::beta_method::cja
|
|
469
|
-
// oneapi::mkl::rng::beta_method::cja_accurate
|
|
470
|
-
//
|
|
471
|
-
// Input arguments:
|
|
472
|
-
// p - shape. 1.0 by default
|
|
473
|
-
// q - shape. 1.0 by default
|
|
474
|
-
// a - displacement. 0.0 by default
|
|
475
|
-
// b - scalefactor. 1.0 by default
|
|
476
|
-
|
|
477
|
-
namespace beta_method {
|
|
478
|
-
struct cja {};
|
|
479
|
-
struct cja_accurate {};
|
|
480
|
-
using by_default = cja;
|
|
481
|
-
} // namespace beta_method
|
|
482
|
-
|
|
483
|
-
template <typename RealType = float, typename Method = beta_method::by_default>
|
|
484
|
-
class beta {
|
|
485
|
-
public:
|
|
486
|
-
static_assert(std::is_same<Method, beta_method::cja>::value ||
|
|
487
|
-
std::is_same<Method, beta_method::cja_accurate>::value,
|
|
488
|
-
"oneMKL: rng/beta: method is incorrect");
|
|
489
|
-
|
|
490
|
-
static_assert(std::is_same<RealType, float>::value || std::is_same<RealType, double>::value,
|
|
491
|
-
"oneMKL: rng/beta: type is not supported");
|
|
492
|
-
|
|
493
|
-
using method_type = Method;
|
|
494
|
-
using result_type = RealType;
|
|
495
|
-
|
|
496
|
-
struct param_type {
|
|
497
|
-
param_type(RealType p, RealType q, RealType a, RealType b) : p_(p), q_(q), a_(a), b_(b) {}
|
|
498
|
-
RealType p_;
|
|
499
|
-
RealType q_;
|
|
500
|
-
RealType a_;
|
|
501
|
-
RealType b_;
|
|
502
|
-
};
|
|
503
|
-
|
|
504
|
-
beta()
|
|
505
|
-
: beta(static_cast<RealType>(1.0), static_cast<RealType>(1.0),
|
|
506
|
-
static_cast<RealType>(0.0), static_cast<RealType>(1.0)) {}
|
|
507
|
-
|
|
508
|
-
explicit beta(RealType p, RealType q, RealType a, RealType b) : p_(p), q_(q), a_(a), b_(b) {
|
|
509
|
-
if (p <= static_cast<RealType>(0.0)) {
|
|
510
|
-
throw oneapi::mkl::invalid_argument("rng", "beta", "p <= 0");
|
|
511
|
-
}
|
|
512
|
-
if (q <= static_cast<RealType>(0.0)) {
|
|
513
|
-
throw oneapi::mkl::invalid_argument("rng", "beta", "q <= 0");
|
|
514
|
-
}
|
|
515
|
-
if (b <= static_cast<RealType>(0.0)) {
|
|
516
|
-
throw oneapi::mkl::invalid_argument("rng", "beta", "b <= 0");
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
explicit beta(const param_type& pt) : p_(pt.p_), q_(pt.q_), a_(pt.a_), b_(pt.b_) {
|
|
521
|
-
if (pt.p_ <= static_cast<RealType>(0.0)) {
|
|
522
|
-
throw oneapi::mkl::invalid_argument("rng", "beta", "p <= 0");
|
|
523
|
-
}
|
|
524
|
-
if (pt.q_ <= static_cast<RealType>(0.0)) {
|
|
525
|
-
throw oneapi::mkl::invalid_argument("rng", "beta", "q <= 0");
|
|
526
|
-
}
|
|
527
|
-
if (pt.b_ <= static_cast<RealType>(0.0)) {
|
|
528
|
-
throw oneapi::mkl::invalid_argument("rng", "beta", "b <= 0");
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
RealType p() const {
|
|
533
|
-
return p_;
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
RealType q() const {
|
|
537
|
-
return q_;
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
RealType a() const {
|
|
541
|
-
return a_;
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
RealType b() const {
|
|
545
|
-
return b_;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
param_type param() const {
|
|
549
|
-
return param_type(p_, q_, a_, b_);
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
void param(const param_type& pt) {
|
|
553
|
-
if (pt.p_ <= static_cast<RealType>(0.0)) {
|
|
554
|
-
throw oneapi::mkl::invalid_argument("rng", "beta", "p <= 0");
|
|
555
|
-
}
|
|
556
|
-
if (pt.q_ <= static_cast<RealType>(0.0)) {
|
|
557
|
-
throw oneapi::mkl::invalid_argument("rng", "beta", "q <= 0");
|
|
558
|
-
}
|
|
559
|
-
if (pt.b_ <= static_cast<RealType>(0.0)) {
|
|
560
|
-
throw oneapi::mkl::invalid_argument("rng", "beta", "b <= 0");
|
|
561
|
-
}
|
|
562
|
-
p_ = pt.p_;
|
|
563
|
-
q_ = pt.q_;
|
|
564
|
-
a_ = pt.a_;
|
|
565
|
-
b_ = pt.b_;
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
private:
|
|
569
|
-
RealType p_;
|
|
570
|
-
RealType q_;
|
|
571
|
-
RealType a_;
|
|
572
|
-
RealType b_;
|
|
573
|
-
};
|
|
574
|
-
|
|
575
|
-
// Class template oneapi::mkl::rng::cauchy
|
|
576
|
-
//
|
|
577
|
-
// Represents continuous Cauchy random number distribution
|
|
578
|
-
//
|
|
579
|
-
// Supported types:
|
|
580
|
-
// float
|
|
581
|
-
// double
|
|
582
|
-
//
|
|
583
|
-
// Supported methods:
|
|
584
|
-
// oneapi::mkl::rng::cauchy_method::icdf
|
|
585
|
-
//
|
|
586
|
-
// Input arguments:
|
|
587
|
-
// a - displacement. 0.0 by default
|
|
588
|
-
// b - scalefactor. 1.0 by default
|
|
589
|
-
|
|
590
|
-
namespace cauchy_method {
|
|
591
|
-
struct icdf {};
|
|
592
|
-
using by_default = icdf;
|
|
593
|
-
} // namespace cauchy_method
|
|
594
|
-
|
|
595
|
-
template <typename RealType = float, typename Method = cauchy_method::by_default>
|
|
596
|
-
class cauchy {
|
|
597
|
-
public:
|
|
598
|
-
static_assert(std::is_same<Method, cauchy_method::icdf>::value,
|
|
599
|
-
"oneMKL: rng/cauchy: method is incorrect");
|
|
600
|
-
|
|
601
|
-
static_assert(std::is_same<RealType, float>::value || std::is_same<RealType, double>::value,
|
|
602
|
-
"oneMKL: rng/cauchy: type is not supported");
|
|
603
|
-
|
|
604
|
-
using method_type = Method;
|
|
605
|
-
using result_type = RealType;
|
|
606
|
-
|
|
607
|
-
struct param_type {
|
|
608
|
-
param_type(RealType a, RealType b) : a_(a), b_(b) {}
|
|
609
|
-
RealType a_;
|
|
610
|
-
RealType b_;
|
|
611
|
-
};
|
|
612
|
-
|
|
613
|
-
cauchy() : cauchy(static_cast<RealType>(0.0), static_cast<RealType>(1.0)) {}
|
|
614
|
-
|
|
615
|
-
explicit cauchy(RealType a, RealType b) : a_(a), b_(b) {
|
|
616
|
-
if (b <= static_cast<RealType>(0.0)) {
|
|
617
|
-
throw oneapi::mkl::invalid_argument("rng", "cauchy", "b <= 0");
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
explicit cauchy(const param_type& pt) : a_(pt.a_), b_(pt.b_) {
|
|
622
|
-
if (pt.b_ <= static_cast<RealType>(0.0)) {
|
|
623
|
-
throw oneapi::mkl::invalid_argument("rng", "cauchy", "b <= 0");
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
RealType a() const {
|
|
628
|
-
return a_;
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
RealType b() const {
|
|
632
|
-
return b_;
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
param_type param() const {
|
|
636
|
-
return param_type(a_, b_);
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
void param(const param_type& pt) {
|
|
640
|
-
if (pt.b_ <= static_cast<RealType>(0.0)) {
|
|
641
|
-
throw oneapi::mkl::invalid_argument("rng", "cauchy", "b <= 0");
|
|
642
|
-
}
|
|
643
|
-
a_ = pt.a_;
|
|
644
|
-
b_ = pt.b_;
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
private:
|
|
648
|
-
RealType a_;
|
|
649
|
-
RealType b_;
|
|
650
|
-
};
|
|
651
|
-
|
|
652
|
-
// Class template oneapi::mkl::rng::chi_square
|
|
653
|
-
//
|
|
654
|
-
// Represents continuous chi-square random number distribution
|
|
655
|
-
//
|
|
656
|
-
// Supported types:
|
|
657
|
-
// float
|
|
658
|
-
// double
|
|
659
|
-
//
|
|
660
|
-
// Supported methods:
|
|
661
|
-
// oneapi::mkl::rng::chi_square_method::gamma_based
|
|
662
|
-
//
|
|
663
|
-
// Input arguments:
|
|
664
|
-
// n - degrees of freedom
|
|
665
|
-
|
|
666
|
-
namespace chi_square_method {
|
|
667
|
-
struct gamma_based {};
|
|
668
|
-
using by_default = gamma_based;
|
|
669
|
-
} // namespace chi_square_method
|
|
670
|
-
|
|
671
|
-
template <typename RealType = float, typename Method = chi_square_method::by_default>
|
|
672
|
-
class chi_square {
|
|
673
|
-
public:
|
|
674
|
-
static_assert(std::is_same<Method, chi_square_method::gamma_based>::value,
|
|
675
|
-
"oneMKL: rng/chi_square: method is incorrect");
|
|
676
|
-
static_assert(std::is_same<RealType, float>::value || std::is_same<RealType, double>::value,
|
|
677
|
-
"oneMKL: rng/chi_square: type is not supported");
|
|
678
|
-
|
|
679
|
-
using method_type = Method;
|
|
680
|
-
using result_type = RealType;
|
|
681
|
-
|
|
682
|
-
struct param_type {
|
|
683
|
-
param_type(std::int32_t n) : n_(n) {}
|
|
684
|
-
std::int32_t n_;
|
|
685
|
-
};
|
|
686
|
-
|
|
687
|
-
chi_square() : chi_square(5) {}
|
|
688
|
-
|
|
689
|
-
explicit chi_square(std::int32_t n) : n_(n) {
|
|
690
|
-
if (n < 1) {
|
|
691
|
-
throw oneapi::mkl::invalid_argument("rng", "chi_square", "n < 1");
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
explicit chi_square(const param_type& pt) : n_(pt.n_) {
|
|
696
|
-
if (pt.n_ < 1) {
|
|
697
|
-
throw oneapi::mkl::invalid_argument("rng", "chi_square", "n < 1");
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
std::int32_t n() const {
|
|
702
|
-
return n_;
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
param_type param() const {
|
|
706
|
-
return param_type(n_);
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
void param(const param_type& pt) {
|
|
710
|
-
if (pt.n_ < 1) {
|
|
711
|
-
throw oneapi::mkl::invalid_argument("rng", "chi_square", "n < 1");
|
|
712
|
-
}
|
|
713
|
-
n_ = pt.n_;
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
private:
|
|
717
|
-
std::int32_t n_;
|
|
718
|
-
};
|
|
719
|
-
|
|
720
|
-
// Class template oneapi::mkl::rng::exponential
|
|
721
|
-
//
|
|
722
|
-
// Represents continuous exponential random number distribution
|
|
723
|
-
//
|
|
724
|
-
// Supported types:
|
|
725
|
-
// float
|
|
726
|
-
// double
|
|
727
|
-
//
|
|
728
|
-
// Supported methods:
|
|
729
|
-
// oneapi::mkl::rng::exponential_method::icdf
|
|
730
|
-
// oneapi::mkl::rng::exponential_method::icdf_accurate
|
|
731
|
-
//
|
|
732
|
-
// Input arguments:
|
|
733
|
-
// a - displacement. 0.0 by default
|
|
734
|
-
// beta - scalefactor. 1.0 by default
|
|
735
|
-
|
|
736
|
-
namespace exponential_method {
|
|
737
|
-
struct icdf {};
|
|
738
|
-
struct icdf_accurate {};
|
|
739
|
-
using by_default = icdf;
|
|
740
|
-
} // namespace exponential_method
|
|
741
|
-
|
|
742
|
-
template <typename RealType = float, typename Method = exponential_method::by_default>
|
|
743
|
-
class exponential {
|
|
744
|
-
public:
|
|
745
|
-
static_assert(std::is_same<Method, exponential_method::icdf>::value ||
|
|
746
|
-
std::is_same<Method, exponential_method::icdf_accurate>::value,
|
|
747
|
-
"oneMKL: rng/exponential: method is incorrect");
|
|
748
|
-
|
|
749
|
-
static_assert(std::is_same<RealType, float>::value || std::is_same<RealType, double>::value,
|
|
750
|
-
"oneMKL: rng/exponential: type is not supported");
|
|
751
|
-
|
|
752
|
-
using method_type = Method;
|
|
753
|
-
using result_type = RealType;
|
|
754
|
-
|
|
755
|
-
struct param_type {
|
|
756
|
-
param_type(RealType a, RealType beta) : a_(a), beta_(beta) {}
|
|
757
|
-
RealType a_;
|
|
758
|
-
RealType beta_;
|
|
759
|
-
};
|
|
760
|
-
|
|
761
|
-
exponential() : exponential(static_cast<RealType>(0.0), static_cast<RealType>(1.0)) {}
|
|
762
|
-
|
|
763
|
-
explicit exponential(RealType a, RealType beta) : a_(a), beta_(beta) {
|
|
764
|
-
if (beta <= static_cast<RealType>(0.0)) {
|
|
765
|
-
throw oneapi::mkl::invalid_argument("rng", "exponential", "beta <= 0");
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
explicit exponential(const param_type& pt) : a_(pt.a_), beta_(pt.beta_) {
|
|
770
|
-
if (pt.beta_ <= static_cast<RealType>(0.0)) {
|
|
771
|
-
throw oneapi::mkl::invalid_argument("rng", "exponential", "beta <= 0");
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
RealType a() const {
|
|
776
|
-
return a_;
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
RealType beta() const {
|
|
780
|
-
return beta_;
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
param_type param() const {
|
|
784
|
-
return param_type(a_, beta_);
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
void param(const param_type& pt) {
|
|
788
|
-
if (pt.beta_ <= static_cast<RealType>(0.0)) {
|
|
789
|
-
throw oneapi::mkl::invalid_argument("rng", "exponential", "beta <= 0");
|
|
790
|
-
}
|
|
791
|
-
a_ = pt.a_;
|
|
792
|
-
beta_ = pt.beta_;
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
private:
|
|
796
|
-
RealType a_;
|
|
797
|
-
RealType beta_;
|
|
798
|
-
};
|
|
799
|
-
|
|
800
|
-
// Class template oneapi::mkl::rng::gamma
|
|
801
|
-
//
|
|
802
|
-
// Represents continuous gamma random number distribution
|
|
803
|
-
//
|
|
804
|
-
// Supported types:
|
|
805
|
-
// float
|
|
806
|
-
// double
|
|
807
|
-
//
|
|
808
|
-
// Supported methods:
|
|
809
|
-
// oneapi::mkl::rng::gamma_method::marsaglia
|
|
810
|
-
// oneapi::mkl::rng::gamma_method::marsaglia_accurate
|
|
811
|
-
//
|
|
812
|
-
// Input arguments:
|
|
813
|
-
// alpha - shape. 1.0 by default
|
|
814
|
-
// a - displacement. 0.0 by default
|
|
815
|
-
// beta - scalefactor. 1.0 by default
|
|
816
|
-
|
|
817
|
-
namespace gamma_method {
|
|
818
|
-
struct marsaglia {};
|
|
819
|
-
struct marsaglia_accurate {};
|
|
820
|
-
using by_default = marsaglia;
|
|
821
|
-
} // namespace gamma_method
|
|
822
|
-
|
|
823
|
-
template <typename RealType = float, typename Method = gamma_method::by_default>
|
|
824
|
-
class gamma {
|
|
825
|
-
public:
|
|
826
|
-
static_assert(std::is_same<Method, gamma_method::marsaglia>::value ||
|
|
827
|
-
std::is_same<Method, gamma_method::marsaglia_accurate>::value,
|
|
828
|
-
"oneMKL: rng/gamma: method is incorrect");
|
|
829
|
-
|
|
830
|
-
static_assert(std::is_same<RealType, float>::value || std::is_same<RealType, double>::value,
|
|
831
|
-
"oneMKL: rng/gamma: type is not supported");
|
|
832
|
-
|
|
833
|
-
using method_type = Method;
|
|
834
|
-
using result_type = RealType;
|
|
835
|
-
|
|
836
|
-
struct param_type {
|
|
837
|
-
param_type(RealType alpha, RealType a, RealType beta) : alpha_(alpha), a_(a), beta_(beta) {}
|
|
838
|
-
RealType alpha_;
|
|
839
|
-
RealType a_;
|
|
840
|
-
RealType beta_;
|
|
841
|
-
};
|
|
842
|
-
|
|
843
|
-
gamma()
|
|
844
|
-
: gamma(static_cast<RealType>(1.0), static_cast<RealType>(0.0),
|
|
845
|
-
static_cast<RealType>(1.0)) {}
|
|
846
|
-
|
|
847
|
-
explicit gamma(RealType alpha, RealType a, RealType beta) : alpha_(alpha), a_(a), beta_(beta) {
|
|
848
|
-
if (alpha <= static_cast<RealType>(0.0)) {
|
|
849
|
-
throw oneapi::mkl::invalid_argument("rng", "gamma", "alpha <= 0");
|
|
850
|
-
}
|
|
851
|
-
if (beta <= static_cast<RealType>(0.0)) {
|
|
852
|
-
throw oneapi::mkl::invalid_argument("rng", "gamma", "beta <= 0");
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
explicit gamma(const param_type& pt) : alpha_(pt.alpha_), a_(pt.a_), beta_(pt.beta_) {
|
|
857
|
-
if (pt.alpha_ <= static_cast<RealType>(0.0)) {
|
|
858
|
-
throw oneapi::mkl::invalid_argument("rng", "gamma", "alpha <= 0");
|
|
859
|
-
}
|
|
860
|
-
if (pt.beta_ <= static_cast<RealType>(0.0)) {
|
|
861
|
-
throw oneapi::mkl::invalid_argument("rng", "gamma", "beta <= 0");
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
RealType alpha() const {
|
|
866
|
-
return alpha_;
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
RealType a() const {
|
|
870
|
-
return a_;
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
RealType beta() const {
|
|
874
|
-
return beta_;
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
param_type param() const {
|
|
878
|
-
return param_type(alpha_, a_, beta_);
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
void param(const param_type& pt) {
|
|
882
|
-
if (pt.alpha_ <= static_cast<RealType>(0.0)) {
|
|
883
|
-
throw oneapi::mkl::invalid_argument("rng", "gamma", "alpha <= 0");
|
|
884
|
-
}
|
|
885
|
-
if (pt.beta_ <= static_cast<RealType>(0.0)) {
|
|
886
|
-
throw oneapi::mkl::invalid_argument("rng", "gamma", "beta <= 0");
|
|
887
|
-
}
|
|
888
|
-
alpha_ = pt.alpha_;
|
|
889
|
-
a_ = pt.a_;
|
|
890
|
-
beta_ = pt.beta_;
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
private:
|
|
894
|
-
RealType alpha_;
|
|
895
|
-
RealType a_;
|
|
896
|
-
RealType beta_;
|
|
897
|
-
};
|
|
898
|
-
|
|
899
|
-
// Class template oneapi::mkl::rng::gumbel
|
|
900
|
-
//
|
|
901
|
-
// Represents continuous Gumbel random number distribution
|
|
902
|
-
//
|
|
903
|
-
// Supported types:
|
|
904
|
-
// float
|
|
905
|
-
// double
|
|
906
|
-
//
|
|
907
|
-
// Supported methods:
|
|
908
|
-
// oneapi::mkl::rng::gumbel_method::icdf
|
|
909
|
-
//
|
|
910
|
-
// Input arguments:
|
|
911
|
-
// a - displacement. 0.0 by default
|
|
912
|
-
// beta - scalefactor. 1.0 by default
|
|
913
|
-
|
|
914
|
-
namespace gumbel_method {
|
|
915
|
-
struct icdf {};
|
|
916
|
-
using by_default = icdf;
|
|
917
|
-
} // namespace gumbel_method
|
|
918
|
-
|
|
919
|
-
template <typename RealType = float, typename Method = gumbel_method::by_default>
|
|
920
|
-
class gumbel {
|
|
921
|
-
public:
|
|
922
|
-
static_assert(std::is_same<Method, gumbel_method::icdf>::value,
|
|
923
|
-
"oneMKL: rng/gumbel: method is incorrect");
|
|
924
|
-
|
|
925
|
-
static_assert(std::is_same<RealType, float>::value || std::is_same<RealType, double>::value,
|
|
926
|
-
"oneMKL: rng/gumbel: type is not supported");
|
|
927
|
-
|
|
928
|
-
using method_type = Method;
|
|
929
|
-
using result_type = RealType;
|
|
930
|
-
|
|
931
|
-
struct param_type {
|
|
932
|
-
param_type(RealType a, RealType b) : a_(a), b_(b) {}
|
|
933
|
-
RealType a_;
|
|
934
|
-
RealType b_;
|
|
935
|
-
};
|
|
936
|
-
|
|
937
|
-
gumbel() : gumbel(static_cast<RealType>(0.0), static_cast<RealType>(1.0)) {}
|
|
938
|
-
|
|
939
|
-
explicit gumbel(RealType a, RealType b) : a_(a), b_(b) {
|
|
940
|
-
if (b <= static_cast<RealType>(0.0)) {
|
|
941
|
-
throw oneapi::mkl::invalid_argument("rng", "gumbel", "b <= 0");
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
explicit gumbel(const param_type& pt) : a_(pt.a_), b_(pt.b_) {
|
|
946
|
-
if (pt.b_ <= static_cast<RealType>(0.0)) {
|
|
947
|
-
throw oneapi::mkl::invalid_argument("rng", "gumbel", "b <= 0");
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
RealType a() const {
|
|
952
|
-
return a_;
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
RealType b() const {
|
|
956
|
-
return b_;
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
param_type param() const {
|
|
960
|
-
return param_type(a_, b_);
|
|
961
|
-
}
|
|
962
|
-
|
|
963
|
-
void param(const param_type& pt) {
|
|
964
|
-
if (pt.b_ <= static_cast<RealType>(0.0)) {
|
|
965
|
-
throw oneapi::mkl::invalid_argument("rng", "gumbel", "b <= 0");
|
|
966
|
-
}
|
|
967
|
-
a_ = pt.a_;
|
|
968
|
-
b_ = pt.b_;
|
|
969
|
-
}
|
|
970
|
-
|
|
971
|
-
private:
|
|
972
|
-
RealType a_;
|
|
973
|
-
RealType b_;
|
|
974
|
-
};
|
|
975
|
-
|
|
976
|
-
// Class template oneapi::mkl::rng::laplace
|
|
977
|
-
//
|
|
978
|
-
// Represents continuous Laplace random number distribution
|
|
979
|
-
//
|
|
980
|
-
// Supported types:
|
|
981
|
-
// float
|
|
982
|
-
// double
|
|
983
|
-
//
|
|
984
|
-
// Supported methods:
|
|
985
|
-
// oneapi::mkl::rng::laplace_method::icdf
|
|
986
|
-
//
|
|
987
|
-
// Input arguments:
|
|
988
|
-
// a - mean. 0.0 by default
|
|
989
|
-
// b - scalefactor. 1.0 by default
|
|
990
|
-
|
|
991
|
-
namespace laplace_method {
|
|
992
|
-
struct icdf {};
|
|
993
|
-
using by_default = icdf;
|
|
994
|
-
} // namespace laplace_method
|
|
995
|
-
|
|
996
|
-
template <typename RealType = float, typename Method = laplace_method::by_default>
|
|
997
|
-
class laplace {
|
|
998
|
-
public:
|
|
999
|
-
static_assert(std::is_same<Method, laplace_method::icdf>::value,
|
|
1000
|
-
"oneMKL: rng/laplace: method is incorrect");
|
|
1001
|
-
|
|
1002
|
-
static_assert(std::is_same<RealType, float>::value || std::is_same<RealType, double>::value,
|
|
1003
|
-
"oneMKL: rng/laplace: type is not supported");
|
|
1004
|
-
|
|
1005
|
-
using method_type = Method;
|
|
1006
|
-
using result_type = RealType;
|
|
1007
|
-
|
|
1008
|
-
struct param_type {
|
|
1009
|
-
param_type(RealType a, RealType b) : a_(a), b_(b) {}
|
|
1010
|
-
RealType a_;
|
|
1011
|
-
RealType b_;
|
|
1012
|
-
};
|
|
1013
|
-
|
|
1014
|
-
laplace() : laplace(static_cast<RealType>(0.0), static_cast<RealType>(1.0)) {}
|
|
1015
|
-
|
|
1016
|
-
explicit laplace(RealType a, RealType b) : a_(a), b_(b) {
|
|
1017
|
-
if (b <= static_cast<RealType>(0.0)) {
|
|
1018
|
-
throw oneapi::mkl::invalid_argument("rng", "laplace", "b <= 0");
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
explicit laplace(const param_type& pt) : a_(pt.a_), b_(pt.b_) {
|
|
1023
|
-
if (pt.b_ <= static_cast<RealType>(0.0)) {
|
|
1024
|
-
throw oneapi::mkl::invalid_argument("rng", "laplace", "b <= 0");
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
RealType a() const {
|
|
1029
|
-
return a_;
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
RealType b() const {
|
|
1033
|
-
return b_;
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
param_type param() const {
|
|
1037
|
-
return param_type(a_, b_);
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
void param(const param_type& pt) {
|
|
1041
|
-
if (pt.b_ <= static_cast<RealType>(0.0)) {
|
|
1042
|
-
throw oneapi::mkl::invalid_argument("rng", "laplace", "b <= 0");
|
|
1043
|
-
}
|
|
1044
|
-
a_ = pt.a_;
|
|
1045
|
-
b_ = pt.b_;
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
private:
|
|
1049
|
-
RealType a_;
|
|
1050
|
-
RealType b_;
|
|
1051
|
-
};
|
|
1052
|
-
|
|
1053
|
-
// Class template oneapi::mkl::rng::rayleigh
|
|
1054
|
-
//
|
|
1055
|
-
// Represents continuous Rayleigh random number distribution
|
|
1056
|
-
//
|
|
1057
|
-
// Supported types:
|
|
1058
|
-
// float
|
|
1059
|
-
// double
|
|
1060
|
-
//
|
|
1061
|
-
// Supported methods:
|
|
1062
|
-
// oneapi::mkl::rng::rayleigh_method::icdf
|
|
1063
|
-
// oneapi::mkl::rng::rayleigh_method::icdf_accurate
|
|
1064
|
-
//
|
|
1065
|
-
// Input arguments:
|
|
1066
|
-
// a - displacement. 0.0 by default
|
|
1067
|
-
// b - scalefactor. 1.0 by default
|
|
1068
|
-
|
|
1069
|
-
namespace rayleigh_method {
|
|
1070
|
-
struct icdf {};
|
|
1071
|
-
struct icdf_accurate {};
|
|
1072
|
-
using by_default = icdf;
|
|
1073
|
-
} // namespace rayleigh_method
|
|
1074
|
-
|
|
1075
|
-
template <typename RealType = float, typename Method = rayleigh_method::by_default>
|
|
1076
|
-
class rayleigh {
|
|
1077
|
-
public:
|
|
1078
|
-
static_assert(std::is_same<Method, rayleigh_method::icdf>::value ||
|
|
1079
|
-
std::is_same<Method, rayleigh_method::icdf_accurate>::value,
|
|
1080
|
-
"oneMKL: rng/rayleigh: method is incorrect");
|
|
1081
|
-
|
|
1082
|
-
static_assert(std::is_same<RealType, float>::value || std::is_same<RealType, double>::value,
|
|
1083
|
-
"oneMKL: rng/rayleigh: type is not supported");
|
|
1084
|
-
|
|
1085
|
-
using method_type = Method;
|
|
1086
|
-
using result_type = RealType;
|
|
1087
|
-
|
|
1088
|
-
struct param_type {
|
|
1089
|
-
param_type(RealType a, RealType b) : a_(a), b_(b) {}
|
|
1090
|
-
RealType a_;
|
|
1091
|
-
RealType b_;
|
|
1092
|
-
};
|
|
1093
|
-
|
|
1094
|
-
rayleigh() : rayleigh(static_cast<RealType>(0.0), static_cast<RealType>(1.0)) {}
|
|
1095
|
-
|
|
1096
|
-
explicit rayleigh(RealType a, RealType b) : a_(a), b_(b) {
|
|
1097
|
-
if (b <= static_cast<RealType>(0.0)) {
|
|
1098
|
-
throw oneapi::mkl::invalid_argument("rng", "rayleigh", "b <= 0");
|
|
1099
|
-
}
|
|
1100
|
-
}
|
|
1101
|
-
|
|
1102
|
-
explicit rayleigh(const param_type& pt) : a_(pt.a_), b_(pt.b_) {
|
|
1103
|
-
if (pt.b_ <= static_cast<RealType>(0.0)) {
|
|
1104
|
-
throw oneapi::mkl::invalid_argument("rng", "rayleigh", "b <= 0");
|
|
1105
|
-
}
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1108
|
-
RealType a() const {
|
|
1109
|
-
return a_;
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
RealType b() const {
|
|
1113
|
-
return b_;
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
param_type param() const {
|
|
1117
|
-
return param_type(a_, b_);
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
void param(const param_type& pt) {
|
|
1121
|
-
if (pt.b_ <= static_cast<RealType>(0.0)) {
|
|
1122
|
-
throw oneapi::mkl::invalid_argument("rng", "rayleigh", "b <= 0");
|
|
1123
|
-
}
|
|
1124
|
-
a_ = pt.a_;
|
|
1125
|
-
b_ = pt.b_;
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
|
-
private:
|
|
1129
|
-
RealType a_;
|
|
1130
|
-
RealType b_;
|
|
1131
|
-
};
|
|
1132
|
-
|
|
1133
|
-
// Class template oneapi::mkl::rng::weibull
|
|
1134
|
-
//
|
|
1135
|
-
// Represents continuous Weibull random number distribution
|
|
1136
|
-
//
|
|
1137
|
-
// Supported types:
|
|
1138
|
-
// float
|
|
1139
|
-
// double
|
|
1140
|
-
//
|
|
1141
|
-
// Supported methods:
|
|
1142
|
-
// oneapi::mkl::rng::weibull_method::icdf
|
|
1143
|
-
// oneapi::mkl::rng::weibull_method::icdf_accurate
|
|
1144
|
-
//
|
|
1145
|
-
// Input arguments:
|
|
1146
|
-
// alpha - shape. 1.0 by default
|
|
1147
|
-
// a - displacement. 0.0 by default
|
|
1148
|
-
// beta - scalefactor. 1.0 by default
|
|
1149
|
-
|
|
1150
|
-
namespace weibull_method {
|
|
1151
|
-
struct icdf {};
|
|
1152
|
-
struct icdf_accurate {};
|
|
1153
|
-
using by_default = icdf;
|
|
1154
|
-
} // namespace weibull_method
|
|
1155
|
-
|
|
1156
|
-
template <typename RealType = float, typename Method = weibull_method::by_default>
|
|
1157
|
-
class weibull {
|
|
1158
|
-
public:
|
|
1159
|
-
static_assert(std::is_same<Method, weibull_method::icdf>::value ||
|
|
1160
|
-
std::is_same<Method, weibull_method::icdf_accurate>::value,
|
|
1161
|
-
"oneMKL: rng/weibull: method is incorrect");
|
|
1162
|
-
|
|
1163
|
-
static_assert(std::is_same<RealType, float>::value || std::is_same<RealType, double>::value,
|
|
1164
|
-
"oneMKL: rng/weibull: type is not supported");
|
|
1165
|
-
|
|
1166
|
-
using method_type = Method;
|
|
1167
|
-
using result_type = RealType;
|
|
1168
|
-
|
|
1169
|
-
struct param_type {
|
|
1170
|
-
param_type(RealType alpha, RealType a, RealType beta) : alpha_(alpha), a_(a), beta_(beta) {}
|
|
1171
|
-
RealType alpha_;
|
|
1172
|
-
RealType a_;
|
|
1173
|
-
RealType beta_;
|
|
1174
|
-
};
|
|
1175
|
-
|
|
1176
|
-
weibull()
|
|
1177
|
-
: weibull(static_cast<RealType>(1.0), static_cast<RealType>(0.0),
|
|
1178
|
-
static_cast<RealType>(1.0)) {}
|
|
1179
|
-
|
|
1180
|
-
explicit weibull(RealType alpha, RealType a, RealType beta)
|
|
1181
|
-
: alpha_(alpha),
|
|
1182
|
-
a_(a),
|
|
1183
|
-
beta_(beta) {
|
|
1184
|
-
if (alpha <= static_cast<RealType>(0.0)) {
|
|
1185
|
-
throw oneapi::mkl::invalid_argument("rng", "weibull", "alpha <= 0");
|
|
1186
|
-
}
|
|
1187
|
-
if (beta <= static_cast<RealType>(0.0)) {
|
|
1188
|
-
throw oneapi::mkl::invalid_argument("rng", "weibull", "beta <= 0");
|
|
1189
|
-
}
|
|
1190
|
-
}
|
|
1191
|
-
|
|
1192
|
-
explicit weibull(const param_type& pt) : alpha_(pt.alpha_), a_(pt.a_), beta_(pt.beta_) {
|
|
1193
|
-
if (pt.alpha_ <= static_cast<RealType>(0.0)) {
|
|
1194
|
-
throw oneapi::mkl::invalid_argument("rng", "weibull", "alpha <= 0");
|
|
1195
|
-
}
|
|
1196
|
-
if (pt.beta_ <= static_cast<RealType>(0.0)) {
|
|
1197
|
-
throw oneapi::mkl::invalid_argument("rng", "weibull", "beta <= 0");
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
RealType alpha() const {
|
|
1202
|
-
return alpha_;
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
RealType a() const {
|
|
1206
|
-
return a_;
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
RealType beta() const {
|
|
1210
|
-
return beta_;
|
|
1211
|
-
}
|
|
1212
|
-
|
|
1213
|
-
param_type param() const {
|
|
1214
|
-
return param_type(alpha_, a_, beta_);
|
|
1215
|
-
}
|
|
1216
|
-
|
|
1217
|
-
void param(const param_type& pt) {
|
|
1218
|
-
if (pt.alpha_ <= static_cast<RealType>(0.0)) {
|
|
1219
|
-
throw oneapi::mkl::invalid_argument("rng", "weibull", "alpha <= 0");
|
|
1220
|
-
}
|
|
1221
|
-
if (pt.beta_ <= static_cast<RealType>(0.0)) {
|
|
1222
|
-
throw oneapi::mkl::invalid_argument("rng", "weibull", "beta <= 0");
|
|
1223
|
-
}
|
|
1224
|
-
alpha_ = pt.alpha_;
|
|
1225
|
-
a_ = pt.a_;
|
|
1226
|
-
beta_ = pt.beta_;
|
|
1227
|
-
}
|
|
1228
|
-
|
|
1229
|
-
private:
|
|
1230
|
-
RealType alpha_;
|
|
1231
|
-
RealType a_;
|
|
1232
|
-
RealType beta_;
|
|
1233
|
-
};
|
|
1234
|
-
|
|
1235
|
-
// Class template oneapi::mkl::rng::bernoulli
|
|
1236
|
-
//
|
|
1237
|
-
// Represents discrete Bernoulli random number distribution
|
|
1238
|
-
//
|
|
1239
|
-
// Supported types:
|
|
1240
|
-
// std::uint32_t
|
|
1241
|
-
// std::int32_t
|
|
1242
|
-
//
|
|
1243
|
-
// Supported methods:
|
|
1244
|
-
// oneapi::mkl::rng::bernoulli_method::icdf;
|
|
1245
|
-
//
|
|
1246
|
-
// Input arguments:
|
|
1247
|
-
// p - success probablity of a trial. 0.5 by default
|
|
1248
|
-
|
|
1249
|
-
namespace bernoulli_method {
|
|
1250
|
-
struct icdf {};
|
|
1251
|
-
using by_default = icdf;
|
|
1252
|
-
} // namespace bernoulli_method
|
|
1253
|
-
|
|
1254
|
-
template <typename IntType = std::uint32_t, typename Method = bernoulli_method::by_default>
|
|
1255
|
-
class bernoulli {
|
|
1256
|
-
public:
|
|
1257
|
-
static_assert(std::is_same<Method, bernoulli_method::icdf>::value,
|
|
1258
|
-
"oneMKL: rng/bernoulli: method is incorrect");
|
|
1259
|
-
|
|
1260
|
-
static_assert(std::is_same<IntType, std::int32_t>::value ||
|
|
1261
|
-
std::is_same<IntType, std::uint32_t>::value,
|
|
1262
|
-
"oneMKL: rng/bernoulli: type is not supported");
|
|
1263
|
-
|
|
1264
|
-
using method_type = Method;
|
|
1265
|
-
using result_type = IntType;
|
|
1266
|
-
|
|
1267
|
-
struct param_type {
|
|
1268
|
-
param_type(float p) : p_(p) {}
|
|
1269
|
-
float p_;
|
|
1270
|
-
};
|
|
1271
|
-
|
|
1272
|
-
bernoulli() : bernoulli(0.5f) {}
|
|
1273
|
-
|
|
1274
|
-
explicit bernoulli(float p) : p_(p) {
|
|
1275
|
-
if ((p > 1.0f) || (p < 0.0f)) {
|
|
1276
|
-
throw oneapi::mkl::invalid_argument("rng", "bernoulli", "p > 1 or p < 0");
|
|
1277
|
-
}
|
|
1278
|
-
}
|
|
1279
|
-
|
|
1280
|
-
explicit bernoulli(const param_type& pt) : p_(pt.p_) {
|
|
1281
|
-
if ((pt.p_ > 1.0f) || (pt.p_ < 0.0f)) {
|
|
1282
|
-
throw oneapi::mkl::invalid_argument("rng", "bernoulli", "p > 1 or p < 0");
|
|
1283
|
-
}
|
|
1284
|
-
}
|
|
1285
|
-
|
|
1286
|
-
float p() const {
|
|
1287
|
-
return p_;
|
|
1288
|
-
}
|
|
1289
|
-
|
|
1290
|
-
param_type param() const {
|
|
1291
|
-
return param_type(p_);
|
|
1292
|
-
}
|
|
1293
|
-
|
|
1294
|
-
void param(const param_type& pt) {
|
|
1295
|
-
if ((pt.p_ > 1.0f) || (pt.p_ < 0.0f)) {
|
|
1296
|
-
throw oneapi::mkl::invalid_argument("rng", "bernoulli", "p > 1 or p < 0");
|
|
1297
|
-
}
|
|
1298
|
-
p_ = pt.p_;
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
|
-
private:
|
|
1302
|
-
float p_;
|
|
1303
|
-
};
|
|
1304
|
-
|
|
1305
|
-
// Class template oneapi::mkl::rng::binomial
|
|
1306
|
-
//
|
|
1307
|
-
// Represents discrete binomial random number distribution
|
|
1308
|
-
//
|
|
1309
|
-
// Supported types:
|
|
1310
|
-
// std::int32_t
|
|
1311
|
-
//
|
|
1312
|
-
// Supported methods:
|
|
1313
|
-
// oneapi::mkl::rng::binomial_method::btpe
|
|
1314
|
-
//
|
|
1315
|
-
// Input arguments:
|
|
1316
|
-
// ntrials - number of independent trials. 5 by default
|
|
1317
|
-
// p - success probablity of a single trial. 0.5 by default
|
|
1318
|
-
|
|
1319
|
-
namespace binomial_method {
|
|
1320
|
-
struct btpe {};
|
|
1321
|
-
using by_default = btpe;
|
|
1322
|
-
} // namespace binomial_method
|
|
1323
|
-
|
|
1324
|
-
template <typename IntType = std::int32_t, typename Method = binomial_method::by_default>
|
|
1325
|
-
class binomial {
|
|
1326
|
-
public:
|
|
1327
|
-
static_assert(std::is_same<Method, binomial_method::btpe>::value,
|
|
1328
|
-
"oneMKL: rng/binomial: method is incorrect");
|
|
1329
|
-
|
|
1330
|
-
static_assert(std::is_same<IntType, std::int32_t>::value ||
|
|
1331
|
-
std::is_same<IntType, std::uint32_t>::value,
|
|
1332
|
-
"oneMKL: rng/binomial: type is not supported");
|
|
1333
|
-
|
|
1334
|
-
using method_type = Method;
|
|
1335
|
-
using result_type = IntType;
|
|
1336
|
-
|
|
1337
|
-
struct param_type {
|
|
1338
|
-
param_type(std::int32_t ntrial, double p) : ntrial_(ntrial), p_(p) {}
|
|
1339
|
-
std::int32_t ntrial_;
|
|
1340
|
-
double p_;
|
|
1341
|
-
};
|
|
1342
|
-
|
|
1343
|
-
binomial() : binomial(5, 0.5) {}
|
|
1344
|
-
|
|
1345
|
-
explicit binomial(std::int32_t ntrial, double p) : ntrial_(ntrial), p_(p) {
|
|
1346
|
-
if ((p > 1.0) || (p < 0.0)) {
|
|
1347
|
-
throw oneapi::mkl::invalid_argument("rng", "binomial", "p > 1 or p < 0");
|
|
1348
|
-
}
|
|
1349
|
-
if (ntrial < 1) {
|
|
1350
|
-
throw oneapi::mkl::invalid_argument("rng", "binomial", "ntrial < 1");
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
|
|
1354
|
-
explicit binomial(const param_type& pt) : ntrial_(pt.ntrial_), p_(pt.p_) {
|
|
1355
|
-
if ((pt.p_ > 1.0) || (pt.p_ < 0.0)) {
|
|
1356
|
-
throw oneapi::mkl::invalid_argument("rng", "binomial", "p > 1 or p < 0");
|
|
1357
|
-
}
|
|
1358
|
-
if (pt.ntrial_ < 1) {
|
|
1359
|
-
throw oneapi::mkl::invalid_argument("rng", "binomial", "ntrial < 1");
|
|
1360
|
-
}
|
|
1361
|
-
}
|
|
1362
|
-
|
|
1363
|
-
std::int32_t ntrial() const {
|
|
1364
|
-
return ntrial_;
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1367
|
-
double p() const {
|
|
1368
|
-
return p_;
|
|
1369
|
-
}
|
|
1370
|
-
|
|
1371
|
-
param_type param() const {
|
|
1372
|
-
return param_type(ntrial_, p_);
|
|
1373
|
-
}
|
|
1374
|
-
|
|
1375
|
-
void param(const param_type& pt) {
|
|
1376
|
-
if ((pt.p_ > 1.0) || (pt.p_ < 0.0)) {
|
|
1377
|
-
throw oneapi::mkl::invalid_argument("rng", "binomial", "p > 1 or p < 0");
|
|
1378
|
-
}
|
|
1379
|
-
if (pt.ntrial_ < 1) {
|
|
1380
|
-
throw oneapi::mkl::invalid_argument("rng", "binomial", "ntrial < 1");
|
|
1381
|
-
}
|
|
1382
|
-
ntrial_ = pt.ntrial_;
|
|
1383
|
-
p_ = pt.p_;
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
|
-
private:
|
|
1387
|
-
std::int32_t ntrial_;
|
|
1388
|
-
double p_;
|
|
1389
|
-
};
|
|
1390
|
-
|
|
1391
|
-
// Class template oneapi::mkl::rng::geometric
|
|
1392
|
-
//
|
|
1393
|
-
// Represents discrete geometric random number distribution
|
|
1394
|
-
//
|
|
1395
|
-
// Supported types:
|
|
1396
|
-
// std::int32_t
|
|
1397
|
-
// std::uint32_t
|
|
1398
|
-
//
|
|
1399
|
-
// Supported methods:
|
|
1400
|
-
// oneapi::mkl::rng::geometric_method::icdf
|
|
1401
|
-
//
|
|
1402
|
-
// Input arguments:
|
|
1403
|
-
// p - success probablity of a trial. 0.5 by default
|
|
1404
|
-
|
|
1405
|
-
namespace geometric_method {
|
|
1406
|
-
struct icdf {};
|
|
1407
|
-
using by_default = icdf;
|
|
1408
|
-
} // namespace geometric_method
|
|
1409
|
-
|
|
1410
|
-
template <typename IntType = std::uint32_t, typename Method = geometric_method::by_default>
|
|
1411
|
-
class geometric {
|
|
1412
|
-
public:
|
|
1413
|
-
static_assert(std::is_same<Method, geometric_method::icdf>::value,
|
|
1414
|
-
"oneMKL: rng/geometric: method is incorrect");
|
|
1415
|
-
|
|
1416
|
-
static_assert(std::is_same<IntType, std::int32_t>::value ||
|
|
1417
|
-
std::is_same<IntType, std::uint32_t>::value,
|
|
1418
|
-
"oneMKL: rng/geometric: type is not supported");
|
|
1419
|
-
|
|
1420
|
-
using method_type = Method;
|
|
1421
|
-
using result_type = IntType;
|
|
1422
|
-
|
|
1423
|
-
struct param_type {
|
|
1424
|
-
param_type(float p) : p_(p) {}
|
|
1425
|
-
float p_;
|
|
1426
|
-
};
|
|
1427
|
-
|
|
1428
|
-
geometric() : geometric(0.5f) {}
|
|
1429
|
-
|
|
1430
|
-
explicit geometric(float p) : p_(p) {
|
|
1431
|
-
if ((p >= 1.0f) || (p <= 0.0f)) {
|
|
1432
|
-
throw oneapi::mkl::invalid_argument("rng", "geometric", "p > 1 or p < 0");
|
|
1433
|
-
}
|
|
1434
|
-
}
|
|
1435
|
-
|
|
1436
|
-
explicit geometric(const param_type& pt) : p_(pt.p_) {
|
|
1437
|
-
if ((pt.p_ >= 1.0f) || (pt.p_ <= 0.0f)) {
|
|
1438
|
-
throw oneapi::mkl::invalid_argument("rng", "geometric", "p > 1 or p < 0");
|
|
1439
|
-
}
|
|
1440
|
-
}
|
|
1441
|
-
|
|
1442
|
-
float p() const {
|
|
1443
|
-
return p_;
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
|
-
param_type param() const {
|
|
1447
|
-
return param_type(p_);
|
|
1448
|
-
}
|
|
1449
|
-
|
|
1450
|
-
void param(const param_type& pt) {
|
|
1451
|
-
if ((pt.p_ >= 1.0f) || (pt.p_ <= 0.0f)) {
|
|
1452
|
-
throw oneapi::mkl::invalid_argument("rng", "geometric", "p > 1 or p < 0");
|
|
1453
|
-
}
|
|
1454
|
-
p_ = pt.p_;
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
|
-
private:
|
|
1458
|
-
float p_;
|
|
1459
|
-
};
|
|
1460
|
-
|
|
1461
|
-
// Class template oneapi::mkl::rng::hypergeometric
|
|
1462
|
-
//
|
|
1463
|
-
// Represents discrete hypergeometric random number distribution
|
|
1464
|
-
//
|
|
1465
|
-
// Supported types:
|
|
1466
|
-
// std::int32_t
|
|
1467
|
-
//
|
|
1468
|
-
// Supported methods:
|
|
1469
|
-
// oneapi::mkl::rng::hypergeometric_method::h2pe
|
|
1470
|
-
//
|
|
1471
|
-
// Input arguments:
|
|
1472
|
-
// l - lot size. 1 by default
|
|
1473
|
-
// s - size of sampling without replacement. 1 by default
|
|
1474
|
-
// m - number of marked elements. 1 by default
|
|
1475
|
-
|
|
1476
|
-
namespace hypergeometric_method {
|
|
1477
|
-
struct h2pe {};
|
|
1478
|
-
using by_default = h2pe;
|
|
1479
|
-
} // namespace hypergeometric_method
|
|
1480
|
-
|
|
1481
|
-
template <typename IntType = std::int32_t, typename Method = hypergeometric_method::by_default>
|
|
1482
|
-
class hypergeometric {
|
|
1483
|
-
public:
|
|
1484
|
-
static_assert(std::is_same<Method, hypergeometric_method::h2pe>::value,
|
|
1485
|
-
"oneMKL: rng/hypergeometric: method is incorrect");
|
|
1486
|
-
|
|
1487
|
-
static_assert(std::is_same<IntType, std::int32_t>::value ||
|
|
1488
|
-
std::is_same<IntType, std::uint32_t>::value,
|
|
1489
|
-
"oneMKL: rng/hypergeometric: type is not supported");
|
|
1490
|
-
|
|
1491
|
-
using method_type = Method;
|
|
1492
|
-
using result_type = IntType;
|
|
1493
|
-
|
|
1494
|
-
struct param_type {
|
|
1495
|
-
param_type(std::int32_t l, std::int32_t s, std::int32_t m) : l_(l), s_(s), m_(m) {}
|
|
1496
|
-
std::int32_t s_;
|
|
1497
|
-
std::int32_t m_;
|
|
1498
|
-
std::int32_t l_;
|
|
1499
|
-
};
|
|
1500
|
-
|
|
1501
|
-
hypergeometric() : hypergeometric(1, 1, 1) {}
|
|
1502
|
-
|
|
1503
|
-
explicit hypergeometric(std::int32_t l, std::int32_t s, std::int32_t m) : s_(s), m_(m), l_(l) {
|
|
1504
|
-
if (s < 0) {
|
|
1505
|
-
throw oneapi::mkl::invalid_argument("rng", "hypergeometric", "s < 0");
|
|
1506
|
-
}
|
|
1507
|
-
if (m < 0) {
|
|
1508
|
-
throw oneapi::mkl::invalid_argument("rng", "hypergeometric", "m < 0");
|
|
1509
|
-
}
|
|
1510
|
-
if (l < (s > m ? s : m)) {
|
|
1511
|
-
throw oneapi::mkl::invalid_argument("rng", "hypergeometric", "l < (s > m ? s : m)");
|
|
1512
|
-
}
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
explicit hypergeometric(const param_type& pt) : l_(pt.l_), s_(pt.s_), m_(pt.m_) {
|
|
1516
|
-
if (pt.s_ < 0) {
|
|
1517
|
-
throw oneapi::mkl::invalid_argument("rng", "hypergeometric", "s < 0");
|
|
1518
|
-
}
|
|
1519
|
-
if (pt.m_ < 0) {
|
|
1520
|
-
throw oneapi::mkl::invalid_argument("rng", "hypergeometric", "m < 0");
|
|
1521
|
-
}
|
|
1522
|
-
if (pt.l_ < (pt.s_ > pt.m_ ? pt.s_ : pt.m_)) {
|
|
1523
|
-
throw oneapi::mkl::invalid_argument("rng", "hypergeometric", "l < (s > m ? s : m)");
|
|
1524
|
-
}
|
|
1525
|
-
}
|
|
1526
|
-
|
|
1527
|
-
std::int32_t l() const {
|
|
1528
|
-
return l_;
|
|
1529
|
-
}
|
|
1530
|
-
|
|
1531
|
-
std::int32_t s() const {
|
|
1532
|
-
return s_;
|
|
1533
|
-
}
|
|
1534
|
-
|
|
1535
|
-
std::int32_t m() const {
|
|
1536
|
-
return m_;
|
|
1537
|
-
}
|
|
1538
|
-
|
|
1539
|
-
param_type param() const {
|
|
1540
|
-
return param_type(l_, s_, m_);
|
|
1541
|
-
}
|
|
1542
|
-
|
|
1543
|
-
void param(const param_type& pt) {
|
|
1544
|
-
if (pt.s_ < 0) {
|
|
1545
|
-
throw oneapi::mkl::invalid_argument("rng", "hypergeometric", "s < 0");
|
|
1546
|
-
}
|
|
1547
|
-
if (pt.m_ < 0) {
|
|
1548
|
-
throw oneapi::mkl::invalid_argument("rng", "hypergeometric", "m < 0");
|
|
1549
|
-
}
|
|
1550
|
-
if (pt.l_ < (pt.s_ > pt.m_ ? pt.s_ : pt.m_)) {
|
|
1551
|
-
throw oneapi::mkl::invalid_argument("rng", "hypergeometric", "l < (s > m ? s : m)");
|
|
1552
|
-
}
|
|
1553
|
-
s_ = pt.s_;
|
|
1554
|
-
m_ = pt.m_;
|
|
1555
|
-
l_ = pt.l_;
|
|
1556
|
-
}
|
|
1557
|
-
|
|
1558
|
-
private:
|
|
1559
|
-
std::int32_t s_;
|
|
1560
|
-
std::int32_t m_;
|
|
1561
|
-
std::int32_t l_;
|
|
1562
|
-
};
|
|
1563
|
-
|
|
1564
|
-
// Class template oneapi::mkl::rng::multinomial
|
|
1565
|
-
//
|
|
1566
|
-
// Represents discrete multinomial random number distribution
|
|
1567
|
-
//
|
|
1568
|
-
// Supported types:
|
|
1569
|
-
// std::int32_t
|
|
1570
|
-
//
|
|
1571
|
-
// Supported methods:
|
|
1572
|
-
// oneapi::mkl::rng::multinomial_method::poisson_icdf_based
|
|
1573
|
-
//
|
|
1574
|
-
// Input arguments:
|
|
1575
|
-
// ntrial - number of independent trials
|
|
1576
|
-
// p - probability vector of possible outcomes
|
|
1577
|
-
|
|
1578
|
-
namespace multinomial_method {
|
|
1579
|
-
struct poisson_icdf_based {};
|
|
1580
|
-
using by_default = poisson_icdf_based;
|
|
1581
|
-
} // namespace multinomial_method
|
|
1582
|
-
|
|
1583
|
-
template <typename IntType = std::int32_t, typename Method = multinomial_method::by_default>
|
|
1584
|
-
class multinomial {
|
|
1585
|
-
public:
|
|
1586
|
-
static_assert(std::is_same<Method, multinomial_method::poisson_icdf_based>::value,
|
|
1587
|
-
"oneMKL: rng/multinomial: method is incorrect");
|
|
1588
|
-
|
|
1589
|
-
static_assert(std::is_same<IntType, std::int32_t>::value ||
|
|
1590
|
-
std::is_same<IntType, std::uint32_t>::value,
|
|
1591
|
-
"oneMKL: rng/multinomial: type is not supported");
|
|
1592
|
-
|
|
1593
|
-
using method_type = Method;
|
|
1594
|
-
using result_type = IntType;
|
|
1595
|
-
|
|
1596
|
-
struct param_type {
|
|
1597
|
-
param_type(std::int32_t ntrial, sycl::span<double> p) : ntrial_(ntrial), p_span_(p) {}
|
|
1598
|
-
|
|
1599
|
-
std::int32_t ntrial_;
|
|
1600
|
-
sycl::span<double> p_span_;
|
|
1601
|
-
};
|
|
1602
|
-
|
|
1603
|
-
explicit multinomial(std::int32_t ntrial, sycl::span<double> p) : ntrial_(ntrial), p_span_(p) {
|
|
1604
|
-
if (ntrial < 0) {
|
|
1605
|
-
throw oneapi::mkl::invalid_argument("rng", "multinomial", "ntrial < 0");
|
|
1606
|
-
}
|
|
1607
|
-
if (p.size() < 1) {
|
|
1608
|
-
throw oneapi::mkl::invalid_argument("rng", "multinomial", "size of p < 1");
|
|
1609
|
-
}
|
|
1610
|
-
}
|
|
1611
|
-
|
|
1612
|
-
explicit multinomial(const param_type& pt) : ntrial_(pt.ntrial_), p_span_(pt.p_span_) {
|
|
1613
|
-
if (pt.ntrial_ < 0) {
|
|
1614
|
-
throw oneapi::mkl::invalid_argument("rng", "multinomial", "ntrial < 0");
|
|
1615
|
-
}
|
|
1616
|
-
if (pt.p_span_.size() < 1) {
|
|
1617
|
-
throw oneapi::mkl::invalid_argument("rng", "multinomial", "size of p < 1");
|
|
1618
|
-
}
|
|
1619
|
-
}
|
|
1620
|
-
|
|
1621
|
-
std::int32_t ntrial() const {
|
|
1622
|
-
return ntrial_;
|
|
1623
|
-
}
|
|
1624
|
-
|
|
1625
|
-
sycl::span<double> p() const {
|
|
1626
|
-
return p_span_;
|
|
1627
|
-
}
|
|
1628
|
-
|
|
1629
|
-
param_type param() const {
|
|
1630
|
-
return param_type(ntrial_, p_span_);
|
|
1631
|
-
}
|
|
1632
|
-
|
|
1633
|
-
void param(const param_type& pt) {
|
|
1634
|
-
if (pt.ntrial_ < 0) {
|
|
1635
|
-
throw oneapi::mkl::invalid_argument("rng", "multinomial", "ntrial < 0");
|
|
1636
|
-
}
|
|
1637
|
-
if (pt.p_span_.size() < 1) {
|
|
1638
|
-
throw oneapi::mkl::invalid_argument("rng", "multinomial", "size of p < 1");
|
|
1639
|
-
}
|
|
1640
|
-
ntrial_ = pt.ntrial_;
|
|
1641
|
-
p_span_ = pt.p_span_;
|
|
1642
|
-
}
|
|
1643
|
-
|
|
1644
|
-
private:
|
|
1645
|
-
std::int32_t ntrial_;
|
|
1646
|
-
sycl::span<double> p_span_;
|
|
1647
|
-
};
|
|
1648
|
-
|
|
1649
|
-
// Class template oneapi::mkl::rng::negative_binomial
|
|
1650
|
-
//
|
|
1651
|
-
// Represents discrete negative binomial random number distribution
|
|
1652
|
-
//
|
|
1653
|
-
// Supported types:
|
|
1654
|
-
// std::int32_t
|
|
1655
|
-
//
|
|
1656
|
-
// Supported methods:
|
|
1657
|
-
// oneapi::mkl::rng::negative_binomial_method::nbar
|
|
1658
|
-
//
|
|
1659
|
-
// Input arguments:
|
|
1660
|
-
// a - the first distribution parameter. 0.1 by default
|
|
1661
|
-
// p - the second distribution parameter. 0.5 by default
|
|
1662
|
-
|
|
1663
|
-
namespace negative_binomial_method {
|
|
1664
|
-
struct nbar {};
|
|
1665
|
-
using by_default = nbar;
|
|
1666
|
-
} // namespace negative_binomial_method
|
|
1667
|
-
|
|
1668
|
-
template <typename IntType = std::int32_t, typename Method = negative_binomial_method::by_default>
|
|
1669
|
-
class negative_binomial {
|
|
1670
|
-
public:
|
|
1671
|
-
static_assert(std::is_same<Method, negative_binomial_method::nbar>::value,
|
|
1672
|
-
"oneMKL: rng/negative_binomial: method is incorrect");
|
|
1673
|
-
|
|
1674
|
-
static_assert(std::is_same<IntType, std::int32_t>::value ||
|
|
1675
|
-
std::is_same<IntType, std::uint32_t>::value,
|
|
1676
|
-
"oneMKL: rng/negative_binomial: type is not supported");
|
|
1677
|
-
|
|
1678
|
-
using method_type = Method;
|
|
1679
|
-
using result_type = IntType;
|
|
1680
|
-
|
|
1681
|
-
struct param_type {
|
|
1682
|
-
param_type(double a, double p) : a_(a), p_(p) {}
|
|
1683
|
-
double a_;
|
|
1684
|
-
double p_;
|
|
1685
|
-
};
|
|
1686
|
-
|
|
1687
|
-
negative_binomial() : negative_binomial(0.1, 0.5) {}
|
|
1688
|
-
|
|
1689
|
-
explicit negative_binomial(double a, double p) : a_(a), p_(p) {
|
|
1690
|
-
if ((p >= 1.0) || (p <= 0.0)) {
|
|
1691
|
-
throw oneapi::mkl::invalid_argument("rng", "negative_binomial", "p > 1 or p < 0");
|
|
1692
|
-
}
|
|
1693
|
-
if (a <= 0.0) {
|
|
1694
|
-
throw oneapi::mkl::invalid_argument("rng", "negative_binomial", "a < 0");
|
|
1695
|
-
}
|
|
1696
|
-
}
|
|
1697
|
-
|
|
1698
|
-
explicit negative_binomial(const param_type& pt) : a_(pt.a_), p_(pt.p_) {
|
|
1699
|
-
if ((pt.p_ >= 1.0) || (pt.p_ <= 0.0)) {
|
|
1700
|
-
throw oneapi::mkl::invalid_argument("rng", "negative_binomial", "p > 1 or p < 0");
|
|
1701
|
-
}
|
|
1702
|
-
if (pt.a_ <= 0.0) {
|
|
1703
|
-
throw oneapi::mkl::invalid_argument("rng", "negative_binomial", "a < 0");
|
|
1704
|
-
}
|
|
1705
|
-
}
|
|
1706
|
-
|
|
1707
|
-
double a() const {
|
|
1708
|
-
return a_;
|
|
1709
|
-
}
|
|
1710
|
-
|
|
1711
|
-
double p() const {
|
|
1712
|
-
return p_;
|
|
1713
|
-
}
|
|
1714
|
-
|
|
1715
|
-
param_type param() const {
|
|
1716
|
-
return param_type(a_, p_);
|
|
1717
|
-
}
|
|
1718
|
-
|
|
1719
|
-
void param(const param_type& pt) {
|
|
1720
|
-
if ((pt.p_ >= 1.0) || (pt.p_ <= 0.0)) {
|
|
1721
|
-
throw oneapi::mkl::invalid_argument("rng", "negative_binomial", "p > 1 or p < 0");
|
|
1722
|
-
}
|
|
1723
|
-
if (pt.a_ <= 0.0) {
|
|
1724
|
-
throw oneapi::mkl::invalid_argument("rng", "negative_binomial", "a < 0");
|
|
1725
|
-
}
|
|
1726
|
-
a_ = pt.a_;
|
|
1727
|
-
p_ = pt.p_;
|
|
1728
|
-
}
|
|
1729
|
-
|
|
1730
|
-
private:
|
|
1731
|
-
double a_;
|
|
1732
|
-
double p_;
|
|
1733
|
-
};
|
|
1734
|
-
|
|
1735
|
-
// Class template oneapi::mkl::rng::poisson
|
|
1736
|
-
//
|
|
1737
|
-
// Represents discrete Poisson random number distribution
|
|
1738
|
-
//
|
|
1739
|
-
// Supported types:
|
|
1740
|
-
// std::int32_t
|
|
1741
|
-
//
|
|
1742
|
-
// Supported methods:
|
|
1743
|
-
// oneapi::mkl::rng::poisson_method::ptpe
|
|
1744
|
-
// oneapi::mkl::rng::poisson_method::gaussian_icdf_based
|
|
1745
|
-
//
|
|
1746
|
-
// Input arguments:
|
|
1747
|
-
// lambda - distribution parameter. 0.5 by default
|
|
1748
|
-
|
|
1749
|
-
namespace poisson_method {
|
|
1750
|
-
struct ptpe {};
|
|
1751
|
-
struct gaussian_icdf_based {};
|
|
1752
|
-
using by_default = gaussian_icdf_based;
|
|
1753
|
-
} // namespace poisson_method
|
|
1754
|
-
|
|
1755
|
-
template <typename IntType = std::int32_t, typename Method = poisson_method::by_default>
|
|
1756
|
-
class poisson {
|
|
1757
|
-
public:
|
|
1758
|
-
static_assert(std::is_same<Method, poisson_method::ptpe>::value ||
|
|
1759
|
-
std::is_same<Method, poisson_method::gaussian_icdf_based>::value,
|
|
1760
|
-
"oneMKL: rng/poisson: method is incorrect");
|
|
1761
|
-
|
|
1762
|
-
static_assert(std::is_same<IntType, std::int32_t>::value ||
|
|
1763
|
-
std::is_same<IntType, std::uint32_t>::value,
|
|
1764
|
-
"oneMKL: rng/poisson: type is not supported");
|
|
1765
|
-
|
|
1766
|
-
using method_type = Method;
|
|
1767
|
-
using result_type = IntType;
|
|
1768
|
-
|
|
1769
|
-
struct param_type {
|
|
1770
|
-
param_type(double lambda) : lambda_(lambda) {}
|
|
1771
|
-
double lambda_;
|
|
1772
|
-
};
|
|
1773
|
-
|
|
1774
|
-
poisson() : poisson(0.5) {}
|
|
1775
|
-
|
|
1776
|
-
explicit poisson(double lambda) : lambda_(lambda) {
|
|
1777
|
-
if ((lambda <= 0.0)) {
|
|
1778
|
-
throw oneapi::mkl::invalid_argument("rng", "poisson", "lamdba < 0");
|
|
1779
|
-
}
|
|
1780
|
-
}
|
|
1781
|
-
|
|
1782
|
-
explicit poisson(const param_type& pt) : lambda_(pt.lambda_) {
|
|
1783
|
-
if ((pt.lambda_ <= 0.0)) {
|
|
1784
|
-
throw oneapi::mkl::invalid_argument("rng", "poisson", "lamdba < 0");
|
|
1785
|
-
}
|
|
1786
|
-
}
|
|
1787
|
-
|
|
1788
|
-
double lambda() const {
|
|
1789
|
-
return lambda_;
|
|
1790
|
-
}
|
|
1791
|
-
|
|
1792
|
-
param_type param() const {
|
|
1793
|
-
return param_type(lambda_);
|
|
1794
|
-
}
|
|
1795
|
-
|
|
1796
|
-
void param(const param_type& pt) {
|
|
1797
|
-
if ((pt.lambda_ <= 0.0)) {
|
|
1798
|
-
throw oneapi::mkl::invalid_argument("rng", "poisson", "lamdba < 0");
|
|
1799
|
-
}
|
|
1800
|
-
lambda_ = pt.lambda_;
|
|
1801
|
-
}
|
|
1802
|
-
|
|
1803
|
-
private:
|
|
1804
|
-
double lambda_;
|
|
1805
|
-
};
|
|
1806
|
-
|
|
1807
|
-
// Class template oneapi::mkl::rng::poisson_v
|
|
1808
|
-
//
|
|
1809
|
-
// Represents discrete Poisson random number distribution with varying mean
|
|
1810
|
-
//
|
|
1811
|
-
// Supported types:
|
|
1812
|
-
// std::int32_t
|
|
1813
|
-
//
|
|
1814
|
-
// Supported methods:
|
|
1815
|
-
// oneapi::mkl::rng::poisson_v_method::gaussian_icdf_based
|
|
1816
|
-
//
|
|
1817
|
-
// Input arguments:
|
|
1818
|
-
// lambda - span of distribution parameters
|
|
1819
|
-
|
|
1820
|
-
namespace poisson_v_method {
|
|
1821
|
-
struct gaussian_icdf_based {};
|
|
1822
|
-
using by_default = gaussian_icdf_based;
|
|
1823
|
-
} // namespace poisson_v_method
|
|
1824
|
-
|
|
1825
|
-
template <typename IntType = std::int32_t, typename Method = poisson_v_method::by_default>
|
|
1826
|
-
class poisson_v {
|
|
1827
|
-
public:
|
|
1828
|
-
static_assert(std::is_same<Method, poisson_v_method::gaussian_icdf_based>::value,
|
|
1829
|
-
"oneMKL: rng/poisson_v: method is incorrect");
|
|
1830
|
-
|
|
1831
|
-
static_assert(std::is_same<IntType, std::int32_t>::value ||
|
|
1832
|
-
std::is_same<IntType, std::uint32_t>::value,
|
|
1833
|
-
"oneMKL: rng/poisson_v: type is not supported");
|
|
1834
|
-
|
|
1835
|
-
using method_type = Method;
|
|
1836
|
-
using result_type = IntType;
|
|
1837
|
-
|
|
1838
|
-
struct param_type {
|
|
1839
|
-
param_type(sycl::span<double> lambda) : lambda_span_(lambda) {}
|
|
1840
|
-
|
|
1841
|
-
sycl::span<double> lambda_span_;
|
|
1842
|
-
};
|
|
1843
|
-
|
|
1844
|
-
explicit poisson_v(sycl::span<double> lambda) : lambda_span_(lambda) {
|
|
1845
|
-
if ((lambda.size() <= 0)) {
|
|
1846
|
-
throw oneapi::mkl::invalid_argument("rng", "poisson_v",
|
|
1847
|
-
"size of lambda < 0");
|
|
1848
|
-
}
|
|
1849
|
-
}
|
|
1850
|
-
|
|
1851
|
-
explicit poisson_v(const param_type& pt) : lambda_span_(pt.lambda_span_) {
|
|
1852
|
-
if ((pt.lambda_span_.size() <= 0)) {
|
|
1853
|
-
throw oneapi::mkl::invalid_argument("rng", "poisson_v", "size of lambda < 0");
|
|
1854
|
-
}
|
|
1855
|
-
}
|
|
1856
|
-
|
|
1857
|
-
sycl::span<double> lambda() const {
|
|
1858
|
-
return lambda_span_;
|
|
1859
|
-
}
|
|
1860
|
-
|
|
1861
|
-
param_type param() const {
|
|
1862
|
-
return param_type(lambda_span_);
|
|
1863
|
-
}
|
|
1864
|
-
|
|
1865
|
-
void param(const param_type& pt) {
|
|
1866
|
-
if ((pt.lambda_span_.size() <= 0)) {
|
|
1867
|
-
throw oneapi::mkl::invalid_argument("rng", "poisson_v", "size of lambda < 0");
|
|
1868
|
-
}
|
|
1869
|
-
lambda_span_ = pt.lambda_span_;
|
|
1870
|
-
}
|
|
1871
|
-
|
|
1872
|
-
private:
|
|
1873
|
-
sycl::span<double> lambda_span_;
|
|
1874
|
-
};
|
|
1875
|
-
|
|
1876
|
-
// Class template oneapi::mkl::rng::uniform_bits
|
|
1877
|
-
//
|
|
1878
|
-
// Represents discrete uniform bits random number distribution
|
|
1879
|
-
//
|
|
1880
|
-
// Supported types:
|
|
1881
|
-
// std::uint32_t
|
|
1882
|
-
//
|
|
1883
|
-
|
|
1884
|
-
template <typename UIntType = std::uint32_t>
|
|
1885
|
-
class uniform_bits {
|
|
1886
|
-
public:
|
|
1887
|
-
static_assert(std::is_same<UIntType, std::uint32_t>::value ||
|
|
1888
|
-
std::is_same<UIntType, std::uint64_t>::value,
|
|
1889
|
-
"oneMKL: rng/uniform_bits: type is not supported");
|
|
1890
|
-
using result_type = UIntType;
|
|
1891
|
-
};
|
|
1892
|
-
|
|
1893
|
-
// Class template oneapi::mkl::rng::bits
|
|
1894
|
-
//
|
|
1895
|
-
// Represents bits of underlying random number engine
|
|
1896
|
-
//
|
|
1897
|
-
// Supported types:
|
|
1898
|
-
// std::uint32_t
|
|
1899
|
-
//
|
|
1900
|
-
|
|
1901
|
-
template <typename UIntType = std::uint32_t>
|
|
1902
|
-
class bits {
|
|
1903
|
-
public:
|
|
1904
|
-
static_assert(std::is_same<UIntType, std::uint32_t>::value || std::is_same<UIntType, std::uint64_t>::value,
|
|
1905
|
-
"oneMKL: rng/bits: type is not supported");
|
|
1906
|
-
using result_type = UIntType;
|
|
1907
|
-
};
|
|
1908
|
-
|
|
1909
|
-
} // namespace rng
|
|
1910
|
-
} // namespace mkl
|
|
1911
|
-
} // namespace oneapi
|
|
1912
|
-
|
|
1913
|
-
#endif // _MKL_RNG_DISTRIBUTIONS_HPP_
|