SymEngine::UExprPoly Class Reference
+ Inheritance diagram for SymEngine::UExprPoly:
+ Collaboration diagram for SymEngine::UExprPoly:

Public Types

typedef Expression coef_type
 
- Public Types inherited from SymEngine::USymEnginePoly< UExprDict, UExprPolyBase, UExprPoly >
using Cf = typename UExprPolyBase< UExprDict, UExprPoly >::coef_type
 
using Key = typename Container::key_type
 
typedef std::map< Key, Cf >::const_iterator iterator
 
typedef std::map< Key, Cf >::const_reverse_iterator r_iterator
 
- Public Types inherited from SymEngine::UExprPolyBase< Cont, Poly >
typedef Expression coef_type
 
- Public Types inherited from SymEngine::UPolyBase< Cont, Poly >
typedef Cont container_type
 

Public Member Functions

void accept (Visitor &v) const override
 
void accept (EvalRealDoubleVisitorFinal &v) const override
 
 UExprPoly (const RCP< const Basic > &var, UExprDict &&dict)
 Constructor of UExprPoly class.
 
hash_t __hash__ () const override
 
Expression max_coef () const
 
Expression eval (const Expression &x) const
 Evaluates the UExprPoly at value x.
 
bool is_zero () const
 
bool is_one () const
 
bool is_minus_one () const
 
bool is_integer () const
 
bool is_symbol () const
 
bool is_mul () const
 
bool is_pow () const
 
- Public Member Functions inherited from SymEngine::USymEnginePoly< UExprDict, UExprPolyBase, UExprPoly >
 USymEnginePoly (const RCP< const Basic > &var, UExprDict &&dict)
 
int compare (const Basic &o) const
 
bool is_canonical (const UExprDict &dict) const
 
Cf eval (const Cf &x) const
 
const std::map< Key, Cf > & get_dict () const
 
Cf get_coeff (Key x) const
 
iterator begin () const
 
iterator end () const
 
r_iterator obegin () const
 
r_iterator oend () const
 
int size () const
 
- Public Member Functions inherited from SymEngine::UExprPolyBase< Cont, Poly >
 UExprPolyBase (const RCP< const Basic > &var, Cont &&container)
 
int get_degree () const
 
RCP< const Basicas_symbolic () const
 
- Public Member Functions inherited from SymEngine::UPolyBase< Cont, Poly >
 UPolyBase (const RCP< const Basic > &var, Cont &&container)
 
bool __eq__ (const Basic &o) const override
 
const RCP< const Basic > & get_var () const
 
const Cont & get_poly () const
 
vec_basic get_args () const override
 Returns the list of arguments.
 
- Public Member Functions inherited from SymEngine::Basic
TypeID get_type_code () const
 
 Basic ()
 Constructor.
 
 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.
 
hash_t hash () const
 
bool __neq__ (const Basic &o) const
 true if this is not equal to o. More...
 
int __cmp__ (const Basic &o) const
 Comparison operator.
 
std::string __str__ () const
 
std::string dumps () const
 Returns a string of the instance serialized.
 
RCP< const Basicsubs (const map_basic_basic &subs_dict) const
 Substitutes 'subs_dict' into 'self'.
 
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
 
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)
 
RCP< const Basicrcp_from_this () const
 Get RCP<const T> pointer to self (it will cast the pointer to const T)
 
RCP< const T2 > rcp_from_this_cast () const
 Get RCP<T2> pointer to self (it will cast the pointer to T2)
 
unsigned int use_count () const
 

Static Public Attributes

static const TypeID type_code_id = SYMENGINE_UEXPRPOLY
 

Additional Inherited Members

- Static Public Member Functions inherited from SymEngine::USymEnginePoly< UExprDict, UExprPolyBase, UExprPoly >
static RCP< const UExprPolyfrom_vec (const RCP< const Basic > &var, const std::vector< Cf > &v)
 
static UExprDict container_from_dict (const RCP< const Basic > &var, std::map< Key, Cf > &&d)
 
