Definition at line 320 of file test_visitors.h.
◆ PolynomialVisitor()
SymEngine::PolynomialVisitor::PolynomialVisitor |
( |
const set_basic & |
variables | ) |
|
|
inline |
◆ apply()
bool SymEngine::PolynomialVisitor::apply |
( |
const Basic & |
b | ) |
|
Definition at line 806 of file test_visitors.cpp.
807{
808 b.accept(*this);
809 return is_polynomial_;
810}
◆ bvisit() [1/9]
void SymEngine::PolynomialVisitor::bvisit |
( |
const Add & |
x | ) |
|
Definition at line 741 of file test_visitors.cpp.
742{
743 for (const auto &arg : x.get_args()) {
744 arg->accept(*this);
745 if (!is_polynomial_)
746 return;
747 }
748}
◆ bvisit() [2/9]
void SymEngine::PolynomialVisitor::bvisit |
( |
const Basic & |
x | ) |
|
Definition at line 727 of file test_visitors.cpp.
728{
729 auto old_allowed = variables_allowed_;
730 variables_allowed_ = false;
731 for (const auto &p : x.get_args()) {
732 p->accept(*this);
733 if (!is_polynomial_) {
734 variables_allowed_ = old_allowed;
735 return;
736 }
737 }
738 variables_allowed_ = old_allowed;
739}
◆ bvisit() [3/9]
void SymEngine::PolynomialVisitor::bvisit |
( |
const Constant & |
x | ) |
|
|
inline |
◆ bvisit() [4/9]
void SymEngine::PolynomialVisitor::bvisit |
( |
const Mul & |
x | ) |
|
Definition at line 750 of file test_visitors.cpp.
751{
752 for (const auto &p : x.get_dict()) {
753 this->check_power(*p.first, *p.second);
754 if (!is_polynomial_)
755 return;
756 }
757}
◆ bvisit() [5/9]
void SymEngine::PolynomialVisitor::bvisit |
( |
const Number & |
x | ) |
|
|
inline |
◆ bvisit() [6/9]
void SymEngine::PolynomialVisitor::bvisit |
( |
const Pow & |
x | ) |
|
Definition at line 784 of file test_visitors.cpp.
785{
786 check_power(*x.get_base(), *x.get_exp());
787}
◆ bvisit() [7/9]
void SymEngine::PolynomialVisitor::bvisit |
( |
const Relational & |
x | ) |
|
|
inline |
◆ bvisit() [8/9]
void SymEngine::PolynomialVisitor::bvisit |
( |
const Set & |
x | ) |
|
|
inline |
◆ bvisit() [9/9]
void SymEngine::PolynomialVisitor::bvisit |
( |
const Symbol & |
x | ) |
|
Definition at line 789 of file test_visitors.cpp.
790{
791 if (variables_allowed_)
792 return;
793
794 if (variables_.
empty()) {
795 is_polynomial_ = false;
796 } else {
797 for (const auto &elem : variables_) {
798 if (x.__eq__(*elem)) {
799 is_polynomial_ = false;
800 return;
801 }
802 }
803 }
804}
◆ check_power()
void SymEngine::PolynomialVisitor::check_power |
( |
const Basic & |
base, |
|
|
const Basic & |
exp |
|
) |
| |
|
private |
Definition at line 759 of file test_visitors.cpp.
760{
761 if (variables_allowed_) {
762 variables_allowed_ = false;
764 if (!is_polynomial_) {
765 variables_allowed_ = true;
766 return;
767 }
768 base.accept(*this);
769 variables_allowed_ = true;
770 if (!is_polynomial_) {
771 is_polynomial_ = true;
772 base.accept(*this);
773 is_polynomial_ = is_polynomial_ and is_a<Integer>(
exp)
774 and down_cast<const Integer &>(
exp).is_positive();
775 }
776 } else {
777 base.accept(*this);
778 if (!is_polynomial_)
779 return;
781 }
782}
RCP< const Basic > exp(const RCP< const Basic > &x)
Returns the natural exponential function E**x = pow(E, x)
◆ is_polynomial_
bool SymEngine::PolynomialVisitor::is_polynomial_ = true |
|
private |
◆ variables_
const set_basic& SymEngine::PolynomialVisitor::variables_ |
|
private |
◆ variables_allowed_
bool SymEngine::PolynomialVisitor::variables_allowed_ = true |
|
private |
The documentation for this class was generated from the following files: