]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/compute/include/boost/compute/algorithm/detail/random_fill.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / compute / include / boost / compute / algorithm / detail / random_fill.hpp
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
3 //
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
7 //
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
10
11 #ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_RANDOM_FILL_HPP
12 #define BOOST_COMPUTE_ALGORITHM_DETAIL_RANDOM_FILL_HPP
13
14 #include <iterator>
15
16 #include <boost/compute/command_queue.hpp>
17 #include <boost/compute/random/default_random_engine.hpp>
18 #include <boost/compute/random/uniform_real_distribution.hpp>
19
20 namespace boost {
21 namespace compute {
22 namespace detail {
23
24 template<class OutputIterator, class Generator>
25 inline void random_fill(OutputIterator first,
26 OutputIterator last,
27 Generator &g,
28 command_queue &queue)
29 {
30 g.fill(first, last, queue);
31 }
32
33 template<class OutputIterator>
34 inline void
35 random_fill(OutputIterator first,
36 OutputIterator last,
37 typename std::iterator_traits<OutputIterator>::value_type lo,
38 typename std::iterator_traits<OutputIterator>::value_type hi,
39 command_queue &queue)
40 {
41 typedef typename
42 std::iterator_traits<OutputIterator>::value_type value_type;
43 typedef typename
44 boost::compute::default_random_engine engine_type;
45 typedef typename
46 boost::compute::uniform_real_distribution<value_type> distribution_type;
47
48 engine_type engine(queue);
49 distribution_type generator(lo, hi);
50 generator.fill(first, last, engine, queue);
51 }
52
53 } // end detail namespace
54 } // end compute namespace
55 } // end boost namespace
56
57 #endif // BOOST_COMPUTE_ALGORITHM_DETAIL_RANDOM_FILL_HPP