p1788 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +8 -0
- data/AUTHORS +6 -0
- data/LICENSE +201 -0
- data/NOTICE +29 -0
- data/README.md +65 -0
- data/ext/libieeep1788_copy/README +3 -0
- data/ext/libieeep1788_copy/p1788/AUTHORS +16 -0
- data/ext/libieeep1788_copy/p1788/LICENSE +202 -0
- data/ext/libieeep1788_copy/p1788/NOTICE +14 -0
- data/ext/libieeep1788_copy/p1788/decoration/decoration.hpp +265 -0
- data/ext/libieeep1788_copy/p1788/exception/exception.hpp +302 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor.hpp +3443 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_bool_func_impl.hpp +608 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_cancel_func_impl.hpp +229 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_class_impl.hpp +526 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_elem_func_impl.hpp +4533 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_io_impl.hpp +1421 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_mul_rev_to_pair_func_impl.hpp +347 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_num_func_impl.hpp +655 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_rec_bool_func_impl.hpp +146 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_rec_overlap_impl.hpp +188 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_rev_func_impl.hpp +1674 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_set_op_impl.hpp +216 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_setup_func_impl.hpp +68 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_util_func_impl.hpp +135 -0
- data/ext/libieeep1788_copy/p1788/flavor/infsup/setbased/mpfr_bin_ieee754_flavor_validation_func_impl.hpp +93 -0
- data/ext/libieeep1788_copy/p1788/infsup/base_interval.hpp +1529 -0
- data/ext/libieeep1788_copy/p1788/infsup/base_interval_bool_func_impl.hpp +481 -0
- data/ext/libieeep1788_copy/p1788/infsup/base_interval_cancel_func_impl.hpp +126 -0
- data/ext/libieeep1788_copy/p1788/infsup/base_interval_elem_func_impl.hpp +1581 -0
- data/ext/libieeep1788_copy/p1788/infsup/base_interval_io_impl.hpp +59 -0
- data/ext/libieeep1788_copy/p1788/infsup/base_interval_mul_rev_to_pair_func_impl.hpp +88 -0
- data/ext/libieeep1788_copy/p1788/infsup/base_interval_num_func_impl.hpp +345 -0
- data/ext/libieeep1788_copy/p1788/infsup/base_interval_rec_bool_func_impl.hpp +92 -0
- data/ext/libieeep1788_copy/p1788/infsup/base_interval_rec_overlap_impl.hpp +72 -0
- data/ext/libieeep1788_copy/p1788/infsup/base_interval_rev_func_impl.hpp +656 -0
- data/ext/libieeep1788_copy/p1788/infsup/base_interval_set_op_impl.hpp +126 -0
- data/ext/libieeep1788_copy/p1788/infsup/decorated_interval.hpp +464 -0
- data/ext/libieeep1788_copy/p1788/infsup/forward_declaration.hpp +66 -0
- data/ext/libieeep1788_copy/p1788/infsup/interval.hpp +275 -0
- data/ext/libieeep1788_copy/p1788/io/io_manip.hpp +531 -0
- data/ext/libieeep1788_copy/p1788/overlapping/overlapping.hpp +241 -0
- data/ext/libieeep1788_copy/p1788/p1788.hpp +45 -0
- data/ext/libieeep1788_copy/p1788/reduction/reduction.hpp +341 -0
- data/ext/libieeep1788_copy/p1788/util/io.hpp +63 -0
- data/ext/libieeep1788_copy/p1788/util/mixed_type_traits.hpp +140 -0
- data/ext/libieeep1788_copy/p1788/util/mpfr_util.hpp +77 -0
- data/ext/libieeep1788_copy/p1788/util/mpfr_var.hpp +119 -0
- data/ext/libieeep1788_copy/p1788/util/mpfr_var_impl.hpp +382 -0
- data/ext/libieeep1788_copy/p1788/version.hpp +34 -0
- data/ext/p1788/extconf.rb +49 -0
- data/ext/p1788/p1788.cc +3764 -0
- data/lib/p1788/version.rb +4 -0
- data/lib/p1788.rb +25 -0
- data/p1788.gemspec +72 -0
- metadata +99 -0
@@ -0,0 +1,481 @@
|
|
1
|
+
//
|
2
|
+
// libieeep1788
|
3
|
+
//
|
4
|
+
// An implementation of the preliminary IEEE P1788 standard for
|
5
|
+
// interval arithmetic
|
6
|
+
//
|
7
|
+
//
|
8
|
+
// Copyright 2013 - 2015
|
9
|
+
//
|
10
|
+
// Marco Nehmeier (nehmeier@informatik.uni-wuerzburg.de)
|
11
|
+
// Department of Computer Science,
|
12
|
+
// University of Wuerzburg, Germany
|
13
|
+
//
|
14
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
15
|
+
// you may not use this file except in compliance with the License.
|
16
|
+
// You may obtain a copy of the License at
|
17
|
+
//
|
18
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
19
|
+
//
|
20
|
+
// Unless required by applicable law or agreed to in writing, software
|
21
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
22
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
23
|
+
// See the License for the specific language governing permissions and
|
24
|
+
// limitations under the License.
|
25
|
+
|
26
|
+
#ifndef LIBIEEEP1788_P1788_INFSUP_BASE_INTERVAL_BOOL_FUNC_IMPL_HPP
|
27
|
+
#define LIBIEEEP1788_P1788_INFSUP_BASE_INTERVAL_BOOL_FUNC_IMPL_HPP
|
28
|
+
|
29
|
+
namespace p1788
|
30
|
+
{
|
31
|
+
|
32
|
+
namespace infsup
|
33
|
+
{
|
34
|
+
|
35
|
+
// is_empty
|
36
|
+
|
37
|
+
// static
|
38
|
+
template<typename T, template<typename> class Flavor, typename RepType, class ConcreteInterval>
|
39
|
+
bool base_interval<T, Flavor, RepType, ConcreteInterval>::is_empty(base_interval<T, Flavor, RepType, ConcreteInterval> const& x)
|
40
|
+
{
|
41
|
+
return Flavor<T>::is_empty(x.rep_);
|
42
|
+
}
|
43
|
+
|
44
|
+
// function
|
45
|
+
template<typename T, template<typename> class Flavor, typename RepType, class ConcreteInterval>
|
46
|
+
bool is_empty(base_interval<T, Flavor, RepType, ConcreteInterval> const& x)
|
47
|
+
{
|
48
|
+
return base_interval<T, Flavor, RepType, ConcreteInterval>::is_empty(x);
|
49
|
+
}
|
50
|
+
|
51
|
+
|
52
|
+
// is_entire
|
53
|
+
|
54
|
+
// static
|
55
|
+
template<typename T, template<typename> class Flavor, typename RepType, class ConcreteInterval>
|
56
|
+
bool base_interval<T, Flavor, RepType, ConcreteInterval>::is_entire(base_interval<T, Flavor, RepType, ConcreteInterval> const& x)
|
57
|
+
{
|
58
|
+
return Flavor<T>::is_entire(x.rep_);
|
59
|
+
}
|
60
|
+
|
61
|
+
// function
|
62
|
+
template<typename T, template<typename> class Flavor, typename RepType, class ConcreteInterval>
|
63
|
+
bool is_entire(base_interval<T, Flavor, RepType, ConcreteInterval> const& x)
|
64
|
+
{
|
65
|
+
return base_interval<T, Flavor, RepType, ConcreteInterval>::is_entire(x);
|
66
|
+
}
|
67
|
+
|
68
|
+
|
69
|
+
// is_equal
|
70
|
+
|
71
|
+
// static
|
72
|
+
template<typename T, template<typename> class Flavor, typename RepType, class ConcreteInterval>
|
73
|
+
template<typename T_, typename RepType_, class ConcreteInterval_>
|
74
|
+
bool base_interval<T, Flavor, RepType, ConcreteInterval>::equal(base_interval<T, Flavor, RepType, ConcreteInterval> const& x,
|
75
|
+
base_interval<T_, Flavor, RepType_, ConcreteInterval_> const& y)
|
76
|
+
{
|
77
|
+
// assert that only bare intervals or decorated intervals are used
|
78
|
+
static_assert( (std::is_same<typename Flavor<T>::representation, RepType>::value
|
79
|
+
&& std::is_same<typename Flavor<T_>::representation, RepType_>::value)
|
80
|
+
|| (std::is_same<typename Flavor<T>::representation_dec, RepType>::value
|
81
|
+
&& std::is_same<typename Flavor<T_>::representation_dec, RepType_>::value),
|
82
|
+
"It is not supported by mixed type operations to use "
|
83
|
+
"interval and decorated_interval types together!"
|
84
|
+
);
|
85
|
+
|
86
|
+
return Flavor<T>::equal(x.rep_, y.rep_);
|
87
|
+
}
|
88
|
+
|
89
|
+
// function
|
90
|
+
template<typename T1, template<typename> class Flavor, typename RepType1, class ConcreteInterval1, typename T2, typename RepType2, class ConcreteInterval2>
|
91
|
+
bool equal(base_interval<T1, Flavor, RepType1, ConcreteInterval1> const& x, base_interval<T2, Flavor, RepType2, ConcreteInterval2> const& y)
|
92
|
+
{
|
93
|
+
return base_interval<T1, Flavor, RepType1, ConcreteInterval1>::equal(x, y);
|
94
|
+
}
|
95
|
+
|
96
|
+
// operator
|
97
|
+
template<typename T1, template<typename> class Flavor, typename RepType1, class ConcreteInterval1, typename T2, typename RepType2, class ConcreteInterval2>
|
98
|
+
bool operator==(base_interval<T1, Flavor, RepType1, ConcreteInterval1> const& x, base_interval<T2, Flavor, RepType2, ConcreteInterval2> const& y)
|
99
|
+
{
|
100
|
+
return base_interval<T1, Flavor, RepType1, ConcreteInterval1>::equal(x, y);
|
101
|
+
}
|
102
|
+
|
103
|
+
// operator
|
104
|
+
template<typename T1, template<typename> class Flavor, typename RepType1, class ConcreteInterval1, typename T2, typename RepType2, class ConcreteInterval2>
|
105
|
+
bool operator!=(base_interval<T1, Flavor, RepType1, ConcreteInterval1> const& x, base_interval<T2, Flavor, RepType2, ConcreteInterval2> const& y)
|
106
|
+
{
|
107
|
+
return !base_interval<T1, Flavor, RepType1, ConcreteInterval1>::equal(x, y);
|
108
|
+
}
|
109
|
+
|
110
|
+
|
111
|
+
// subset
|
112
|
+
|
113
|
+
// static
|
114
|
+
template<typename T, template<typename> class Flavor, typename RepType, class ConcreteInterval>
|
115
|
+
template<typename T_, typename RepType_, class ConcreteInterval_>
|
116
|
+
bool base_interval<T, Flavor, RepType, ConcreteInterval>::subset(base_interval<T, Flavor, RepType, ConcreteInterval> const& x,
|
117
|
+
base_interval<T_, Flavor, RepType_, ConcreteInterval_> const& y)
|
118
|
+
{
|
119
|
+
// assert that only bare intervals or decorated intervals are used
|
120
|
+
static_assert( (std::is_same<typename Flavor<T>::representation, RepType>::value
|
121
|
+
&& std::is_same<typename Flavor<T_>::representation, RepType_>::value)
|
122
|
+
|| (std::is_same<typename Flavor<T>::representation_dec, RepType>::value
|
123
|
+
&& std::is_same<typename Flavor<T_>::representation_dec, RepType_>::value),
|
124
|
+
"It is not supported by mixed type operations to use "
|
125
|
+
"interval and decorated_interval types together!"
|
126
|
+
);
|
127
|
+
|
128
|
+
return Flavor<T>::subset(x.rep_, y.rep_);
|
129
|
+
}
|
130
|
+
|
131
|
+
// function
|
132
|
+
template<typename T1, template<typename> class Flavor, typename RepType1, class ConcreteInterval1, typename T2, typename RepType2, class ConcreteInterval2>
|
133
|
+
bool subset(base_interval<T1, Flavor, RepType1, ConcreteInterval1> const& x, base_interval<T2, Flavor, RepType2, ConcreteInterval2> const& y)
|
134
|
+
{
|
135
|
+
return base_interval<T1, Flavor, RepType1, ConcreteInterval1>::subset(x, y);
|
136
|
+
}
|
137
|
+
|
138
|
+
|
139
|
+
// superset
|
140
|
+
|
141
|
+
// static
|
142
|
+
template<typename T, template<typename> class Flavor, typename RepType, class ConcreteInterval>
|
143
|
+
template<typename T_, typename RepType_, class ConcreteInterval_>
|
144
|
+
bool base_interval<T, Flavor, RepType, ConcreteInterval>::superset(base_interval<T, Flavor, RepType, ConcreteInterval> const& x,
|
145
|
+
base_interval<T_, Flavor, RepType_, ConcreteInterval_> const& y)
|
146
|
+
{
|
147
|
+
// assert that only bare intervals or decorated intervals are used
|
148
|
+
static_assert( (std::is_same<typename Flavor<T>::representation, RepType>::value
|
149
|
+
&& std::is_same<typename Flavor<T_>::representation, RepType_>::value)
|
150
|
+
|| (std::is_same<typename Flavor<T>::representation_dec, RepType>::value
|
151
|
+
&& std::is_same<typename Flavor<T_>::representation_dec, RepType_>::value),
|
152
|
+
"It is not supported by mixed type operations to use "
|
153
|
+
"interval and decorated_interval types together!"
|
154
|
+
);
|
155
|
+
|
156
|
+
return Flavor<T_>::subset(y.rep_, x.rep_);
|
157
|
+
}
|
158
|
+
|
159
|
+
// function
|
160
|
+
template<typename T1, template<typename> class Flavor, typename RepType1, class ConcreteInterval1, typename T2, typename RepType2, class ConcreteInterval2>
|
161
|
+
bool superset(base_interval<T1, Flavor, RepType1, ConcreteInterval1> const& x, base_interval<T2, Flavor, RepType2, ConcreteInterval2> const& y)
|
162
|
+
{
|
163
|
+
return base_interval<T1, Flavor, RepType1, ConcreteInterval1>::superset(x, y);
|
164
|
+
}
|
165
|
+
|
166
|
+
|
167
|
+
// less
|
168
|
+
|
169
|
+
// static
|
170
|
+
template<typename T, template<typename> class Flavor, typename RepType, class ConcreteInterval>
|
171
|
+
template<typename T_, typename RepType_, class ConcreteInterval_>
|
172
|
+
bool base_interval<T, Flavor, RepType, ConcreteInterval>::less(base_interval<T, Flavor, RepType, ConcreteInterval> const& x,
|
173
|
+
base_interval<T_, Flavor, RepType_, ConcreteInterval_> const& y)
|
174
|
+
{
|
175
|
+
// assert that only bare intervals or decorated intervals are used
|
176
|
+
static_assert( (std::is_same<typename Flavor<T>::representation, RepType>::value
|
177
|
+
&& std::is_same<typename Flavor<T_>::representation, RepType_>::value)
|
178
|
+
|| (std::is_same<typename Flavor<T>::representation_dec, RepType>::value
|
179
|
+
&& std::is_same<typename Flavor<T_>::representation_dec, RepType_>::value),
|
180
|
+
"It is not supported by mixed type operations to use "
|
181
|
+
"interval and decorated_interval types together!"
|
182
|
+
);
|
183
|
+
|
184
|
+
return Flavor<T>::less(x.rep_, y.rep_);
|
185
|
+
}
|
186
|
+
|
187
|
+
// function
|
188
|
+
template<typename T1, template<typename> class Flavor, typename RepType1, class ConcreteInterval1, typename T2, typename RepType2, class ConcreteInterval2>
|
189
|
+
bool less(base_interval<T1, Flavor, RepType1, ConcreteInterval1> const& x, base_interval<T2, Flavor, RepType2, ConcreteInterval2> const& y)
|
190
|
+
{
|
191
|
+
return base_interval<T1, Flavor, RepType1, ConcreteInterval1>::less(x, y);
|
192
|
+
}
|
193
|
+
|
194
|
+
|
195
|
+
// greater
|
196
|
+
|
197
|
+
// static
|
198
|
+
template<typename T, template<typename> class Flavor, typename RepType, class ConcreteInterval>
|
199
|
+
template<typename T_, typename RepType_, class ConcreteInterval_>
|
200
|
+
bool base_interval<T, Flavor, RepType, ConcreteInterval>::greater(base_interval<T, Flavor, RepType, ConcreteInterval> const& x,
|
201
|
+
base_interval<T_, Flavor, RepType_, ConcreteInterval_> const& y)
|
202
|
+
{
|
203
|
+
// assert that only bare intervals or decorated intervals are used
|
204
|
+
static_assert( (std::is_same<typename Flavor<T>::representation, RepType>::value
|
205
|
+
&& std::is_same<typename Flavor<T_>::representation, RepType_>::value)
|
206
|
+
|| (std::is_same<typename Flavor<T>::representation_dec, RepType>::value
|
207
|
+
&& std::is_same<typename Flavor<T_>::representation_dec, RepType_>::value),
|
208
|
+
"It is not supported by mixed type operations to use "
|
209
|
+
"interval and decorated_interval types together!"
|
210
|
+
);
|
211
|
+
|
212
|
+
return Flavor<T_>::less(y.rep_, x.rep_);
|
213
|
+
}
|
214
|
+
|
215
|
+
// function
|
216
|
+
template<typename T1, template<typename> class Flavor, typename RepType1, class ConcreteInterval1, typename T2, typename RepType2, class ConcreteInterval2>
|
217
|
+
bool greater(base_interval<T1, Flavor, RepType1, ConcreteInterval1> const& x, base_interval<T2, Flavor, RepType2, ConcreteInterval2> const& y)
|
218
|
+
{
|
219
|
+
return base_interval<T1, Flavor, RepType1, ConcreteInterval1>::greater(x, y);
|
220
|
+
}
|
221
|
+
|
222
|
+
|
223
|
+
// precedes
|
224
|
+
|
225
|
+
// static
|
226
|
+
template<typename T, template<typename> class Flavor, typename RepType, class ConcreteInterval>
|
227
|
+
template<typename T_, typename RepType_, class ConcreteInterval_>
|
228
|
+
bool base_interval<T, Flavor, RepType, ConcreteInterval>::precedes(base_interval<T, Flavor, RepType, ConcreteInterval> const& x,
|
229
|
+
base_interval<T_, Flavor, RepType_, ConcreteInterval_> const& y)
|
230
|
+
{
|
231
|
+
// assert that only bare intervals or decorated intervals are used
|
232
|
+
static_assert( (std::is_same<typename Flavor<T>::representation, RepType>::value
|
233
|
+
&& std::is_same<typename Flavor<T_>::representation, RepType_>::value)
|
234
|
+
|| (std::is_same<typename Flavor<T>::representation_dec, RepType>::value
|
235
|
+
&& std::is_same<typename Flavor<T_>::representation_dec, RepType_>::value),
|
236
|
+
"It is not supported by mixed type operations to use "
|
237
|
+
"interval and decorated_interval types together!"
|
238
|
+
);
|
239
|
+
|
240
|
+
return Flavor<T>::precedes(x.rep_, y.rep_);
|
241
|
+
}
|
242
|
+
|
243
|
+
// function
|
244
|
+
template<typename T1, template<typename> class Flavor, typename RepType1, class ConcreteInterval1, typename T2, typename RepType2, class ConcreteInterval2>
|
245
|
+
bool precedes(base_interval<T1, Flavor, RepType1, ConcreteInterval1> const& x, base_interval<T2, Flavor, RepType2, ConcreteInterval2> const& y)
|
246
|
+
{
|
247
|
+
return base_interval<T1, Flavor, RepType1, ConcreteInterval1>::precedes(x, y);
|
248
|
+
}
|
249
|
+
|
250
|
+
|
251
|
+
// succeeds
|
252
|
+
|
253
|
+
// static
|
254
|
+
template<typename T, template<typename> class Flavor, typename RepType, class ConcreteInterval>
|
255
|
+
template<typename T_, typename RepType_, class ConcreteInterval_>
|
256
|
+
bool base_interval<T, Flavor, RepType, ConcreteInterval>::succeeds(base_interval<T, Flavor, RepType, ConcreteInterval> const& x,
|
257
|
+
base_interval<T_, Flavor, RepType_, ConcreteInterval_> const& y)
|
258
|
+
{
|
259
|
+
// assert that only bare intervals or decorated intervals are used
|
260
|
+
static_assert( (std::is_same<typename Flavor<T>::representation, RepType>::value
|
261
|
+
&& std::is_same<typename Flavor<T_>::representation, RepType_>::value)
|
262
|
+
|| (std::is_same<typename Flavor<T>::representation_dec, RepType>::value
|
263
|
+
&& std::is_same<typename Flavor<T_>::representation_dec, RepType_>::value),
|
264
|
+
"It is not supported by mixed type operations to use "
|
265
|
+
"interval and decorated_interval types together!"
|
266
|
+
);
|
267
|
+
|
268
|
+
return Flavor<T_>::precedes(y.rep_, x.rep_);
|
269
|
+
}
|
270
|
+
|
271
|
+
// function
|
272
|
+
template<typename T1, template<typename> class Flavor, typename RepType1, class ConcreteInterval1, typename T2, typename RepType2, class ConcreteInterval2>
|
273
|
+
bool succeeds(base_interval<T1, Flavor, RepType1, ConcreteInterval1> const& x, base_interval<T2, Flavor, RepType2, ConcreteInterval2> const& y)
|
274
|
+
{
|
275
|
+
return base_interval<T1, Flavor, RepType1, ConcreteInterval1>::succeeds(x, y);
|
276
|
+
}
|
277
|
+
|
278
|
+
|
279
|
+
// interior
|
280
|
+
|
281
|
+
// static
|
282
|
+
template<typename T, template<typename> class Flavor, typename RepType, class ConcreteInterval>
|
283
|
+
template<typename T_, typename RepType_, class ConcreteInterval_>
|
284
|
+
bool base_interval<T, Flavor, RepType, ConcreteInterval>::interior(base_interval<T, Flavor, RepType, ConcreteInterval> const& x,
|
285
|
+
base_interval<T_, Flavor, RepType_, ConcreteInterval_> const& y)
|
286
|
+
{
|
287
|
+
// assert that only bare intervals or decorated intervals are used
|
288
|
+
static_assert( (std::is_same<typename Flavor<T>::representation, RepType>::value
|
289
|
+
&& std::is_same<typename Flavor<T_>::representation, RepType_>::value)
|
290
|
+
|| (std::is_same<typename Flavor<T>::representation_dec, RepType>::value
|
291
|
+
&& std::is_same<typename Flavor<T_>::representation_dec, RepType_>::value),
|
292
|
+
"It is not supported by mixed type operations to use "
|
293
|
+
"interval and decorated_interval types together!"
|
294
|
+
);
|
295
|
+
|
296
|
+
return Flavor<T>::interior(x.rep_, y.rep_);
|
297
|
+
}
|
298
|
+
|
299
|
+
// function
|
300
|
+
template<typename T1, template<typename> class Flavor, typename RepType1, class ConcreteInterval1, typename T2, typename RepType2, class ConcreteInterval2>
|
301
|
+
bool interior(base_interval<T1, Flavor, RepType1, ConcreteInterval1> const& x, base_interval<T2, Flavor, RepType2, ConcreteInterval2> const& y)
|
302
|
+
{
|
303
|
+
return base_interval<T1, Flavor, RepType1, ConcreteInterval1>::interior(x, y);
|
304
|
+
}
|
305
|
+
|
306
|
+
|
307
|
+
// contains_interior
|
308
|
+
|
309
|
+
// static
|
310
|
+
template<typename T, template<typename> class Flavor, typename RepType, class ConcreteInterval>
|
311
|
+
template<typename T_, typename RepType_, class ConcreteInterval_>
|
312
|
+
bool base_interval<T, Flavor, RepType, ConcreteInterval>::contains_interior(base_interval<T, Flavor, RepType, ConcreteInterval> const& x,
|
313
|
+
base_interval<T_, Flavor, RepType_, ConcreteInterval_> const& y)
|
314
|
+
{
|
315
|
+
// assert that only bare intervals or decorated intervals are used
|
316
|
+
static_assert( (std::is_same<typename Flavor<T>::representation, RepType>::value
|
317
|
+
&& std::is_same<typename Flavor<T_>::representation, RepType_>::value)
|
318
|
+
|| (std::is_same<typename Flavor<T>::representation_dec, RepType>::value
|
319
|
+
&& std::is_same<typename Flavor<T_>::representation_dec, RepType_>::value),
|
320
|
+
"It is not supported by mixed type operations to use "
|
321
|
+
"interval and decorated_interval types together!"
|
322
|
+
);
|
323
|
+
|
324
|
+
return Flavor<T_>::interior(y.rep_, x.rep_);
|
325
|
+
}
|
326
|
+
|
327
|
+
// function
|
328
|
+
template<typename T1, template<typename> class Flavor, typename RepType1, class ConcreteInterval1, typename T2, typename RepType2, class ConcreteInterval2>
|
329
|
+
bool contains_interior(base_interval<T1, Flavor, RepType1, ConcreteInterval1> const& x, base_interval<T2, Flavor, RepType2, ConcreteInterval2> const& y)
|
330
|
+
{
|
331
|
+
return base_interval<T1, Flavor, RepType1, ConcreteInterval1>::contains_interior(x, y);
|
332
|
+
}
|
333
|
+
|
334
|
+
|
335
|
+
// strictly_less
|
336
|
+
|
337
|
+
// static
|
338
|
+
template<typename T, template<typename> class Flavor, typename RepType, class ConcreteInterval>
|
339
|
+
template<typename T_, typename RepType_, class ConcreteInterval_>
|
340
|
+
bool base_interval<T, Flavor, RepType, ConcreteInterval>::strictly_less(base_interval<T, Flavor, RepType, ConcreteInterval> const& x,
|
341
|
+
base_interval<T_, Flavor, RepType_, ConcreteInterval_> const& y)
|
342
|
+
{
|
343
|
+
// assert that only bare intervals or decorated intervals are used
|
344
|
+
static_assert( (std::is_same<typename Flavor<T>::representation, RepType>::value
|
345
|
+
&& std::is_same<typename Flavor<T_>::representation, RepType_>::value)
|
346
|
+
|| (std::is_same<typename Flavor<T>::representation_dec, RepType>::value
|
347
|
+
&& std::is_same<typename Flavor<T_>::representation_dec, RepType_>::value),
|
348
|
+
"It is not supported by mixed type operations to use "
|
349
|
+
"interval and decorated_interval types together!"
|
350
|
+
);
|
351
|
+
|
352
|
+
return Flavor<T>::strictly_less(x.rep_, y.rep_);
|
353
|
+
}
|
354
|
+
|
355
|
+
// function
|
356
|
+
template<typename T1, template<typename> class Flavor, typename RepType1, class ConcreteInterval1, typename T2, typename RepType2, class ConcreteInterval2>
|
357
|
+
bool strictly_less(base_interval<T1, Flavor, RepType1, ConcreteInterval1> const& x, base_interval<T2, Flavor, RepType2, ConcreteInterval2> const& y)
|
358
|
+
{
|
359
|
+
return base_interval<T1, Flavor, RepType1, ConcreteInterval1>::strictly_less(x, y);
|
360
|
+
}
|
361
|
+
|
362
|
+
|
363
|
+
// strictly_greater
|
364
|
+
|
365
|
+
// static
|
366
|
+
template<typename T, template<typename> class Flavor, typename RepType, class ConcreteInterval>
|
367
|
+
template<typename T_, typename RepType_, class ConcreteInterval_>
|
368
|
+
bool base_interval<T, Flavor, RepType, ConcreteInterval>::strictly_greater(base_interval<T, Flavor, RepType, ConcreteInterval> const& x,
|
369
|
+
base_interval<T_, Flavor, RepType_, ConcreteInterval_> const& y)
|
370
|
+
{
|
371
|
+
// assert that only bare intervals or decorated intervals are used
|
372
|
+
static_assert( (std::is_same<typename Flavor<T>::representation, RepType>::value
|
373
|
+
&& std::is_same<typename Flavor<T_>::representation, RepType_>::value)
|
374
|
+
|| (std::is_same<typename Flavor<T>::representation_dec, RepType>::value
|
375
|
+
&& std::is_same<typename Flavor<T_>::representation_dec, RepType_>::value),
|
376
|
+
"It is not supported by mixed type operations to use "
|
377
|
+
"interval and decorated_interval types together!"
|
378
|
+
);
|
379
|
+
|
380
|
+
return Flavor<T_>::strictly_less(y.rep_, x.rep_);
|
381
|
+
}
|
382
|
+
|
383
|
+
// function
|
384
|
+
template<typename T1, template<typename> class Flavor, typename RepType1, class ConcreteInterval1, typename T2, typename RepType2, class ConcreteInterval2>
|
385
|
+
bool strictly_greater(base_interval<T1, Flavor, RepType1, ConcreteInterval1> const& x, base_interval<T2, Flavor, RepType2, ConcreteInterval2> const& y)
|
386
|
+
{
|
387
|
+
return base_interval<T1, Flavor, RepType1, ConcreteInterval1>::strictly_greater(x, y);
|
388
|
+
}
|
389
|
+
|
390
|
+
|
391
|
+
// strictly_precedes
|
392
|
+
|
393
|
+
// static
|
394
|
+
template<typename T, template<typename> class Flavor, typename RepType, class ConcreteInterval>
|
395
|
+
template<typename T_, typename RepType_, class ConcreteInterval_>
|
396
|
+
bool base_interval<T, Flavor, RepType, ConcreteInterval>::strictly_precedes(base_interval<T, Flavor, RepType, ConcreteInterval> const& x,
|
397
|
+
base_interval<T_, Flavor, RepType_, ConcreteInterval_> const& y)
|
398
|
+
{
|
399
|
+
// assert that only bare intervals or decorated intervals are used
|
400
|
+
static_assert( (std::is_same<typename Flavor<T>::representation, RepType>::value
|
401
|
+
&& std::is_same<typename Flavor<T_>::representation, RepType_>::value)
|
402
|
+
|| (std::is_same<typename Flavor<T>::representation_dec, RepType>::value
|
403
|
+
&& std::is_same<typename Flavor<T_>::representation_dec, RepType_>::value),
|
404
|
+
"It is not supported by mixed type operations to use "
|
405
|
+
"interval and decorated_interval types together!"
|
406
|
+
);
|
407
|
+
|
408
|
+
return Flavor<T>::strictly_precedes(x.rep_, y.rep_);
|
409
|
+
}
|
410
|
+
|
411
|
+
// function
|
412
|
+
template<typename T1, template<typename> class Flavor, typename RepType1, class ConcreteInterval1, typename T2, typename RepType2, class ConcreteInterval2>
|
413
|
+
bool strictly_precedes(base_interval<T1, Flavor, RepType1, ConcreteInterval1> const& x, base_interval<T2, Flavor, RepType2, ConcreteInterval2> const& y)
|
414
|
+
{
|
415
|
+
return base_interval<T1, Flavor, RepType1, ConcreteInterval1>::strictly_precedes(x, y);
|
416
|
+
}
|
417
|
+
|
418
|
+
|
419
|
+
// strictly_succeeds
|
420
|
+
|
421
|
+
// static
|
422
|
+
template<typename T, template<typename> class Flavor, typename RepType, class ConcreteInterval>
|
423
|
+
template<typename T_, typename RepType_, class ConcreteInterval_>
|
424
|
+
bool base_interval<T, Flavor, RepType, ConcreteInterval>::strictly_succeeds(base_interval<T, Flavor, RepType, ConcreteInterval> const& x,
|
425
|
+
base_interval<T_, Flavor, RepType_, ConcreteInterval_> const& y)
|
426
|
+
{
|
427
|
+
// assert that only bare intervals or decorated intervals are used
|
428
|
+
static_assert( (std::is_same<typename Flavor<T>::representation, RepType>::value
|
429
|
+
&& std::is_same<typename Flavor<T_>::representation, RepType_>::value)
|
430
|
+
|| (std::is_same<typename Flavor<T>::representation_dec, RepType>::value
|
431
|
+
&& std::is_same<typename Flavor<T_>::representation_dec, RepType_>::value),
|
432
|
+
"It is not supported by mixed type operations to use "
|
433
|
+
"interval and decorated_interval types together!"
|
434
|
+
);
|
435
|
+
|
436
|
+
return Flavor<T_>::strictly_precedes(y.rep_, x.rep_);
|
437
|
+
}
|
438
|
+
|
439
|
+
// function
|
440
|
+
template<typename T1, template<typename> class Flavor, typename RepType1, class ConcreteInterval1, typename T2, typename RepType2, class ConcreteInterval2>
|
441
|
+
bool strictly_succeeds(base_interval<T1, Flavor, RepType1, ConcreteInterval1> const& x, base_interval<T2, Flavor, RepType2, ConcreteInterval2> const& y)
|
442
|
+
{
|
443
|
+
return base_interval<T1, Flavor, RepType1, ConcreteInterval1>::strictly_succeeds(x, y);
|
444
|
+
}
|
445
|
+
|
446
|
+
|
447
|
+
// disjoint
|
448
|
+
|
449
|
+
// static
|
450
|
+
template<typename T, template<typename> class Flavor, typename RepType, class ConcreteInterval>
|
451
|
+
template<typename T_, typename RepType_, class ConcreteInterval_>
|
452
|
+
bool base_interval<T, Flavor, RepType, ConcreteInterval>::disjoint(base_interval<T, Flavor, RepType, ConcreteInterval> const& x,
|
453
|
+
base_interval<T_, Flavor, RepType_, ConcreteInterval_> const& y)
|
454
|
+
{
|
455
|
+
// assert that only bare intervals or decorated intervals are used
|
456
|
+
static_assert( (std::is_same<typename Flavor<T>::representation, RepType>::value
|
457
|
+
&& std::is_same<typename Flavor<T_>::representation, RepType_>::value)
|
458
|
+
|| (std::is_same<typename Flavor<T>::representation_dec, RepType>::value
|
459
|
+
&& std::is_same<typename Flavor<T_>::representation_dec, RepType_>::value),
|
460
|
+
"It is not supported by mixed type operations to use "
|
461
|
+
"interval and decorated_interval types together!"
|
462
|
+
);
|
463
|
+
|
464
|
+
return Flavor<T>::disjoint(x.rep_, y.rep_);
|
465
|
+
}
|
466
|
+
|
467
|
+
// function
|
468
|
+
template<typename T1, template<typename> class Flavor, typename RepType1, class ConcreteInterval1, typename T2, typename RepType2, class ConcreteInterval2>
|
469
|
+
bool disjoint(base_interval<T1, Flavor, RepType1, ConcreteInterval1> const& x, base_interval<T2, Flavor, RepType2, ConcreteInterval2> const& y)
|
470
|
+
{
|
471
|
+
return base_interval<T1, Flavor, RepType1, ConcreteInterval1>::disjoint(x, y);
|
472
|
+
}
|
473
|
+
|
474
|
+
|
475
|
+
|
476
|
+
} // namespace infsup
|
477
|
+
|
478
|
+
} // namespace p1788
|
479
|
+
|
480
|
+
|
481
|
+
#endif // LIBIEEEP1788_P1788_INFSUP_BASE_INTERVAL_BOOL_FUNC_IMPL_HPP
|
@@ -0,0 +1,126 @@
|
|
1
|
+
//
|
2
|
+
// libieeep1788
|
3
|
+
//
|
4
|
+
// An implementation of the preliminary IEEE P1788 standard for
|
5
|
+
// interval arithmetic
|
6
|
+
//
|
7
|
+
//
|
8
|
+
// Copyright 2013 - 2015
|
9
|
+
//
|
10
|
+
// Marco Nehmeier (nehmeier@informatik.uni-wuerzburg.de)
|
11
|
+
// Department of Computer Science,
|
12
|
+
// University of Wuerzburg, Germany
|
13
|
+
//
|
14
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
15
|
+
// you may not use this file except in compliance with the License.
|
16
|
+
// You may obtain a copy of the License at
|
17
|
+
//
|
18
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
19
|
+
//
|
20
|
+
// Unless required by applicable law or agreed to in writing, software
|
21
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
22
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
23
|
+
// See the License for the specific language governing permissions and
|
24
|
+
// limitations under the License.
|
25
|
+
|
26
|
+
#ifndef LIBIEEEP1788_P1788_INFSUP_BASE_INTERVAL_CANCEL_FUNC_IMPL_HPP
|
27
|
+
#define LIBIEEEP1788_P1788_INFSUP_BASE_INTERVAL_CANCEL_FUNC_IMPL_HPP
|
28
|
+
|
29
|
+
namespace p1788
|
30
|
+
{
|
31
|
+
|
32
|
+
namespace infsup
|
33
|
+
{
|
34
|
+
|
35
|
+
|
36
|
+
// cancel_plus
|
37
|
+
|
38
|
+
// static
|
39
|
+
template<typename T, template<typename> class Flavor, typename RepType, class ConcreteInterval>
|
40
|
+
ConcreteInterval base_interval<T,Flavor,RepType,ConcreteInterval>::cancel_plus(base_interval<T, Flavor, RepType, ConcreteInterval> const& x,
|
41
|
+
base_interval<T, Flavor, RepType, ConcreteInterval> const& y)
|
42
|
+
{
|
43
|
+
return concrete_interval( Flavor<T>::cancel_plus(x.rep_, y.rep_) );
|
44
|
+
}
|
45
|
+
|
46
|
+
// static mixed type
|
47
|
+
template<typename T, template<typename> class Flavor, typename RepType, class ConcreteInterval>
|
48
|
+
template<typename T1, typename RepType1, class ConcreteInterval1, typename T2, typename RepType2, class ConcreteInterval2>
|
49
|
+
ConcreteInterval base_interval<T,Flavor,RepType,ConcreteInterval>::cancel_plus(base_interval<T1, Flavor, RepType1, ConcreteInterval1> const& x,
|
50
|
+
base_interval<T2, Flavor, RepType2, ConcreteInterval2> const& y)
|
51
|
+
{
|
52
|
+
// assert that only bare intervals or decorated intervals are used
|
53
|
+
static_assert( (std::is_same<typename Flavor<T>::representation, RepType>::value
|
54
|
+
&& std::is_same<typename Flavor<T1>::representation, RepType1>::value
|
55
|
+
&& std::is_same<typename Flavor<T2>::representation, RepType2>::value)
|
56
|
+
|| (std::is_same<typename Flavor<T>::representation_dec, RepType>::value
|
57
|
+
&& std::is_same<typename Flavor<T1>::representation_dec, RepType1>::value
|
58
|
+
&& std::is_same<typename Flavor<T2>::representation_dec, RepType2>::value),
|
59
|
+
"It is not supported by mixed type operations to use "
|
60
|
+
"interval and decorated_interval types together!"
|
61
|
+
);
|
62
|
+
|
63
|
+
// call of mixed-type version
|
64
|
+
return concrete_interval( Flavor<T>::cancel_plus(x.rep_, y.rep_) );
|
65
|
+
}
|
66
|
+
|
67
|
+
// function
|
68
|
+
template<typename T, template<typename> class Flavor, typename RepType, class ConcreteInterval>
|
69
|
+
ConcreteInterval cancel_plus(base_interval<T, Flavor, RepType, ConcreteInterval> const& x,
|
70
|
+
base_interval<T, Flavor, RepType, ConcreteInterval> const& y)
|
71
|
+
{
|
72
|
+
return base_interval<T,Flavor,RepType,ConcreteInterval>::cancel_plus(x, y);
|
73
|
+
}
|
74
|
+
|
75
|
+
|
76
|
+
// cancel_minus
|
77
|
+
|
78
|
+
// static
|
79
|
+
template<typename T, template<typename> class Flavor, typename RepType, class ConcreteInterval>
|
80
|
+
ConcreteInterval base_interval<T,Flavor,RepType,ConcreteInterval>::cancel_minus(base_interval<T, Flavor, RepType, ConcreteInterval> const& x,
|
81
|
+
base_interval<T, Flavor, RepType, ConcreteInterval> const& y)
|
82
|
+
{
|
83
|
+
return concrete_interval( Flavor<T>::cancel_minus(x.rep_, y.rep_) );
|
84
|
+
}
|
85
|
+
|
86
|
+
// static mixed type
|
87
|
+
template<typename T, template<typename> class Flavor, typename RepType, class ConcreteInterval>
|
88
|
+
template<typename T1, typename RepType1, class ConcreteInterval1, typename T2, typename RepType2, class ConcreteInterval2>
|
89
|
+
ConcreteInterval base_interval<T,Flavor,RepType,ConcreteInterval>::cancel_minus(base_interval<T1, Flavor, RepType1, ConcreteInterval1> const& x,
|
90
|
+
base_interval<T2, Flavor, RepType2, ConcreteInterval2> const& y)
|
91
|
+
{
|
92
|
+
// assert that only bare intervals or decorated intervals are used
|
93
|
+
static_assert( (std::is_same<typename Flavor<T>::representation, RepType>::value
|
94
|
+
&& std::is_same<typename Flavor<T1>::representation, RepType1>::value
|
95
|
+
&& std::is_same<typename Flavor<T2>::representation, RepType2>::value)
|
96
|
+
|| (std::is_same<typename Flavor<T>::representation_dec, RepType>::value
|
97
|
+
&& std::is_same<typename Flavor<T1>::representation_dec, RepType1>::value
|
98
|
+
&& std::is_same<typename Flavor<T2>::representation_dec, RepType2>::value),
|
99
|
+
"It is not supported by mixed type operations to use "
|
100
|
+
"interval and decorated_interval types together!"
|
101
|
+
);
|
102
|
+
|
103
|
+
// call of mixed-type version
|
104
|
+
return concrete_interval( Flavor<T>::cancel_minus(x.rep_, y.rep_) );
|
105
|
+
}
|
106
|
+
|
107
|
+
// function
|
108
|
+
template<typename T, template<typename> class Flavor, typename RepType, class ConcreteInterval>
|
109
|
+
ConcreteInterval cancel_minus(base_interval<T, Flavor, RepType, ConcreteInterval> const& x,
|
110
|
+
base_interval<T, Flavor, RepType, ConcreteInterval> const& y)
|
111
|
+
{
|
112
|
+
return base_interval<T,Flavor,RepType,ConcreteInterval>::cancel_minus(x, y);
|
113
|
+
}
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
} // namespace infsup
|
121
|
+
|
122
|
+
} // namespace p1788
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
#endif // LIBIEEEP1788_P1788_INFSUP_BASE_INTERVAL_CANCEL_FUNC_IMPL_HPP
|