Loading...
Searching...
No Matches
SymEngine::NaN Class Reference

#include <nan.h>

+ Inheritance diagram for SymEngine::NaN:
+ Collaboration diagram for SymEngine::NaN:

Public Member Functions

virtual void accept (Visitor &v) const
 
virtual void accept (EvalRealDoubleVisitorFinal &v) const
 
 NaN ()
 Constructs NaN. More...
 
hash_t __hash__ () const
 
bool __eq__ (const Basic &o) const
 
int compare (const Basic &o) const
 
bool is_zero () const
 
bool is_one () const
 
bool is_minus_one () const
 
bool is_positive () const
 
bool is_negative () const
 
bool is_complex () const
 
virtual RCP< const Basicconjugate () const
 
bool is_exact () const
 return true if the number is an exact representation More...
 
virtual Evaluateget_eval () const
 Get Evaluate singleton to evaluate numerically. More...
 
RCP< const Numberadd (const Number &other) const
 Addition. More...
 
RCP< const Numbermul (const Number &other) const
 Multiplication. More...
 
RCP< const Numberdiv (const Number &other) const
 Division. More...
 
RCP< const Numberpow (const Number &other) const
 Power. More...
 
RCP< const Numberrpow (const Number &other) const
 
- Public Member Functions inherited from SymEngine::Number
virtual bool is_zero () const =0
 
virtual bool is_one () const =0
 
virtual bool is_minus_one () const =0
 
virtual bool is_negative () const =0
 
virtual bool is_positive () const =0
 
virtual bool is_complex () const =0
 
virtual RCP< const Basicconjugate () const
 
virtual bool is_exact () const
 return true if the number is an exact representation More...
 
bool is_exact_zero () const
 
virtual Evaluateget_eval () const
 Get Evaluate singleton to evaluate numerically. More...
 
virtual RCP< const Numberadd (const Number &other) const =0
 Addition. More...
 
virtual RCP< const Numbersub (const Number &other) const
 Subtraction. More...
 
virtual RCP< const Numberrsub (const Number &other) const
 
virtual RCP< const Numbermul (const Number &other) const =0
 Multiplication. More...
 
virtual RCP< const Numberdiv (const Number &other) const
 Division. More...
 
virtual RCP< const Numberrdiv (const Number &other) const
 
virtual RCP< const Numberpow (const Number &other) const =0
 Power. More...
 
virtual RCP< const Numberrpow (const Number &other) const =0
 
virtual vec_basic get_args () const
 Returns the list of arguments. More...
 
virtual bool is_perfect_power (bool is_expected=false) const
 
virtual bool nth_root (const Ptr< RCP< const Number > > &, unsigned long n) const
 
- Public Member Functions inherited from SymEngine::Basic
TypeID get_type_code () const
 
 Basic ()
 Constructor. More...
 
 Basic (const Basic &)=delete
 Delete the copy constructor and assignment.
 
Basicoperator= (const Basic &)=delete
 Assignment operator in continuation with above.
 
 Basic (Basic &&)=delete
 Delete the move constructor and assignment.
 
Basicoperator= (Basic &&)=delete
 Assignment operator in continuation with above.
 
virtual hash_t __hash__ () const =0
 
hash_t hash () const
 
virtual bool __eq__ (const Basic &o) const =0
 Test equality. More...
 
bool __neq__ (const Basic &o) const
 true if this is not equal to o. More...
 
int __cmp__ (const Basic &o) const
 Comparison operator. More...
 
virtual int compare (const Basic &o) const =0
 
std::string __str__ () const
 
std::string dumps () const
 Returns a string of the instance serialized. More...
 
RCP< const Basicsubs (const map_basic_basic &subs_dict) const
 Substitutes 'subs_dict' into 'self'. More...
 
RCP< const Basicxreplace (const map_basic_basic &subs_dict) const
 
virtual RCP< const Basicexpand_as_exp () const
 expands the special function in terms of exp function More...
 
virtual vec_basic get_args () const =0
 Returns the list of arguments. More...
 
virtual void accept (Visitor &v) const =0
 
virtual void accept (EvalRealDoubleVisitorFinal &v) const =0
 
RCP< const Basicdiff (const RCP< const Symbol > &x, bool cache=true) const
 
- Public Member Functions inherited from SymEngine::EnableRCPFromThis< Basic >
RCP< Basicrcp_from_this ()
 Get RCP<T> pointer to self (it will cast the pointer to T) More...
 
RCP< const Basicrcp_from_this () const
 Get RCP<const T> pointer to self (it will cast the pointer to const T) More...
 
RCP< const T2 > rcp_from_this_cast () const
 Get RCP<T2> pointer to self (it will cast the pointer to T2) More...
 
unsigned int use_count () const
 

Static Public Attributes

static const TypeID type_code_id = SYMENGINE_NOT_A_NUMBER
 

Additional Inherited Members

- Static Public Member Functions inherited from SymEngine::Basic
static RCP< const Basicloads (const std::string &)
 Creates an instance of a serialized string. More...
 
- Data Fields inherited from SymEngine::Basic
TypeID type_code_
 

Detailed Description

This serves as a place holder for numeric values that are indeterminate. Most operations on NaN, produce another NaN.

Definition at line 19 of file nan.h.

Constructor & Destructor Documentation

◆ NaN()

SymEngine::NaN::NaN ( )

