cMHN 1.2
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
random.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_TENSOR_RANDOM_H
4#define pRC_CORE_TENSOR_RANDOM_H
5
8
9namespace pRC
10{
11 template<class T, Size... Ns, class URNG, template<class...> class D>
12 requires IsRandomEngine<URNG> && IsRandomDistribution<D<Value<T>>>
13 struct Random<Tensor<T, Ns...>, URNG, D<Value<T>>>
14 {
15 public:
16 Random(URNG &rng, D<Value<T>> &distribution)
17 : mRNG(rng)
18 , mDistribution(distribution)
19 {
20 }
21
22 constexpr auto operator()()
23 {
24 return TensorViews::Random<T, Sizes<Ns...>, URNG, D>(mRNG,
25 mDistribution);
26 }
27
28 private:
29 URNG &mRNG;
30 D<Value<T>> &mDistribution;
31 };
32}
33#endif // pRC_CORE_TENSOR_RANDOM_H
pRC::Size const D
Definition CalculatePThetaTests.cpp:9
Definition value.hpp:12
Definition sequence.hpp:29
Definition random.hpp:15
Definition tensor.hpp:25
pRC::Float<> T
Definition externs_nonTT.hpp:1
Definition cholesky.hpp:10
std::size_t Size
Definition basics.hpp:31
typename ValueType< T >::Type Value
Definition value.hpp:72
constexpr auto operator()()
Definition random.hpp:22
Random(URNG &rng, D< Value< T > > &distribution)
Definition random.hpp:16
Definition random.hpp:12