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

Public Member Functions

 URatPolyBase (const RCP< const Basic > &var, Container &&container)
 
RCP< const Basicas_symbolic () const
 
- Public Member Functions inherited from SymEngine::UNonExprPoly< Container, Poly, rational_class >
 UNonExprPoly (const RCP< const Basic > &var, Container &&container)
 
virtual rational_class get_coeff (unsigned int i) const=0
 
virtual rational_class eval (const rational_class &x) const=0
 
std::vector< rational_class > multieval (const std::vector< rational_class > &v) const
 
int get_degree () const
 
rational_class get_lc () const
 
- Public Member Functions inherited from SymEngine::UPolyBase< Container, Poly >
 UPolyBase (const RCP< const Basic > &var, Container &&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 Container & 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
 

Additional Inherited Members

- Public Types inherited from SymEngine::UNonExprPoly< Container, Poly, rational_class >
typedef rational_class coef_type
 
- Public Types inherited from SymEngine::UPolyBase< Container, Poly >
typedef Container container_type
 
- Static Public Member Functions inherited from SymEngine::UNonExprPoly< Container, Poly, rational_class >
static RCP< const Poly > from_dict (const RCP< const Basic > &var, std::map< unsigned, rational_class > &&d)
 
- Static Public Member Functions inherited from SymEngine::UPolyBase< Container, Poly >
static RCP< const Poly > from_container (const RCP< const Basic > &var, Container &&d)
 
- 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

template<typename Container, typename Poly>
class SymEngine::URatPolyBase< Container, Poly >

Definition at line 542 of file upolybase.h.

Constructor & Destructor Documentation

◆ URatPolyBase()

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

Definition at line 545 of file upolybase.h.

546 : UNonExprPoly<Container, Poly, rational_class>(var,
547 std::move(container))
548 {
549 }
T move(T... args)

Member Function Documentation

◆ as_symbolic()

template<typename Container , typename Poly >
RCP< const Basic > SymEngine::URatPolyBase< Container, Poly >::as_symbolic ( ) const
inline

Definition at line 551 of file upolybase.h.

552 {
553 auto it = (down_cast<const Poly &>(*this)).begin();
554 auto end = (down_cast<const Poly &>(*this)).end();
555
556 vec_basic args;
557 for (; it != end; ++it) {
558 rational_class m = it->second;
559
560 if (it->first == 0) {
561 args.push_back(Rational::from_mpq(m));
562 } else if (it->first == 1) {
563 if (m == 1) {
564 args.push_back(this->get_var());
565 } else {
566 args.push_back(Mul::from_dict(Rational::from_mpq(m),
567 {{this->get_var(), one}}));
568 }
569 } else {
570 if (m == 1) {
571 args.push_back(pow(this->get_var(), integer(it->first)));
572 } else {
573 args.push_back(Mul::from_dict(
575 {{this->get_var(), integer(it->first)}}));
576 }
577 }
578 }
579 return SymEngine::add(args);
580 }
T begin(T... args)
static RCP< const Basic > from_dict(const RCP< const Number > &coef, map_basic_basic &&d)
Create a Mul from a dict.
Definition: mul.cpp:115
static RCP< const Number > from_mpq(const rational_class &i)
Definition: rational.cpp:23
T end(T... args)
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)

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