static enable_if_t< is_a_UPoly< FromPoly >::value, RCP< const UExprPoly > > from_poly (const FromPoly &p)
 
- Static Public Member Functions inherited from SymEngine::UExprPolyBase< Cont, Poly >
static RCP< const Poly > from_dict (const RCP< const Basic > &var, std::map< int, Expression > &&d)
 
- Static Public Member Functions inherited from SymEngine::UPolyBase< Cont, Poly >
static RCP< const Poly > from_container (const RCP< const Basic > &var, Cont &&d)
 
- Static Public Member Functions inherited from SymEngine::Basic
static RCP< const Basicloads (const std::string &)
 Creates an instance of a serialized string.
 
- Data Fields inherited from SymEngine::Basic
TypeID type_code_
 

Detailed Description

Definition at line 160 of file uexprpoly.h.

Member Function Documentation

◆ __hash__()

hash_t SymEngine::UExprPoly::__hash__ ( ) const
overridevirtual

Calculates the hash of the given SymEngine class. Use Basic.hash() which gives a cached version of the hash.

Returns
64-bit integer value for the hash

Implements SymEngine::UPolyBase< Cont, Poly >.

Definition at line 11 of file uexprpoly.cpp.

12 {
13  hash_t seed = SYMENGINE_UEXPRPOLY;
14 
15  seed += get_var()->hash();
16  for (const auto &it : get_poly().dict_) {
17  hash_t temp = SYMENGINE_UEXPRPOLY;
18  hash_combine<unsigned int>(temp, it.first);
19  hash_combine<Basic>(temp, *(it.second.get_basic()));
20  seed += temp;
21  }
22  return seed;
23 }

◆ is_integer()

bool SymEngine::UExprPoly::is_integer ( ) const
Returns
true if integer

Definition at line 63 of file uexprpoly.cpp.

64 {
65  if (get_poly().empty())
66  return true;
67  return get_poly().size() == 1 and get_poly().get_dict().begin()->first == 0;
68 }

◆ is_minus_one()

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

Definition at line 56 of file uexprpoly.cpp.

57 {
58  return get_poly().size() == 1
59  and get_poly().get_dict().begin()->second == -1
60  and get_poly().get_dict().begin()->first == 0;
61 }

◆ is_mul()

bool SymEngine::UExprPoly::is_mul ( ) const
Returns
true if mul

Definition at line 76 of file uexprpoly.cpp.

77 {
78  return get_poly().size() == 1 and get_poly().get_dict().begin()->first != 0
79  and get_poly().get_dict().begin()->second != 1
80  and get_poly().get_dict().begin()->second != 0;
81 }

◆ is_one()

bool SymEngine::UExprPoly::is_one ( ) const
Returns
true if 1

Definition at line 50 of file uexprpoly.cpp.

51 {
52  return get_poly().size() == 1 and get_poly().get_dict().begin()->second == 1
53  and get_poly().get_dict().begin()->first == 0;
54 }

◆ is_pow()

bool SymEngine::UExprPoly::is_pow ( ) const
Returns
true if pow

Definition at line 83 of file uexprpoly.cpp.

84 {
85  return get_poly().size() == 1 and get_poly().get_dict().begin()->second == 1
86  and get_poly().get_dict().begin()->first != 1
87  and get_poly().get_dict().begin()->first != 0;
88 }

◆ is_symbol()

bool SymEngine::UExprPoly::is_symbol ( ) const
Returns
true if symbol

Definition at line 70 of file uexprpoly.cpp.

71 {
72  return get_poly().size() == 1 and get_poly().get_dict().begin()->first == 1
73  and get_poly().get_dict().begin()->second == 1;
74 }

◆ is_zero()

bool SymEngine::UExprPoly::is_zero ( ) const
Returns
true if 0

Definition at line 45 of file uexprpoly.cpp.

46 {
47  return get_poly().empty();
48 }

Field Documentation

◆ type_code_id

const TypeID SymEngine::UExprPoly::type_code_id = SYMENGINE_UEXPRPOLY
static

Type_code_id shared by all instances

Definition at line 163 of file uexprpoly.h.


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