MCKL
Monte Carlo Kernel Library
increment.hpp
Go to the documentation of this file.
1 //============================================================================
2 // MCKL/include/mckl/random/increment.hpp
3 //----------------------------------------------------------------------------
4 // MCKL: Monte Carlo Kernel Library
5 //----------------------------------------------------------------------------
6 // Copyright (c) 2013-2018, Yan Zhou
7 // All rights reserved.
8 //
9 // Redistribution and use in source and binary forms, with or without
10 // modification, are permitted provided that the following conditions are met:
11 //
12 // Redistributions of source code must retain the above copyright notice,
13 // this list of conditions and the following disclaimer.
14 //
15 // Redistributions in binary form must reproduce the above copyright notice,
16 // this list of conditions and the following disclaimer in the documentation
17 // and/or other materials provided with the distribution.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
20 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 // POSSIBILITY OF SUCH DAMAGE.
30 //============================================================================
31 
32 #ifndef MCKL_RANDOM_INCREMENT_HPP
33 #define MCKL_RANDOM_INCREMENT_HPP
34 
37 
38 #if MCKL_USE_SSE2
40 #endif
41 
42 #if MCKL_USE_AVX2
44 #endif
45 
46 #if MCKL_USE_AVX512
48 #endif
49 
50 namespace mckl {
51 
52 namespace internal {
53 
54 template <typename T, std::size_t K,
55  bool = (sizeof(T) * K) % sizeof(std::uint8_t) == 0,
56  bool = (sizeof(T) * K) % sizeof(std::uint16_t) == 0,
57  bool = (sizeof(T) * K) % sizeof(std::uint32_t) == 0,
58  bool = (sizeof(T) * K) % sizeof(std::uint64_t) == 0>
60 {
61  public:
62  using type = std::array<T, K>;
63 }; // class CounterImpl
64 
65 template <typename T, std::size_t K>
66 class CounterImpl<T, K, true, false, false, false>
67 {
68  public:
69  using type =
70  std::array<std::uint8_t, sizeof(T) * K / sizeof(std::uint8_t)>;
71 }; // class CounterImpl
72 
73 template <typename T, std::size_t K>
74 class CounterImpl<T, K, true, true, false, false>
75 {
76  public:
77  using type =
78  std::array<std::uint16_t, sizeof(T) * K / sizeof(std::uint16_t)>;
79 }; // class CounterImpl
80 
81 template <typename T, std::size_t K>
82 class CounterImpl<T, K, true, true, true, false>
83 {
84  public:
85  using type =
86  std::array<std::uint32_t, sizeof(T) * K / sizeof(std::uint32_t)>;
87 }; // class CounterImpl
88 
89 template <typename T, std::size_t K>
90 class CounterImpl<T, K, true, true, true, true>
91 {
92  public:
93  using type =
94  std::array<std::uint64_t, sizeof(T) * K / sizeof(std::uint64_t)>;
95 }; // class CounterImpl
96 
97 } // namespace internal
98 
103 template <typename T, std::size_t K>
105 
106 } // namespace mckl
107 
108 #endif // MCKL_RANDOM_INCREMENT_HPP
std::array< std::uint64_t, sizeof(T) *K/sizeof(std::uint64_t)> type
Definition: increment.hpp:94
uint uint32_t
Definition: opencl.h:41
ulong uint64_t
Definition: opencl.h:42
typename internal::CounterImpl< T, K >::type Counter
A counter type with the same width as std::array<T, K> but with possibly fewer elements.
Definition: increment.hpp:104
std::array< std::uint16_t, sizeof(T) *K/sizeof(std::uint16_t)> type
Definition: increment.hpp:78
std::array< std::uint8_t, sizeof(T) *K/sizeof(std::uint8_t)> type
Definition: increment.hpp:70
Definition: mcmc.hpp:40
std::array< T, K > type
Definition: increment.hpp:62
std::array< std::uint32_t, sizeof(T) *K/sizeof(std::uint32_t)> type
Definition: increment.hpp:86