vSMC
vSMC: Scalable Monte Carlo
defines.hpp
Go to the documentation of this file.
1 //============================================================================
2 // vSMC/include/vsmc/internal/defines.hpp
3 //----------------------------------------------------------------------------
4 // vSMC: Scalable Monte Carlo
5 //----------------------------------------------------------------------------
6 // Copyright (c) 2013,2014, 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 VSMC_INTERNAL_DEFINES_HPP
33 #define VSMC_INTERNAL_DEFINES_HPP
34 
35 #include <vsmc/internal/config.hpp>
36 
38 #define VSMC_MNE
39 
46 #if VSMC_NO_RUNTIME_ASSERT
47 #define VSMC_CRTP_DESTRUCTOR_PREFIX
48 #else
49 #define VSMC_CRTP_DESTRUCTOR_PREFIX virtual
50 #endif
51 
54 #if VSMC_HAS_CXX11_CONSTEXPR
55 #define VSMC_CONSTEXPR constexpr
56 #else
57 #define VSMC_CONSTEXPR
58 #endif
59 
62 #if VSMC_HAS_CXX11_EXPLICIT_CONVERSIONS
63 #define VSMC_EXPLICIT_OPERATOR explicit
64 #else
65 #define VSMC_EXPLICIT_OPERATOR
66 #endif
67 
70 #if VSMC_HAS_CXX11_NOEXCEPT
71 #define VSMC_NOEXCEPT noexcept
72 #else
73 #define VSMC_NOEXCEPT throw()
74 #endif
75 
78 #if VSMC_HAS_CXX11_NULLPTR && VSMC_HAS_CXX11LIB_FUNCTIONAL
79 #define VSMC_NULLPTR nullptr
80 #else
81 #define VSMC_NULLPTR 0
82 #endif
83 
84 namespace vsmc {
85 
93 
96 enum {
97  Dynamic = 0
98 }; // enum Dynamic
99 
103  RowMajor = 101,
104  ColMajor = 102
105 }; // enum MatrixOrder
106 
109 struct Scalar
110 {
111  static VSMC_CONSTEXPR const bool is_scalar = true;
112  static VSMC_CONSTEXPR const bool is_vector = false;
113 }; // struct Scalar
114 
117 struct Vector
118 {
119  static VSMC_CONSTEXPR const bool is_scalar = false;
120  static VSMC_CONSTEXPR const bool is_vector = true;
121 }; // struct Vector
122 
125 template <std::size_t N>
126 struct Position
127 {
128  typedef std::size_t size_type;
129  typedef Position<N> type;
130  static VSMC_CONSTEXPR const size_type value = N;
131  VSMC_CONSTEXPR operator size_type () const {return value;}
132  VSMC_CONSTEXPR size_type operator() () const {return value;}
133 }; // struct Position
134 
135 } // namespace vsmc
136 
137 #endif // VSMC_INTERNAL_DEFINES_HPP
static constexpr const bool is_vector
Definition: defines.hpp:112
Definition: adapter.hpp:37
std::size_t size_type
Definition: defines.hpp:128
#define VSMC_CONSTEXPR
constexpr
Definition: defines.hpp:55
constexpr size_type operator()() const
Definition: defines.hpp:132
static constexpr const bool is_vector
Definition: defines.hpp:120
Function template argument used for position.
Definition: defines.hpp:126
Class template argument used for scalar variant.
Definition: defines.hpp:109
Data are stored column by column in memory.
Definition: defines.hpp:104
Used to specify a dimension template parameter is dynamic.
Definition: defines.hpp:97
static constexpr const bool is_scalar
Definition: defines.hpp:119
Data are stored row by row in memory.
Definition: defines.hpp:103
Class template argument used for vector variant.
Definition: defines.hpp:117
MatrixOrder
Matrix order.
Definition: defines.hpp:102
SIMD
SIMD instructions.
Definition: defines.hpp:92
Position< N > type
Definition: defines.hpp:129
static constexpr const size_type value
Definition: defines.hpp:130
static constexpr const bool is_scalar
Definition: defines.hpp:111