1 #ifndef SYMENGINE_SET_FUNCS_H
2 #define SYMENGINE_SET_FUNCS_H
13 RCP<const Basic> sup_;
18 void bvisit(
const Basic &x){};
20 void bvisit(
const Set &x)
22 throw SymEngineException(
23 "Set not partially ordered: supremum undefined");
26 void bvisit(
const Reals &x)
58 const set_basic &container = x.get_container();
63 void bvisit(
const Union &x)
66 for (
auto &a : x.get_container()) {
75 throw NotImplementedError(
"sup for Complement not implemented");
80 throw NotImplementedError(
"sup for ImageSet not implemented");
83 RCP<const Basic> apply(
const Set &s)
93 RCP<const Basic> inf_;
98 void bvisit(
const Basic &x){};
100 void bvisit(
const Set &x)
102 throw SymEngineException(
103 "Set not partially ordered: infimum undefined");
106 void bvisit(
const Reals &x)
133 inf_ = x.get_start();
138 const set_basic &container = x.get_container();
143 void bvisit(
const Union &x)
146 for (
auto &a : x.get_container()) {
155 throw NotImplementedError(
"inf for Complement not implemented");
160 throw NotImplementedError(
"inf for ImageSet not implemented");
163 RCP<const Basic> apply(
const Set &s)
170 RCP<const Basic> sup(
const Set &s)
173 return visitor.apply(s);
176 RCP<const Basic> inf(
const Set &s)
179 return visitor.apply(s);
185 RCP<const Set> boundary_;
190 void bvisit(
const Basic &x){};
207 void bvisit(
const Reals &x)
234 boundary_ =
finiteset({x.get_start(), x.get_end()});
242 void bvisit(
const Union &x)
245 const set_set &sets = x.get_container();
246 for (
auto it = sets.
begin(); it != sets.
end(); ++it) {
248 for (
auto interit = sets.
begin(); interit != sets.
end();
251 interior_sets.
insert(interior(**interit));
255 set_complement(apply(**it), set_union(interior_sets)));
257 boundary_ = set_union(boundary_sets);
262 throw NotImplementedError(
"inf for Complement not implemented");
267 throw NotImplementedError(
"inf for ImageSet not implemented");
270 RCP<const Set> apply(
const Set &s)
277 RCP<const Set> boundary(
const Set &s)
280 return visitor.apply(s);
283 RCP<const Set> interior(
const Set &s)
285 return set_complement(rcp_static_cast<const Set>(s.rcp_from_this()),
289 RCP<const Set> closure(
const Set &s)
291 return s.set_union(boundary(s));
The lowest unit of symbolic representation.
RCP< T > rcp_from_this()
Get RCP<T> pointer to self (it will cast the pointer to T)
Main namespace for SymEngine package.
std::enable_if< std::is_integral< T >::value, RCP< const Integer > >::type integer(T i)
RCP< const Reals > reals()
RCP< const Basic > max(const vec_basic &arg)
Canonicalize Max:
RCP< const Naturals > naturals()
RCP< const EmptySet > emptyset()
RCP< const Integers > integers()
RCP< const Set > finiteset(const set_basic &container)
RCP< const Basic > min(const vec_basic &arg)
Canonicalize Min:
RCP< const Naturals0 > naturals0()