mlpack  2.2.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
prereqs.hpp
Go to the documentation of this file.
1 
11 #ifndef MLPACK_PREREQS_HPP
12 #define MLPACK_PREREQS_HPP
13 
14 // Defining _USE_MATH_DEFINES should set M_PI.
15 #define _USE_MATH_DEFINES
16 #include <cmath>
17 
18 // First, check if Armadillo was included before, warning if so.
19 #ifdef ARMA_INCLUDES
20 #pragma message "Armadillo was included before mlpack; this can sometimes cause\
21  problems. It should only be necessary to include <mlpack/core.hpp> and not \
22 <armadillo>."
23 #endif
24 
25 // Next, standard includes.
26 #include <cstdlib>
27 #include <cstdio>
28 #include <cstring>
29 #include <cctype>
30 #include <climits>
31 #include <cfloat>
32 #include <cstdint>
33 #include <iostream>
34 #include <stdexcept>
35 #include <tuple>
36 #include <queue>
37 
38 // Defining _USE_MATH_DEFINES should set M_PI.
39 #define _USE_MATH_DEFINES
40 #include <cmath>
41 
42 // For tgamma().
43 #include <boost/math/special_functions/gamma.hpp>
44 
45 // But if it's not defined, we'll do it.
46 #ifndef M_PI
47  #define M_PI 3.141592653589793238462643383279
48 #endif
49 
50 // Give ourselves a nice way to force functions to be inline if we need.
51 #define force_inline
52 #if defined(__GNUG__) && !defined(DEBUG)
53  #undef force_inline
54  #define force_inline __attribute__((always_inline))
55 #elif defined(_MSC_VER) && !defined(DEBUG)
56  #undef force_inline
57  #define force_inline __forceinline
58 #endif
59 
60 // We'll need the necessary boost::serialization features, as well as what we
61 // use with mlpack. In Boost 1.59 and newer, the BOOST_PFTO code is no longer
62 // defined, but we still need to define it (as nothing) so that the mlpack
63 // serialization shim compiles.
64 #include <boost/serialization/serialization.hpp>
65 #include <boost/serialization/vector.hpp>
66 #include <boost/serialization/map.hpp>
67 // boost_backport.hpp handles the version and backporting of serialization (and
68 // other) features.
69 #include "mlpack/core/boost_backport/boost_backport.hpp"
70 // Boost 1.59 and newer don't use BOOST_PFTO, but our shims do. We can resolve
71 // any issue by setting BOOST_PFTO to nothing.
72 #ifndef BOOST_PFTO
73  #define BOOST_PFTO
74 #endif
77 
78 // Now include Armadillo through the special mlpack extensions.
79 #include <mlpack/core/arma_extend/arma_extend.hpp>
81 
82 // Ensure that the user isn't doing something stupid with their Armadillo
83 // defines.
85 
86 // All code should have access to logging.
87 #include <mlpack/core/util/log.hpp>
90 
91 // On Visual Studio, disable C4519 (default arguments for function templates)
92 // since it's by default an error, which doesn't even make any sense because
93 // it's part of the C++11 standard.
94 #ifdef _MSC_VER
95  #pragma warning(disable : 4519)
96  #define ARMA_USE_CXX11
97 #endif
98 
99 // We need to be able to mark functions deprecated.
101 
102 #endif