infinity.h
Go to the documentation of this file.
1 
6 #ifndef SYMENGINE_INFINITY_H
7 #define SYMENGINE_INFINITY_H
8 
9 #include <symengine/basic.h>
10 #include <symengine/number.h>
11 #include <symengine/integer.h>
12 #include <symengine/mul.h>
13 
14 namespace SymEngine
15 {
16 
20 class Infty : public Number
21 {
22  RCP<const Number> _direction;
23 
24 public:
25  IMPLEMENT_TYPEID(SYMENGINE_INFTY)
27  Infty(const RCP<const Number> &direction);
29  Infty(const Infty &inf);
30  static RCP<const Infty> from_direction(const RCP<const Number> &direction);
32  static RCP<const Infty> from_int(const int val);
33 
35  bool is_canonical(const RCP<const Number> &num) const;
37  hash_t __hash__() const;
38 
43  // Implement these
44  bool __eq__(const Basic &o) const;
45  int compare(const Basic &o) const;
46 
47  virtual vec_basic get_args() const
48  {
49  return {_direction};
50  }
51 
53  inline bool is_zero() const
54  {
55  return false;
56  }
58  inline bool is_one() const
59  {
60  return false;
61  }
63  inline bool is_minus_one() const
64  {
65  return false;
66  }
67 
69  inline virtual bool is_exact() const
70  {
71  return false;
72  }
73  // //! Get `Evaluate` singleton to evaluate numerically
74  virtual Evaluate &get_eval() const;
75 
76  inline RCP<const Number> get_direction() const
77  {
78  return _direction;
79  }
80 
81  bool is_unsigned_infinity() const;
82  bool is_positive_infinity() const;
83  bool is_negative_infinity() const;
84 
85  inline bool is_positive() const
86  {
87  return is_positive_infinity();
88  }
89 
90  inline bool is_negative() const
91  {
92  return is_negative_infinity();
93  }
94 
95  inline bool is_complex() const
96  {
97  return is_unsigned_infinity();
98  }
100  virtual RCP<const Basic> conjugate() const;
101 
102  // Think about it again
103  RCP<const Number> add(const Number &other) const;
104  RCP<const Number> mul(const Number &other) const;
105  RCP<const Number> div(const Number &other) const;
106  RCP<const Number> pow(const Number &other) const;
107  RCP<const Number> rpow(const Number &other) const;
108 };
109 
110 inline RCP<const Infty> infty(int n = 1)
111 {
112  return make_rcp<Infty>(integer(n));
113 }
114 
115 RCP<const Infty> infty(const RCP<const Number> &direction);
116 
117 } // namespace SymEngine
118 #endif
The base class for SymEngine.
#define IMPLEMENT_TYPEID(SYMENGINE_ID)
Inline members and functions.
Definition: basic.h:340
The lowest unit of symbolic representation.
Definition: basic.h:95
A class that will evaluate functions numerically.
Definition: number.h:193
virtual vec_basic get_args() const
Returns the list of arguments.
Definition: infinity.h:47
RCP< const Number > div(const Number &other) const
Division.
Definition: infinity.cpp:132
bool is_canonical(const RCP< const Number > &num) const
Canonical when the direction is -1, 0 or 1.
Definition: infinity.cpp:40
bool __eq__(const Basic &o) const
Definition: infinity.cpp:58
virtual RCP< const Basic > conjugate() const
Definition: infinity.cpp:90
bool is_negative() const
Definition: infinity.h:90
bool is_minus_one() const
Definition: infinity.h:63
virtual bool is_exact() const
Definition: infinity.h:69
static RCP< const Infty > from_int(const int val)
Constructs Infty using sign of val
Definition: infinity.cpp:33
RCP< const Number > pow(const Number &other) const
Power.
Definition: infinity.cpp:146
bool is_positive() const
Definition: infinity.h:85
Infty(const RCP< const Number > &direction)
Constructs Infty using the sign of _direction
Definition: infinity.cpp:14
RCP< const Number > add(const Number &other) const
Addition.
Definition: infinity.cpp:98
hash_t __hash__() const
Definition: infinity.cpp:51
int compare(const Basic &o) const
Definition: infinity.cpp:68
bool is_zero() const
Definition: infinity.h:53
virtual Evaluate & get_eval() const
Get Evaluate singleton to evaluate numerically.
Definition: infinity.cpp:531
bool is_one() const
Definition: infinity.h:58
RCP< const Number > mul(const Number &other) const
Multiplication.
Definition: infinity.cpp:113
bool is_complex() const
Definition: infinity.h:95
Main namespace for SymEngine package.
Definition: add.cpp:19
std::enable_if< std::is_integral< T >::value, RCP< const Integer > >::type integer(T i)
Definition: integer.h:200