pRC
multi-purpose Tensor Train library for C++
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{
18 template<class T, Size... Ns, template<class...> class D>
19 struct Random<Tensor<T, Ns...>, D<typename T::Value>,
20 If<IsDistribution<D<typename T::Value>>>>
21 {
22 public:
24 : mRNG(rng)
25 , mDistribution(distribution)
26 {
27 }
28
29 constexpr auto operator()()
30 {
31 return TensorViews::Random<T, Sizes<Ns...>, D>(mRNG, mDistribution);
32 }
33
34 private:
35 RandomEngine &mRNG;
36 D<typename T::Value> &mDistribution;
37 };
38}
39#endif // pRC_CORE_TENSOR_RANDOM_H
Definition sequence.hpp:56
Definition random.hpp:15
Class storing tensors.
Definition tensor.hpp:44
Definition threefry.hpp:24
Definition cholesky.hpp:18
std::enable_if_t< B{}, int > If
Definition type_traits.hpp:68
std::size_t Size
Definition type_traits.hpp:20
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13
Random(RandomEngine &rng, D< typename T::Value > &distribution)
Definition random.hpp:23
Definition random.hpp:12