Constructs NaN.

Definition at line 7 of file nan.cpp.

7{SYMENGINE_ASSIGN_TYPEID()}

Member Function Documentation

◆ __eq__()

bool SymEngine::NaN::__eq__ ( const Basic o) const
virtual

Equality comparator

Parameters
o- Object to be compared with
Returns
whether the 2 objects are equal

Implements SymEngine::Basic.

Definition at line 15 of file nan.cpp.

16{
17 if (is_a<NaN>(o))
18 return true;
19 else
20 return false;
21}

◆ __hash__()

hash_t SymEngine::NaN::__hash__ ( ) const
virtual
Returns
size of the hash

Implements SymEngine::Basic.

Definition at line 9 of file nan.cpp.

10{
11 hash_t seed = SYMENGINE_NOT_A_NUMBER;
12 return seed;
13}

◆ accept() [1/2]

virtual void SymEngine::NaN::accept ( EvalRealDoubleVisitorFinal v) const
virtual

Implements SymEngine::Basic.

◆ accept() [2/2]

virtual void SymEngine::NaN::accept ( Visitor v) const
virtual

Implements SymEngine::Basic.

◆ add()

RCP< const Number > SymEngine::NaN::add ( const Number other) const
virtual

Addition.

Implements SymEngine::Number.

Definition at line 34 of file nan.cpp.

35{
36 return rcp_from_this_cast<Number>();
37}

◆ compare()

int SymEngine::NaN::compare ( const Basic o) const
virtual

Returns -1, 0, 1 for this < o, this == o, this > o. This method is used when you want to sort things like x+y+z into canonical order. This function assumes that o is the same type as this. Use __cmp__ if you want general comparison.

Implements SymEngine::Basic.

Definition at line 23 of file nan.cpp.

24{
25 SYMENGINE_ASSERT(is_a<NaN>(o))
26 return 0;
27}

◆ conjugate()

RCP< const Basic > SymEngine::NaN::conjugate ( ) const
virtual
Returns
the conjugate if the class is complex

Reimplemented from SymEngine::Number.

Definition at line 29 of file nan.cpp.

30{
31 return Nan;
32}

◆ div()

RCP< const Number > SymEngine::NaN::div ( const Number other) const
virtual

Division.

Reimplemented from SymEngine::Number.

Definition at line 44 of file nan.cpp.

45{
46 return rcp_from_this_cast<Number>();
47}

◆ get_eval()

Evaluate & SymEngine::NaN::get_eval ( ) const
virtual

Get Evaluate singleton to evaluate numerically.

Reimplemented from SymEngine::Number.

Definition at line 228 of file nan.cpp.

229{
230 static EvaluateNaN evaluate_NaN;
231 return evaluate_NaN;
232}

◆ is_complex()

bool SymEngine::NaN::is_complex ( ) const
inlinevirtual
Returns
true if a complex number

Implements SymEngine::Number.

Definition at line 62 of file nan.h.

63 {
64 return false;
65 }

◆ is_exact()

bool SymEngine::NaN::is_exact ( ) const
inlinevirtual

return true if the number is an exact representation

Reimplemented from SymEngine::Number.

Definition at line 68 of file nan.h.

69 {
70 return false;
71 }

◆ is_minus_one()

bool SymEngine::NaN::is_minus_one ( ) const
inlinevirtual
Returns
true if -1

Implements SymEngine::Number.

Definition at line 47 of file nan.h.

48 {
49 return false;
50 }

◆ is_negative()

bool SymEngine::NaN::is_negative ( ) const
inlinevirtual
Returns
true if negative

Implements SymEngine::Number.

Definition at line 57 of file nan.h.

58 {
59 return false;
60 }

◆ is_one()

bool SymEngine::NaN::is_one ( ) const
inlinevirtual
Returns
true if 1

Implements SymEngine::Number.

Definition at line 42 of file nan.h.

43 {
44 return false;
45 }

◆ is_positive()

bool SymEngine::NaN::is_positive ( ) const
inlinevirtual
Returns
true if positive

Implements SymEngine::Number.

Definition at line 52 of file nan.h.

53 {
54 return false;
55 }

◆ is_zero()

bool SymEngine::NaN::is_zero ( ) const
inlinevirtual
Returns
true if 0

Implements SymEngine::Number.

Definition at line 37 of file nan.h.

38 {
39 return false;
40 }

◆ mul()

RCP< const Number > SymEngine::NaN::mul ( const Number other) const
virtual

Multiplication.

Implements SymEngine::Number.

Definition at line 39 of file nan.cpp.

40{
41 return rcp_from_this_cast<Number>();
42}

◆ pow()

RCP< const Number > SymEngine::NaN::pow ( const Number other) const
virtual

Power.

Implements SymEngine::Number.

Definition at line 49 of file nan.cpp.

50{
51 return rcp_from_this_cast<Number>();
52}

◆ rpow()

RCP< const Number > SymEngine::NaN::rpow ( const Number other) const
virtual

Implements SymEngine::Number.

Definition at line 54 of file nan.cpp.

55{
56 return rcp_from_this_cast<Number>();
57}

Field Documentation

◆ type_code_id

const TypeID SymEngine::NaN::type_code_id = SYMENGINE_NOT_A_NUMBER
static

Type_code_id shared by all instances

Definition at line 22 of file nan.h.


The documentation for this class was generated from the following files: