Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
constants.h
Go to the documentation of this file.
1#ifndef STORM_UTILITY_CONSTANTS_H_
2#define STORM_UTILITY_CONSTANTS_H_
3
4#ifdef max
5#undef max
6#endif
7
8#ifdef min
9#undef min
10#endif
11
12#include <cstdint>
13#include <limits>
14#include <string>
15
16#include <map>
17#include <vector>
18
20
21namespace storm {
22
23// Forward-declare MatrixEntry class.
24namespace storage {
25template<typename IndexType, typename ValueType>
26class MatrixEntry;
27}
28
29template<typename RationalType>
30struct NumberTraits;
31
32namespace utility {
33
34namespace detail {
35template<typename ValueType>
37 typedef std::less<ValueType> type;
38};
39
40struct DoubleLess {
41 bool operator()(double a, double b) const {
42 return (a == 0.0 && b > 0.0) || (b - a > 1e-17);
43 }
44};
45
46template<>
47struct ElementLess<double> {
49};
50
51template<typename ValueType>
53 typedef std::greater<ValueType> type;
54};
55
57 bool operator()(double a, double b) const {
58 return (b == 0.0 && a > 0.0) || (a - b > 1e-17);
59 }
60};
61
62template<>
63struct ElementGreater<double> {
65};
66} // namespace detail
67
68template<typename ValueType>
70
71template<typename ValueType>
73
74template<typename ValueType>
75ValueType one();
76
77template<typename ValueType>
78ValueType zero();
79
80template<typename ValueType>
81ValueType infinity();
82
83template<typename ValueType>
84bool isOne(ValueType const& a);
85
86template<typename ValueType>
87bool isZero(ValueType const& a);
88
89template<typename ValueType>
90bool isNan(ValueType const& a);
91
92template<typename ValueType>
93bool isAlmostZero(ValueType const& a);
94
95template<typename ValueType>
96bool isAlmostOne(ValueType const& a);
97
98template<typename ValueType>
99bool isConstant(ValueType const& a);
100
101template<typename ValueType>
102bool isInfinity(ValueType const& a);
103
104template<typename ValueType>
105bool isInteger(ValueType const& number);
106
107template<typename TargetType, typename SourceType>
108TargetType convertNumber(SourceType const& number);
109
110template<typename ValueType>
111std::pair<ValueType, ValueType> asFraction(ValueType const& number);
112
113template<typename ValueType>
114ValueType simplify(ValueType value);
115
116template<typename IndexType, typename ValueType>
118
119template<typename IndexType, typename ValueType>
121
122template<typename ValueType>
123std::pair<ValueType, ValueType> minmax(std::vector<ValueType> const& values);
124
125template<typename ValueType>
126ValueType minimum(std::vector<ValueType> const& values);
127
128template<typename ValueType>
129ValueType maximum(std::vector<ValueType> const& values);
130
131template<typename K, typename ValueType>
132std::pair<ValueType, ValueType> minmax(std::map<K, ValueType> const& values);
133
134template<typename K, typename ValueType>
135ValueType minimum(std::map<K, ValueType> const& values);
136
137template<typename K, typename ValueType>
138ValueType maximum(std::map<K, ValueType> const& values);
139
140template<typename ValueType>
141ValueType pow(ValueType const& value, int_fast64_t exponent);
142
143template<typename ValueType>
144ValueType max(ValueType const& first, ValueType const& second);
145
146template<typename ValueType>
147ValueType min(ValueType const& first, ValueType const& second);
148
149template<typename ValueType>
150ValueType sqrt(ValueType const& number);
151
152template<typename ValueType>
153ValueType abs(ValueType const& number);
154
155template<typename ValueType>
156ValueType floor(ValueType const& number);
157
158template<typename ValueType>
159ValueType ceil(ValueType const& number);
160
161template<typename ValueType>
162ValueType round(ValueType const& number);
163
164template<typename ValueType>
165ValueType log(ValueType const& number);
166
167template<typename ValueType>
168ValueType log10(ValueType const& number);
169
170template<typename ValueType>
171ValueType cos(ValueType const& number);
172
173template<typename ValueType>
174ValueType sin(ValueType const& number);
175
176template<typename ValueType>
177typename NumberTraits<ValueType>::IntegerType trunc(ValueType const& number);
178
179template<typename RationalType>
180typename NumberTraits<RationalType>::IntegerType numerator(RationalType const& number);
181
182template<typename RationalType>
183typename NumberTraits<RationalType>::IntegerType denominator(RationalType const& number);
184
188template<typename IntegerType>
189std::pair<IntegerType, IntegerType> divide(IntegerType const& dividend, IntegerType const& divisor);
190
191template<typename IntegerType>
192IntegerType mod(IntegerType const& first, IntegerType const& second);
193
194template<typename ValueType>
195std::string to_string(ValueType const& value);
196} // namespace utility
197} // namespace storm
198
199#endif /* STORM_UTILITY_CONSTANTS_H_ */
ValueType max(ValueType const &first, ValueType const &second)
bool isOne(ValueType const &a)
Definition constants.cpp:36
NumberTraits< RationalType >::IntegerType denominator(RationalType const &number)
NumberTraits< RationalType >::IntegerType numerator(RationalType const &number)
bool isConstant(ValueType const &)
Definition constants.cpp:66
ValueType simplify(ValueType value)
ValueType min(ValueType const &first, ValueType const &second)
ValueType sin(ValueType const &number)
bool isAlmostZero(ValueType const &a)
Definition constants.cpp:56
bool isAlmostOne(ValueType const &a)
Definition constants.cpp:61
ValueType floor(ValueType const &number)
std::pair< ValueType, ValueType > asFraction(ValueType const &number)
bool isZero(ValueType const &a)
Definition constants.cpp:41
ValueType minimum(std::vector< ValueType > const &values)
ValueType ceil(ValueType const &number)
bool isInteger(ValueType const &number)
Definition constants.cpp:76
ValueType abs(ValueType const &number)
ValueType zero()
Definition constants.cpp:26
ValueType infinity()
Definition constants.cpp:31
bool isNan(ValueType const &)
Definition constants.cpp:46
std::string to_string(ValueType const &value)
std::pair< ValueType, ValueType > minmax(std::vector< ValueType > const &values)
typename detail::ElementLess< ValueType >::type ElementLess
Definition constants.h:69
typename detail::ElementGreater< ValueType >::type ElementGreater
Definition constants.h:72
NumberTraits< ValueType >::IntegerType trunc(ValueType const &number)
std::pair< IntegerType, IntegerType > divide(IntegerType const &dividend, IntegerType const &divisor)
(Integer-)Divides the dividend by the divisor and returns the result plus the remainder.
IntegerType mod(IntegerType const &first, IntegerType const &second)
ValueType pow(ValueType const &value, int_fast64_t exponent)
ValueType one()
Definition constants.cpp:21
ValueType log(ValueType const &number)
ValueType maximum(std::vector< ValueType > const &values)
ValueType cos(ValueType const &number)
ValueType sqrt(ValueType const &number)
bool isInfinity(ValueType const &a)
Definition constants.cpp:71
ValueType log10(ValueType const &number)
ValueType round(ValueType const &number)
TargetType convertNumber(SourceType const &number)
Definition constants.cpp:98
LabParser.cpp.
Definition cli.cpp:18
bool operator()(double a, double b) const
Definition constants.h:57
bool operator()(double a, double b) const
Definition constants.h:41
std::greater< ValueType > type
Definition constants.h:53
std::less< ValueType > type
Definition constants.h:37