Loading...
Searching...
No Matches
SymEngine::UExprPolyBase< Cont, Poly > Class Template Reference
+ Inheritance diagram for SymEngine::UExprPolyBase< Cont, Poly >:
+ Collaboration diagram for SymEngine::UExprPolyBase< Cont, Poly >:

Public Types

typedef Expression coef_type
 
- Public Types inherited from SymEngine::UPolyBase< Cont, Poly >
typedef Cont container_type
 

Public Member Functions

 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)
 
virtual int compare (const Basic &o) const=0
 
virtual hash_t __hash__ () const=0
 
virtual int size () const=0
 
bool __eq__ (const Basic &o) const
 
const RCP< const Basic > & get_var () const
 
const Cont & get_poly () const
 
vec_basic get_args () const
 Returns the list of arguments. More...
 
- 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 Member Functions

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. More...
 

Additional Inherited Members

- Data Fields inherited from SymEngine::Basic
TypeID type_code_
 

Detailed Description

template<typename Cont, typename Poly>
class SymEngine::UExprPolyBase< Cont, Poly >

Definition at line 407 of file upolybase.h.

Member Typedef Documentation

◆ coef_type

template<typename Cont , typename Poly >
typedef Expression SymEngine::UExprPolyBase< Cont, Poly >::coef_type

Definition at line 410 of file upolybase.h.

Constructor & Destructor Documentation

◆ UExprPolyBase()

template<typename Cont , typename Poly >
SymEngine::UExprPolyBase< Cont, Poly >::UExprPolyBase ( const RCP< const Basic > &  var,
Cont &&  container 
)
inline

Definition at line 412 of file upolybase.h.

413 : UPolyBase<Cont, Poly>(var, std::move(container))
414 {
415 }
T move(T... args)

Member Function Documentation

◆ as_symbolic()

template<typename Cont , typename Poly >
RCP< const Basic > SymEngine::UExprPolyBase< Cont, Poly >::as_symbolic ( ) const
inline

Definition at line 429 of file upolybase.h.

430 {
431 auto it = (down_cast<const Poly &>(*this)).begin();
432 auto end = (down_cast<const Poly &>(*this)).end();
433
434 vec_basic args;
435 for (; it != end; ++it) {
436 if (it->first == 0)
437 args.push_back(it->second.get_basic());
438 else if (it->first == 1) {
439 if (it->second == Expression(1))
440 args.push_back(this->get_var());
441 else
442 args.push_back(
443 mul(it->second.get_basic(), this->get_var()));
444 } else if (it->second == 1)
445 args.push_back(pow(this->get_var(), integer(it->first)));
446 else
447 args.push_back(mul(it->second.get_basic(),
448 pow(this->get_var(), integer(it->first))));
449 }
450 if (this->get_poly().empty())
451 args.push_back(zero);
452 return SymEngine::add(args);
453 }
T begin(T... args)
T end(T... args)
RCP< const Basic > mul(const RCP< const Basic > &a, const RCP< const Basic > &b)
Multiplication.
Definition: mul.cpp:352
RCP< const Basic > add(const RCP< const Basic > &a, const RCP< const Basic > &b)
Adds two objects (safely).
Definition: add.cpp:425
std::enable_if< std::is_integral< T >::value, RCP< constInteger > >::type integer(T i)
Definition: integer.h:200
T pow(T... args)
T push_back(T... args)

◆ from_dict()

template<typename Cont , typename Poly >
static RCP< const Poly > SymEngine::UExprPolyBase< Cont, Poly >::from_dict ( const RCP< const Basic > &  var,
std::map< int, Expression > &&  d 
)
inlinestatic

Definition at line 422 of file upolybase.h.

424 {
425 return Poly::from_container(
426 var, Poly::container_from_dict(var, std::move(d)));
427 }

◆ get_degree()

template<typename Cont , typename Poly >
int SymEngine::UExprPolyBase< Cont, Poly >::get_degree ( ) const
inline

Definition at line 417 of file upolybase.h.

418 {
419 return this->get_poly().degree();
420 }

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