GooseEYE 0.9.1
Loading...
Searching...
No Matches
config.h
Go to the documentation of this file.
1
7#ifndef GOOSEEYE_CONFIG_H
8#define GOOSEEYE_CONFIG_H
9
13#define _USE_MATH_DEFINES
18#include <algorithm>
19#include <assert.h>
20#include <cstdlib>
21#include <exception>
22#include <iomanip>
23#include <iostream>
24#include <limits>
25#include <map>
26#include <math.h>
27#include <memory>
28#include <numeric>
29#include <string>
30#include <type_traits>
31#include <vector>
32
33#include <xtensor/xadapt.hpp>
34#include <xtensor/xarray.hpp>
35#include <xtensor/xio.hpp>
36#include <xtensor/xmath.hpp>
37#include <xtensor/xpad.hpp>
38#include <xtensor/xsort.hpp>
39#include <xtensor/xtensor.hpp>
40#include <xtensor/xview.hpp>
41
45#define Q(x) #x
46#define QUOTE(x) Q(x)
47
48#define GOOSEEYE_WARNING_IMPL(message, file, line, function) \
49 std::cout << std::string(file) + ":" + std::to_string(line) + " (" + std::string(function) + \
50 ")" + ": " message ") \n\t";
51
52#define GOOSEEYE_ASSERT_IMPL(expr, assertion, file, line, function) \
53 if (!(expr)) { \
54 throw assertion( \
55 std::string(file) + ":" + std::to_string(line) + " (" + std::string(function) + ")" + \
56 ": assertion failed (" #expr ") \n\t"); \
57 }
58
59#define SIGN(a) ((a < 0) ? -1 : a > 0 ? 1 : 0)
67#define GOOSEEYE_REQUIRE(expr, assertion) \
68 GOOSEEYE_ASSERT_IMPL(expr, assertion, __FILE__, __LINE__, __FUNCTION__)
69
87#ifdef GOOSEEYE_ENABLE_ASSERT
88#define GOOSEEYE_ASSERT(expr, assertion) \
89 GOOSEEYE_ASSERT_IMPL(expr, assertion, __FILE__, __LINE__, __FUNCTION__)
90#else
91#define GOOSEEYE_ASSERT(expr, assertion)
92#endif
93
103#ifndef GOOSEEYE_DISABLE_WARNING
104#define GOOSEEYE_WARNING(message) GOOSEEYE_WARNING_IMPL(message, __FILE__, __LINE__, __FUNCTION__)
105#else
106#define GOOSEEYE_WARNING(message)
107#endif
108
118#ifdef GOOSEEYE_ENABLE_WARNING_PYTHON
119#define GOOSEEYE_WARNING_PYTHON(message) \
120 GOOSEEYE_WARNING_IMPL(message, __FILE__, __LINE__, __FUNCTION__)
121#else
122#define GOOSEEYE_WARNING_PYTHON(message)
123#endif
124
128namespace GooseEYE {
129
133namespace array_type {
134
135#ifdef GOOSEEYE_USE_XTENSOR_PYTHON
136
140template <typename T, size_t N>
141using tensor = xt::pytensor<T, N>;
142
146template <typename T>
147using array = xt::pyarray<T>;
148
149#else
150
154template <typename T, size_t N>
155using tensor = xt::xtensor<T, N>;
156
160template <typename T>
161using array = xt::xarray<T>;
162
163#endif
164
165} // namespace array_type
166
167} // namespace GooseEYE
168
169#endif
xt::xtensor< T, N > tensor
Fixed (static) rank array.
Definition config.h:155
xt::xarray< T > array
Dynamic rank array.
Definition config.h:161
Toolbox to compute statistics.
Definition config.h:128