sets.h
Go to the documentation of this file.
1 
5 #ifndef SYMENGINE_SETS_H
6 #define SYMENGINE_SETS_H
7 
8 #include <symengine/functions.h>
9 #include <symengine/complex.h>
10 #include <symengine/symengine_casts.h>
11 #include <iterator>
12 namespace SymEngine
13 {
14 class Set;
15 class BooleanAtom;
16 class Boolean;
17 inline bool is_a_Boolean(const Basic &b);
18 RCP<const BooleanAtom> boolean(bool b);
19 } // namespace SymEngine
20 #include <symengine/logic.h>
21 
22 namespace SymEngine
23 {
24 typedef std::set<RCP<const Set>, RCPBasicKeyLess> set_set;
25 class Set : public Basic
26 {
27 public:
28  vec_basic get_args() const override = 0;
29  virtual RCP<const Set> set_intersection(const RCP<const Set> &o) const = 0;
30  virtual RCP<const Set> set_union(const RCP<const Set> &o) const = 0;
31  virtual RCP<const Set> set_complement(const RCP<const Set> &o) const = 0;
32  virtual RCP<const Boolean> contains(const RCP<const Basic> &a) const = 0;
33  bool is_subset(const RCP<const Set> &o) const
34  {
35  return eq(*this->set_intersection(o), *this);
36  }
37  bool is_proper_subset(const RCP<const Set> &o) const
38  {
39  return not eq(*this, *o) and this->is_subset(o);
40  }
41  bool is_superset(const RCP<const Set> &o) const
42  {
43  return o->is_subset(rcp_from_this_cast<const Set>());
44  }
45  bool is_proper_superset(const RCP<const Set> &o) const
46  {
47  return not eq(*this, *o) and this->is_superset(o);
48  }
49 };
50 
51 class EmptySet : public Set
52 {
53 public:
54  EmptySet(){SYMENGINE_ASSIGN_TYPEID()}
55 
56  IMPLEMENT_TYPEID(SYMENGINE_EMPTYSET)
57  // EmptySet(EmptySet const&) = delete;
58  void
59  operator=(EmptySet const &)
60  = delete;
61  const static RCP<const EmptySet> &getInstance();
62  hash_t __hash__() const override;
63  bool __eq__(const Basic &o) const override;
64  int compare(const Basic &o) const override;
65  vec_basic get_args() const override
66  {
67  return {};
68  }
69 
70  template <typename T_, typename... Args>
71  friend inline RCP<T_> make_rcp(Args &&...args);
72 
73  RCP<const Set> set_intersection(const RCP<const Set> &o) const override;
74  RCP<const Set> set_union(const RCP<const Set> &o) const override;
75  RCP<const Set> set_complement(const RCP<const Set> &o) const override;
76  RCP<const Boolean> contains(const RCP<const Basic> &a) const override
77  {
78  return boolean(false);
79  };
80 };
81 
82 class UniversalSet : public Set
83 {
84 public:
85  UniversalSet()
86  {
87  SYMENGINE_ASSIGN_TYPEID()
88  }
89 
90 public:
91  IMPLEMENT_TYPEID(SYMENGINE_UNIVERSALSET)
92  // UniversalSet(UniversalSet const&) = delete;
93  void operator=(UniversalSet const &) = delete;
94  const static RCP<const UniversalSet> &getInstance();
95  hash_t __hash__() const override;
96  bool __eq__(const Basic &o) const override;
97  int compare(const Basic &o) const override;
98  vec_basic get_args() const override
99  {
100  return {};
101  }
102 
103  template <typename T_, typename... Args>
104  friend inline RCP<T_> make_rcp(Args &&...args);
105 
106  RCP<const Set> set_intersection(const RCP<const Set> &o) const override;
107  RCP<const Set> set_union(const RCP<const Set> &o) const override;
108  RCP<const Set> set_complement(const RCP<const Set> &o) const override;
109  RCP<const Boolean> contains(const RCP<const Basic> &a) const override
110  {
111  return boolean(true);
112  };
113 };
114 
115 class FiniteSet : public Set
116 {
117 private:
118  set_basic container_;
119 
120 public:
121  IMPLEMENT_TYPEID(SYMENGINE_FINITESET)
122  hash_t __hash__() const override;
123  bool __eq__(const Basic &o) const override;
124  int compare(const Basic &o) const override;
125  vec_basic get_args() const override
126  {
127  return vec_basic(container_.begin(), container_.end());
128  }
129 
130  FiniteSet(const set_basic &container);
131  static bool is_canonical(const set_basic &container);
132 
133  RCP<const Set> set_union(const RCP<const Set> &o) const override;
134  RCP<const Set> set_intersection(const RCP<const Set> &o) const override;
135  RCP<const Set> set_complement(const RCP<const Set> &o) const override;
136  RCP<const Boolean> contains(const RCP<const Basic> &a) const override;
137  RCP<const Set> create(const set_basic &container) const;
138 
139  inline const set_basic &get_container() const
140  {
141  return this->container_;
142  }
143 };
144 
145 class Interval : public Set
146 {
147 private:
148  RCP<const Number> start_;
149  RCP<const Number> end_;
150  bool left_open_, right_open_;
151 
152 public:
153  IMPLEMENT_TYPEID(SYMENGINE_INTERVAL)
154  hash_t __hash__() const override;
155  bool __eq__(const Basic &o) const override;
156  int compare(const Basic &o) const override;
157 
158  Interval(const RCP<const Number> &start, const RCP<const Number> &end,
159  const bool left_open = false, const bool right_open = false);
160 
161  RCP<const Set> open() const;
162  RCP<const Set> close() const;
163  RCP<const Set> Lopen() const;
164  RCP<const Set> Ropen() const;
165 
166  static bool is_canonical(const RCP<const Number> &start,
167  const RCP<const Number> &end, bool left_open,
168  bool right_open);
169 
170  RCP<const Set> set_union(const RCP<const Set> &o) const override;
171  RCP<const Set> set_intersection(const RCP<const Set> &o) const override;
172  RCP<const Set> set_complement(const RCP<const Set> &o) const override;
173  RCP<const Boolean> contains(const RCP<const Basic> &a) const override;
174  vec_basic get_args() const override;
175 
176  inline const RCP<const Number> &get_start() const
177  {
178  return start_;
179  }
180  inline const RCP<const Number> &get_end() const
181  {
182  return end_;
183  }
184  inline const bool &get_left_open() const
185  {
186  return this->left_open_;
187  }
188  inline const bool &get_right_open() const
189  {
190  return this->right_open_;
191  }
192 };
193 
194 class Complexes : public Set
195 {
196 public:
197  Complexes()
198  {
199  SYMENGINE_ASSIGN_TYPEID()
200  }
201 
202 public:
203  IMPLEMENT_TYPEID(SYMENGINE_COMPLEXES)
204  void operator=(Complexes const &) = delete;
205  const static RCP<const Complexes> &getInstance();
206  hash_t __hash__() const override;
207  bool __eq__(const Basic &o) const override;
208  int compare(const Basic &o) const override;
209  vec_basic get_args() const override
210  {
211  return {};
212  }
213 
214  template <typename T_, typename... Args>
215  friend inline RCP<T_> make_rcp(Args &&...args);
216 
217  RCP<const Set> set_intersection(const RCP<const Set> &o) const override;
218  RCP<const Set> set_union(const RCP<const Set> &o) const override;
219  RCP<const Set> set_complement(const RCP<const Set> &o) const override;
220  RCP<const Boolean> contains(const RCP<const Basic> &a) const override;
221 };
222 
223 class Reals : public Set
224 {
225 public:
226  Reals()
227  {
228  SYMENGINE_ASSIGN_TYPEID()
229  }
230 
231 public:
232  IMPLEMENT_TYPEID(SYMENGINE_REALS)
233  void operator=(Reals const &) = delete;
234  const static RCP<const Reals> &getInstance();
235  hash_t __hash__() const override;
236  bool __eq__(const Basic &o) const override;
237  int compare(const Basic &o) const override;
238  vec_basic get_args() const override
239  {
240  return {};
241  }
242 
243  template <typename T_, typename... Args>
244  friend inline RCP<T_> make_rcp(Args &&...args);
245 
246  RCP<const Set> set_intersection(const RCP<const Set> &o) const override;
247  RCP<const Set> set_union(const RCP<const Set> &o) const override;
248  RCP<const Set> set_complement(const RCP<const Set> &o) const override;
249  RCP<const Boolean> contains(const RCP<const Basic> &a) const override;
250 };
251 
252 class Rationals : public Set
253 {
254 public:
255  Rationals()
256  {
257  SYMENGINE_ASSIGN_TYPEID()
258  }
259 
260 public:
261  IMPLEMENT_TYPEID(SYMENGINE_RATIONALS)
262  void operator=(Rationals const &) = delete;
263  const static RCP<const Rationals> &getInstance();
264  hash_t __hash__() const override;
265  bool __eq__(const Basic &o) const override;
266  int compare(const Basic &o) const override;
267  vec_basic get_args() const override
268  {
269  return {};
270  }
271 
272  template <typename T_, typename... Args>
273  friend inline RCP<T_> make_rcp(Args &&...args);
274 
275  RCP<const Set> set_intersection(const RCP<const Set> &o) const override;
276  RCP<const Set> set_union(const RCP<const Set> &o) const override;
277  RCP<const Set> set_complement(const RCP<const Set> &o) const override;
278  RCP<const Boolean> contains(const RCP<const Basic> &a) const override;
279 };
280 
281 class Integers : public Set
282 {
283 public:
284  Integers()
285  {
286  SYMENGINE_ASSIGN_TYPEID()
287  }
288 
289 public:
290  IMPLEMENT_TYPEID(SYMENGINE_INTEGERS)
291  void operator=(Integers const &) = delete;
292  const static RCP<const Integers> &getInstance();
293  hash_t __hash__() const override;
294  bool __eq__(const Basic &o) const override;
295  int compare(const Basic &o) const override;
296  vec_basic get_args() const override
297  {
298  return {};
299  }
300 
301  template <typename T_, typename... Args>
302  friend inline RCP<T_> make_rcp(Args &&...args);
303 
304  RCP<const Set> set_intersection(const RCP<const Set> &o) const override;
305  RCP<const Set> set_union(const RCP<const Set> &o) const override;
306  RCP<const Set> set_complement(const RCP<const Set> &o) const override;
307  RCP<const Boolean> contains(const RCP<const Basic> &a) const override;
308 };
309 
310 class Naturals : public Set
311 {
312 public:
313  Naturals()
314  {
315  SYMENGINE_ASSIGN_TYPEID()
316  }
317 
318 public:
319  IMPLEMENT_TYPEID(SYMENGINE_NATURALS)
320  void operator=(Naturals const &) = delete;
321  const static RCP<const Naturals> &getInstance();
322  hash_t __hash__() const override;
323  bool __eq__(const Basic &o) const override;
324  int compare(const Basic &o) const override;
325  vec_basic get_args() const override
326  {
327  return {};
328  }
329 
330  template <typename T_, typename... Args>
331  friend inline RCP<T_> make_rcp(Args &&...args);
332 
333  RCP<const Set> set_intersection(const RCP<const Set> &o) const override;
334  RCP<const Set> set_union(const RCP<const Set> &o) const override;
335  RCP<const Set> set_complement(const RCP<const Set> &o) const override;
336  RCP<const Boolean> contains(const RCP<const Basic> &a) const override;
337 };
338 
339 class Naturals0 : public Set
340 {
341 public:
342  Naturals0()
343  {
344  SYMENGINE_ASSIGN_TYPEID()
345  }
346 
347 public:
348  IMPLEMENT_TYPEID(SYMENGINE_NATURALS0)
349  void operator=(Naturals0 const &) = delete;
350  const static RCP<const Naturals0> &getInstance();
351  hash_t __hash__() const override;
352  bool __eq__(const Basic &o) const override;
353  int compare(const Basic &o) const override;
354  vec_basic get_args() const override
355  {
356  return {};
357  }
358 
359  template <typename T_, typename... Args>
360  friend inline RCP<T_> make_rcp(Args &&...args);
361 
362  RCP<const Set> set_intersection(const RCP<const Set> &o) const override;
363  RCP<const Set> set_union(const RCP<const Set> &o) const override;
364  RCP<const Set> set_complement(const RCP<const Set> &o) const override;
365  RCP<const Boolean> contains(const RCP<const Basic> &a) const override;
366 };
367 
368 class Union : public Set
369 {
370 private:
371  set_set container_;
372 
373 public:
374  IMPLEMENT_TYPEID(SYMENGINE_UNION)
375  hash_t __hash__() const override;
376  bool __eq__(const Basic &o) const override;
377  int compare(const Basic &o) const override;
378  vec_basic get_args() const override;
379  Union(const set_set &in);
380  static bool is_canonical(const set_set &in);
381 
382  RCP<const Set> set_intersection(const RCP<const Set> &o) const override;
383  RCP<const Set> set_union(const RCP<const Set> &o) const override;
384  RCP<const Set> set_complement(const RCP<const Set> &o) const override;
385  RCP<const Boolean> contains(const RCP<const Basic> &a) const override;
386 
387  inline const set_set &get_container() const
388  {
389  return this->container_;
390  }
391 
392  RCP<const Set> create(const set_set &in) const;
393 };
394 
395 class Intersection : public Set
396 {
397 private:
398  set_set container_;
399 
400 public:
401  IMPLEMENT_TYPEID(SYMENGINE_INTERSECTION)
402  hash_t __hash__() const override;
403  bool __eq__(const Basic &o) const override;
404  int compare(const Basic &o) const override;
405  vec_basic get_args() const override;
406  Intersection(const set_set &in);
407  static bool is_canonical(const set_set &in);
408 
409  RCP<const Set> set_intersection(const RCP<const Set> &o) const override;
410  RCP<const Set> set_union(const RCP<const Set> &o) const override;
411  RCP<const Set> set_complement(const RCP<const Set> &o) const override;
412  RCP<const Boolean> contains(const RCP<const Basic> &a) const override;
413 
414  inline const set_set &get_container() const
415  {
416  return this->container_;
417  }
418 
419  RCP<const Set> create(const set_set &in) const;
420 };
421 
422 class Complement : public Set
423 {
424 private:
425  // represents universe_ - container_
426  RCP<const Set> universe_;
427  RCP<const Set> container_;
428 
429 public:
430  IMPLEMENT_TYPEID(SYMENGINE_COMPLEMENT)
431  hash_t __hash__() const override;
432  bool __eq__(const Basic &o) const override;
433  int compare(const Basic &o) const override;
434  vec_basic get_args() const override
435  {
436  return {universe_, container_};
437  }
438  Complement(const RCP<const Set> &universe, const RCP<const Set> &container);
439 
440  RCP<const Set> set_intersection(const RCP<const Set> &o) const override;
441  RCP<const Set> set_union(const RCP<const Set> &o) const override;
442  RCP<const Set> set_complement(const RCP<const Set> &o) const override;
443  RCP<const Boolean> contains(const RCP<const Basic> &a) const override;
444 
445  inline const RCP<const Set> &get_universe() const
446  {
447  return this->universe_;
448  }
449  inline const RCP<const Set> &get_container() const
450  {
451  return this->container_;
452  }
453 };
454 
455 class ConditionSet : public Set
456 {
457 private:
458  RCP<const Basic> sym;
459  RCP<const Boolean> condition_;
460 
461 public:
462  IMPLEMENT_TYPEID(SYMENGINE_CONDITIONSET)
463  hash_t __hash__() const override;
464  bool __eq__(const Basic &o) const override;
465  int compare(const Basic &o) const override;
466  vec_basic get_args() const override
467  {
468  return {sym, condition_};
469  }
470  ConditionSet(const RCP<const Basic> &sym,
471  const RCP<const Boolean> &condition);
472  static bool is_canonical(const RCP<const Basic> &sym,
473  const RCP<const Boolean> &condition);
474  RCP<const Set> set_intersection(const RCP<const Set> &o) const override;
475  RCP<const Set> set_union(const RCP<const Set> &o) const override;
476  RCP<const Set> set_complement(const RCP<const Set> &o) const override;
477  RCP<const Boolean> contains(const RCP<const Basic> &a) const override;
478  inline const RCP<const Basic> &get_symbol() const
479  {
480  return this->sym;
481  }
482  inline const RCP<const Boolean> &get_condition() const
483  {
484  return this->condition_;
485  }
486 };
487 
488 class ImageSet : public Set
489 {
490 private:
491  // represents {expr_ for sym_ in base_}
492  RCP<const Basic> sym_;
493  RCP<const Basic> expr_;
494  RCP<const Set> base_; // base set for all symbols
495 
496 public:
497  IMPLEMENT_TYPEID(SYMENGINE_IMAGESET)
498  hash_t __hash__() const override;
499  bool __eq__(const Basic &o) const override;
500  int compare(const Basic &o) const override;
501  vec_basic get_args() const override
502  {
503  return {sym_, expr_, base_};
504  }
505  ImageSet(const RCP<const Basic> &sym, const RCP<const Basic> &expr,
506  const RCP<const Set> &base);
507 
508  static bool is_canonical(const RCP<const Basic> &sym,
509  const RCP<const Basic> &expr,
510  const RCP<const Set> &base);
511  RCP<const Set> set_intersection(const RCP<const Set> &o) const override;
512  RCP<const Set> set_union(const RCP<const Set> &o) const override;
513  RCP<const Set> set_complement(const RCP<const Set> &o) const override;
514  RCP<const Boolean> contains(const RCP<const Basic> &a) const override;
515 
516  inline const RCP<const Basic> &get_symbol() const
517  {
518  return this->sym_;
519  }
520  inline const RCP<const Basic> &get_expr() const
521  {
522  return this->expr_;
523  }
524  inline const RCP<const Set> &get_baseset() const
525  {
526  return this->base_;
527  }
528 
529  RCP<const Set> create(const RCP<const Basic> &sym,
530  const RCP<const Basic> &expr,
531  const RCP<const Set> &base) const;
532 };
533 
534 inline bool is_a_Set(const Basic &b)
535 {
536  return (b.get_type_code() == SYMENGINE_EMPTYSET
537  || b.get_type_code() == SYMENGINE_UNIVERSALSET
538  || b.get_type_code() == SYMENGINE_FINITESET
539  || b.get_type_code() == SYMENGINE_COMPLEMENT
540  || b.get_type_code() == SYMENGINE_CONDITIONSET
541  || b.get_type_code() == SYMENGINE_INTERVAL
542  || b.get_type_code() == SYMENGINE_COMPLEXES
543  || b.get_type_code() == SYMENGINE_REALS
544  || b.get_type_code() == SYMENGINE_RATIONALS
545  || b.get_type_code() == SYMENGINE_INTEGERS
546  || b.get_type_code() == SYMENGINE_NATURALS
547  || b.get_type_code() == SYMENGINE_NATURALS0
548  || b.get_type_code() == SYMENGINE_UNION
549  || b.get_type_code() == SYMENGINE_INTERSECTION
550  || b.get_type_code() == SYMENGINE_IMAGESET);
551 }
552 
554 inline RCP<const Complexes> complexes()
555 {
556  return Complexes::getInstance();
557 }
558 
560 inline RCP<const Reals> reals()
561 {
562  return Reals::getInstance();
563 }
564 
566 inline RCP<const Rationals> rationals()
567 {
568  return Rationals::getInstance();
569 }
570 
572 inline RCP<const Integers> integers()
573 {
574  return Integers::getInstance();
575 }
576 
578 inline RCP<const Naturals> naturals()
579 {
580  return Naturals::getInstance();
581 }
582 
584 inline RCP<const Naturals0> naturals0()
585 {
586  return Naturals0::getInstance();
587 }
588 
590 inline RCP<const EmptySet> emptyset()
591 {
592  return EmptySet::getInstance();
593 }
594 
596 inline RCP<const UniversalSet> universalset()
597 {
598  return UniversalSet::getInstance();
599 }
600 
602 inline RCP<const Set> finiteset(const set_basic &container)
603 {
604  if (FiniteSet::is_canonical(container)) {
605  return make_rcp<const FiniteSet>(container);
606  }
607  return emptyset();
608 }
609 
611 inline RCP<const Set> interval(const RCP<const Number> &start,
612  const RCP<const Number> &end,
613  const bool left_open = false,
614  const bool right_open = false)
615 {
616  if (Interval::is_canonical(start, end, left_open, right_open))
617  return make_rcp<const Interval>(start, end, left_open, right_open);
618  if (eq(*start, *end) and not(left_open or right_open))
619  return finiteset({start});
620  return emptyset();
621 }
622 
623 // ! \return RCP<const Set>
624 inline RCP<const Set> imageset(const RCP<const Basic> &sym,
625  const RCP<const Basic> &expr,
626  const RCP<const Set> &base)
627 {
628  if (not is_a_sub<Symbol>(*sym))
629  throw SymEngineException("first arg is expected to be a symbol");
630 
631  if (eq(*expr, *sym) or eq(*base, *emptyset()))
632  return base;
633 
634  if (is_a_Number(*expr))
635  return finiteset({expr});
636  if (is_a_Set(*expr)) {
637  for (const auto &s : static_cast<const Set &>(*expr).get_args()) {
638  if (not(is_a_Number(*s) or is_a<Constant>(*s)
639  or is_a_Boolean(*s))) {
640  return make_rcp<const ImageSet>(sym, expr, base);
641  }
642  }
643  return finiteset({expr});
644  }
645 
646  if (is_a<FiniteSet>(*base)) {
647  map_basic_basic d;
648  set_basic temp;
649  for (const auto &s :
650  down_cast<const FiniteSet &>(*base).get_container()) {
651  d[sym] = s;
652  temp.insert(expr->subs(d));
653  d.clear();
654  }
655  return finiteset(temp);
656  }
657 
658  if (is_a<ImageSet>(*base)) {
659  const ImageSet &imbase = down_cast<const ImageSet &>(*base);
660  map_basic_basic d;
661  d[sym] = imbase.get_expr();
662  return imageset(imbase.get_symbol(), expand(expr->subs(d)),
663  imbase.get_baseset());
664  }
665 
666  return make_rcp<const ImageSet>(sym, expr, base);
667 }
668 
669 // ! \return RCP<const Set>
670 RCP<const Set> set_union(const set_set &in);
671 
672 // ! \return RCP<const Set>
673 RCP<const Set> set_intersection(const set_set &in);
674 
675 RCP<const Set> set_complement_helper(const RCP<const Set> &container,
676  const RCP<const Set> &universe);
677 
678 // ! \return RCP<const Set>
679 RCP<const Set> set_complement(const RCP<const Set> &universe,
680  const RCP<const Set> &container);
681 
683 RCP<const Set> conditionset(const RCP<const Basic> &sym,
684  const RCP<const Boolean> &condition);
685 
686 RCP<const Basic> sup(const Set &s);
687 RCP<const Basic> inf(const Set &s);
688 RCP<const Set> boundary(const Set &s);
689 RCP<const Set> interior(const Set &s);
690 RCP<const Set> closure(const Set &s);
691 
692 } // namespace SymEngine
693 #endif
#define IMPLEMENT_TYPEID(SYMENGINE_ID)
Inline members and functions.
Definition: basic.h:340
T begin(T... args)
The lowest unit of symbolic representation.
Definition: basic.h:97
int compare(const Basic &o) const override
Definition: sets.cpp:1407
bool __eq__(const Basic &o) const override
Test equality.
Definition: sets.cpp:1397
hash_t __hash__() const override
Definition: sets.cpp:1389
vec_basic get_args() const override
Returns the list of arguments.
Definition: sets.h:434
int compare(const Basic &o) const override
Definition: sets.cpp:345
bool __eq__(const Basic &o) const override
Test equality.
Definition: sets.cpp:338
hash_t __hash__() const override
Definition: sets.cpp:332
vec_basic get_args() const override
Returns the list of arguments.
Definition: sets.h:209
int compare(const Basic &o) const override
Definition: sets.cpp:1483
bool __eq__(const Basic &o) const override
Test equality.
Definition: sets.cpp:1473
hash_t __hash__() const override
Definition: sets.cpp:1465
vec_basic get_args() const override
Returns the list of arguments.
Definition: sets.h:466
vec_basic get_args() const override
Returns the list of arguments.
Definition: sets.h:65
hash_t __hash__() const override
Definition: sets.cpp:785
int compare(const Basic &o) const override
Definition: sets.cpp:798
bool __eq__(const Basic &o) const override
Test equality.
Definition: sets.cpp:791
bool __eq__(const Basic &o) const override
Test equality.
Definition: sets.cpp:869
vec_basic get_args() const override
Returns the list of arguments.
Definition: sets.h:125
int compare(const Basic &o) const override
Definition: sets.cpp:878
hash_t __hash__() const override
Definition: sets.cpp:861
bool __eq__(const Basic &o) const override
Test equality.
Definition: sets.cpp:1541
hash_t __hash__() const override
Definition: sets.cpp:1532
vec_basic get_args() const override
Returns the list of arguments.
Definition: sets.h:501
int compare(const Basic &o) const override
Definition: sets.cpp:1551
hash_t __hash__() const override
Definition: sets.cpp:576
int compare(const Basic &o) const override
Definition: sets.cpp:589
vec_basic get_args() const override
Returns the list of arguments.
Definition: sets.h:296
bool __eq__(const Basic &o) const override
Test equality.
Definition: sets.cpp:582
bool __eq__(const Basic &o) const override
Test equality.
Definition: sets.cpp:1302
vec_basic get_args() const override
Returns the list of arguments.
Definition: sets.cpp:1379
int compare(const Basic &o) const override
Definition: sets.cpp:1318
hash_t __hash__() const override
Definition: sets.cpp:1294
bool __eq__(const Basic &o) const override
Test equality.
Definition: sets.cpp:43
vec_basic get_args() const override
Returns the list of arguments.
Definition: sets.cpp:275
int compare(const Basic &o) const override
Definition: sets.cpp:54
hash_t __hash__() const override
Definition: sets.cpp:33
hash_t __hash__() const override
Definition: sets.cpp:745
vec_basic get_args() const override
Returns the list of arguments.
Definition: sets.h:354
int compare(const Basic &o) const override
Definition: sets.cpp:758
bool __eq__(const Basic &o) const override
Test equality.
Definition: sets.cpp:751
vec_basic get_args() const override
Returns the list of arguments.
Definition: sets.h:325
int compare(const Basic &o) const override
Definition: sets.cpp:675
bool __eq__(const Basic &o) const override
Test equality.
Definition: sets.cpp:668
hash_t __hash__() const override
Definition: sets.cpp:662
bool __eq__(const Basic &o) const override
Test equality.
Definition: sets.cpp:496
vec_basic get_args() const override
Returns the list of arguments.
Definition: sets.h:267
int compare(const Basic &o) const override
Definition: sets.cpp:501
hash_t __hash__() const override
Definition: sets.cpp:490
vec_basic get_args() const override
Returns the list of arguments.
Definition: sets.h:238
int compare(const Basic &o) const override
Definition: sets.cpp:425
bool __eq__(const Basic &o) const override
Test equality.
Definition: sets.cpp:418
hash_t __hash__() const override
Definition: sets.cpp:412
vec_basic get_args() const override=0
Returns the list of arguments.
hash_t __hash__() const override
Definition: sets.cpp:1191
int compare(const Basic &o) const override
Definition: sets.cpp:1223
vec_basic get_args() const override
Returns the list of arguments.
Definition: sets.cpp:1284
bool __eq__(const Basic &o) const override
Test equality.
Definition: sets.cpp:1199
vec_basic get_args() const override
Returns the list of arguments.
Definition: sets.h:98
bool __eq__(const Basic &o) const override
Test equality.
Definition: sets.cpp:831
int compare(const Basic &o) const override
Definition: sets.cpp:838
hash_t __hash__() const override
Definition: sets.cpp:825
T end(T... args)
T insert(T... args)
Main namespace for SymEngine package.
Definition: add.cpp:19
bool is_a_Number(const Basic &b)
Definition: number.h:130
RCP< const Set > interval(const RCP< const Number > &start, const RCP< const Number > &end, const bool left_open=false, const bool right_open=false)
Definition: sets.h:611
RCP< const Complexes > complexes()
Definition: sets.h:554
RCP< const Reals > reals()
Definition: sets.h:560
bool eq(const Basic &a, const Basic &b)
Checks equality for a and b
Definition: basic-inl.h:21
RCP< const Naturals > naturals()
Definition: sets.h:578
RCP< const EmptySet > emptyset()
Definition: sets.h:590
RCP< const Integers > integers()
Definition: sets.h:572
RCP< const UniversalSet > universalset()
Definition: sets.h:596
RCP< const Set > conditionset(const RCP< const Basic > &sym, const RCP< const Boolean > &condition)
Definition: sets.cpp:1781
RCP< const Set > finiteset(const set_basic &container)
Definition: sets.h:602
RCP< const Basic > expand(const RCP< const Basic > &self, bool deep=true)
Expands self
Definition: expand.cpp:369
RCP< const Naturals0 > naturals0()
Definition: sets.h:584
RCP< const Rationals > rationals()
Definition: sets.h:566
T set_intersection(T... args)
T set_union(T... args)