random.hpp
Go to the documentation of this file.
1/*!
2 *
3 *
4 * \brief Generation of random variates
5 *
6 * \author O. Krause
7 * \date 2017
8 *
9 *
10 * \par Copyright 1995-2015 Shark Development Team
11 *
12 * <BR><HR>
13 * This file is part of Shark.
14 * <http://image.diku.dk/shark/>
15 *
16 * Shark is free software: you can redistribute it and/or modify
17 * it under the terms of the GNU Lesser General Public License as published
18 * by the Free Software Foundation, either version 3 of the License, or
19 * (at your option) any later version.
20 *
21 * Shark is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU Lesser General Public License for more details.
25 *
26 * You should have received a copy of the GNU Lesser General Public License
27 * along with Shark. If not, see <http://www.gnu.org/licenses/>.
28 *
29 */
30#ifndef REMORA_KERNELS_RANDOM_HPP
31#define REMORA_KERNELS_RANDOM_HPP
32
33#include "default/random.hpp"
34#ifdef REMORA_USE_GPU
35#include "gpu/random.hpp"
36#endif
37
38namespace remora{namespace kernels{
39
40template<class V, class Rng, class Device>
41void generate_normal(
42 vector_expression<V, Device>& v,
43 Rng& rng,
44 typename V::value_type mean,
45 typename V::value_type variance
46) {
47 bindings::generate_normal(v, rng, mean, variance);
48}
49
50template<class M, class Rng, class Device>
51void generate_normal(
52 matrix_expression<M, Device>& m,
53 Rng& rng,
54 typename M::value_type mean,
55 typename M::value_type variance
56) {
57 bindings::generate_normal(m, rng, mean, variance);
58}
59
60template<class V, class Rng, class Device>
61void generate_uniform(
62 vector_expression<V, Device>& v,
63 Rng& rng,
64 typename V::value_type low,
65 typename V::value_type high
66) {
67 bindings::generate_uniform(v, rng, low, high);
68}
69
70template<class M, class Rng, class Device>
71void generate_uniform(
72 matrix_expression<M, Device>& m,
73 Rng& rng,
74 typename M::value_type low,
75 typename M::value_type high
76) {
77 bindings::generate_uniform(m, rng, low, high);
78}
79
80template<class V, class Rng, class Device>
81void generate_discrete(
82 vector_expression<V, Device>& v,
83 Rng& rng,
84 int low,
85 int high
86) {
87 bindings::generate_discrete(v, rng, low, high);
88}
89
90template<class M, class Rng, class Device>
91void generate_discrete(
92 matrix_expression<M, Device>& m,
93 Rng& rng,
94 int low,
95 int high
96) {
97 bindings::generate_discrete(m, rng, low, high);
98}
99
100}}
101#endif