|
Bertini 2 - C++ Core
Software for Numerical Algebraic Geometry
|
Abstract base class for the Bertini hybrid-precision (double-multiple) expression tree. More...
#include <node.hpp>
Public Member Functions | |
| virtual int | Degree (std::shared_ptr< Variable > const &v=nullptr) const =0 |
| virtual int | Degree (VariableGroup const &vars) const =0 |
| virtual std::shared_ptr< Node > | Differentiate (std::shared_ptr< Variable > const &v=nullptr) const =0 |
| Compute the derivative with respect to a single variable. | |
| virtual unsigned | EliminateOnes ()=0 |
| A transform function, which eliminates nodes from the tree. | |
| virtual unsigned | EliminateZeros ()=0 |
| A transform function, which eliminates nodes from the tree. | |
| template<typename T> | |
| T | Eval (std::shared_ptr< Variable > const &diff_variable=nullptr) const |
| template<typename T> | |
| void | EvalInPlace (T &eval_value, std::shared_ptr< Variable > const &diff_variable=nullptr) const |
| virtual void | Homogenize (VariableGroup const &vars, std::shared_ptr< Variable > const &homvar)=0 |
| virtual bool | IsHomogeneous (std::shared_ptr< Variable > const &v=nullptr) const =0 |
| virtual bool | IsHomogeneous (VariableGroup const &vars) const =0 |
| bool | IsPolynomial (std::shared_ptr< Variable > const &v=nullptr) const |
| bool | IsPolynomial (VariableGroup const &v) const |
| virtual std::vector< int > | MultiDegree (VariableGroup const &vars) const =0 |
| virtual void | precision (unsigned int prec) const =0 |
| virtual void | print (std::ostream &target) const =0 |
| virtual unsigned | ReduceDepth () |
| A mutating function which finds ways to reduce the depth of the tree. | |
| virtual void | Reset () const =0 |
Protected Member Functions | |
| virtual void | FreshEval_d (dbl &evaluation_value, std::shared_ptr< Variable > const &) const =0 |
| virtual dbl | FreshEval_d (std::shared_ptr< Variable > const &) const =0 |
| virtual void | FreshEval_mp (mpfr_complex &evaluation_value, std::shared_ptr< Variable > const &) const =0 |
| virtual mpfr_complex | FreshEval_mp (std::shared_ptr< Variable > const &) const =0 |
| void | ResetStoredValues () const |
Friends | |
| std::ostream & | operator<< (std::ostream &out, const Node &N) |
Additional Inherited Members | |
Static Protected Member Functions inherited from bertini::VisitableBase< RetT, CatchAll > | |
| template<typename T> | |
| static VisitReturnType | AcceptBase (T &visited, VisitorBase &guest) |
| Abstract method for how to accept a visitor. | |
Abstract base class for the Bertini hybrid-precision (double-multiple) expression tree.
An interface for all nodes in a function tree, and for a function object as well. Almost all methods that will be called on a node must be declared in this class. The main evaluation method is defined in this class.
Bertini function trees are created using std::shared_ptr's to Node base class, generally.
|
pure virtual |
Compute the degree, optionally with respect to a single variable.
| v | Shared pointer to variable with respect to which you want to compute the degree of the Node. |
Implemented in bertini::node::Differential, bertini::node::DiffLinear, bertini::node::ExpOperator, bertini::node::IntegerPowerOperator, bertini::node::LinearProduct, bertini::node::LogOperator, bertini::node::MultOperator, bertini::node::Number, bertini::node::PowerOperator, bertini::node::SqrtOperator, bertini::node::SumOperator, bertini::node::TrigOperator, bertini::node::UnaryOperator, and bertini::node::Variable.
|
pure virtual |
Compute the overall degree with respect to a variable group.
| vars | A group of variables. |
Implemented in bertini::node::Differential, bertini::node::DiffLinear, bertini::node::LinearProduct, bertini::node::MultOperator, bertini::node::Number, bertini::node::PowerOperator, bertini::node::SumOperator, bertini::node::UnaryOperator, and bertini::node::Variable.
|
pure virtual |
Compute the derivative with respect to a single variable.
Virtual method for differentiating the node. If no variable is passed, produces a Jacobian tree when all is said and done, which is used for evaluating the Jacobian.
Implemented in bertini::node::ArcCosOperator, bertini::node::ArcSinOperator, bertini::node::ArcTanOperator, bertini::node::CosOperator, bertini::node::Differential, bertini::node::DiffLinear, bertini::node::ExpOperator, bertini::node::IntegerPowerOperator, bertini::node::LinearProduct, bertini::node::LogOperator, bertini::node::MultOperator, bertini::node::NegateOperator, bertini::node::Number, bertini::node::PowerOperator, bertini::node::SinOperator, bertini::node::SqrtOperator, bertini::node::SumOperator, bertini::node::TanOperator, and bertini::node::Variable.
|
pure virtual |
A transform function, which eliminates nodes from the tree.
A better implementation of this would use a generic Transform. If you know how to do this, please rewrite the Nodes so they can transform to our whim, and submit a PR.
Implemented in bertini::node::ArcCosOperator, bertini::node::ArcSinOperator, bertini::node::ArcTanOperator, bertini::node::CosOperator, bertini::node::ExpOperator, bertini::node::IntegerPowerOperator, bertini::node::LinearProduct, bertini::node::LogOperator, bertini::node::MultOperator, bertini::node::NegateOperator, bertini::node::PowerOperator, bertini::node::SinOperator, bertini::node::SqrtOperator, bertini::node::SumOperator, bertini::node::Symbol, and bertini::node::TanOperator.
|
pure virtual |
A transform function, which eliminates nodes from the tree.
A better implementation of this would use a generic Transform. If you know how to do this, please rewrite the Nodes so they can transform to our whim, and submit a PR.
Implemented in bertini::node::LinearProduct, bertini::node::NegateOperator, bertini::node::SqrtOperator, bertini::node::SumOperator, and bertini::node::Symbol.
|
inline |
Evaluate the node. If flag false, just return value, if flag true run the specific FreshEval of the node, then set flag to false.
Template type is type of value you want returned.
| T | The number type for return. Must be one of the types stored in the Node class, currently dbl and mpfr_complex. |
| void bertini::node::Node::EvalInPlace | ( | T & | eval_value, |
| std::shared_ptr< Variable > const & | diff_variable = nullptr ) const |
Evaluate the node in place. If flag false, just return value, if flag true run the specific FreshEval of the node, then set flag to false.
Template type is type of value you want returned.
| T | The number type for return. Must be one of the types stored in the Node class, currently dbl and mpfr_complex. |
|
protectedpure virtual |
Overridden code for specific node types, for how to evaluate themselves. Called from the wrapper EvalInPlace<>() call from Node, if so required (by resetting, etc).
If we had the ability to use template virtual functions, we would have. However, this is impossible with current C++ without using experimental libraries, so we have two copies – because there are two number types for Nodes, dbl and mpfr_complex.
Implemented in bertini::node::ArcCosOperator, bertini::node::ArcSinOperator, bertini::node::ArcTanOperator, bertini::node::CosOperator, bertini::node::Differential, bertini::node::DiffLinear, bertini::node::ExpOperator, bertini::node::IntegerPowerOperator, bertini::node::LinearProduct, bertini::node::LogOperator, bertini::node::MultOperator, bertini::node::NegateOperator, bertini::node::PowerOperator, bertini::node::SinOperator, bertini::node::SqrtOperator, bertini::node::SumOperator, bertini::node::TanOperator, and bertini::node::Variable.
|
protectedpure virtual |
Overridden code for specific node types, for how to evaluate themselves. Called from the wrapper Eval<>() call from Node, if so required (by resetting, etc).
If we had the ability to use template virtual functions, we would have. However, this is impossible with current C++ without using experimental libraries, so we have two copies – because there are two number types for Nodes, dbl and mpfr_complex.
Implemented in bertini::node::ArcCosOperator, bertini::node::ArcSinOperator, bertini::node::ArcTanOperator, bertini::node::CosOperator, bertini::node::Differential, bertini::node::DiffLinear, bertini::node::ExpOperator, bertini::node::IntegerPowerOperator, bertini::node::LinearProduct, bertini::node::LogOperator, bertini::node::MultOperator, bertini::node::NegateOperator, bertini::node::PowerOperator, bertini::node::SinOperator, bertini::node::SqrtOperator, bertini::node::SumOperator, bertini::node::TanOperator, and bertini::node::Variable.
|
protectedpure virtual |
Overridden code for specific node types, for how to evaluate themselves. Called from the wrapper Eval<>() call from Node, if so required (by resetting, etc).
If we had the ability to use template virtual functions, we would have. However, this is impossible with current C++ without using experimental libraries, so we have two copies – because there are two number types for Nodes, dbl and mpfr_complex.
Implemented in bertini::node::ArcCosOperator, bertini::node::ArcSinOperator, bertini::node::ArcTanOperator, bertini::node::CosOperator, bertini::node::Differential, bertini::node::DiffLinear, bertini::node::ExpOperator, bertini::node::IntegerPowerOperator, bertini::node::LinearProduct, bertini::node::LogOperator, bertini::node::MultOperator, bertini::node::NegateOperator, bertini::node::PowerOperator, bertini::node::SinOperator, bertini::node::SqrtOperator, bertini::node::SumOperator, bertini::node::TanOperator, and bertini::node::Variable.
|
protectedpure virtual |
Overridden code for specific node types, for how to evaluate themselves. Called from the wrapper Eval<>() call from Node, if so required (by resetting, etc).
If we had the ability to use template virtual functions, we would have. However, this is impossible with current C++ without using experimental libraries, so we have two copies – because there are two number types for Nodes, dbl and mpfr_complex.
Implemented in bertini::node::ArcCosOperator, bertini::node::ArcSinOperator, bertini::node::ArcTanOperator, bertini::node::CosOperator, bertini::node::Differential, bertini::node::DiffLinear, bertini::node::ExpOperator, bertini::node::IntegerPowerOperator, bertini::node::LinearProduct, bertini::node::LogOperator, bertini::node::MultOperator, bertini::node::NegateOperator, bertini::node::PowerOperator, bertini::node::SinOperator, bertini::node::SqrtOperator, bertini::node::SumOperator, bertini::node::TanOperator, and bertini::node::Variable.
|
pure virtual |
Homogenize a tree, inputting a variable group holding the non-homogeneous variables, and the new homogenizing variable. The homvar may be an element of the variable group, that's perfectly ok.
| homvar | The homogenizing variable, which is multiplied against terms with degree deficiency with repect to other terms. |
| vars | A group of variables, with respect to which you wish to homogenize. |
Implemented in bertini::node::Differential, bertini::node::DiffLinear, bertini::node::LinearProduct, bertini::node::MultOperator, bertini::node::Number, bertini::node::PowerOperator, bertini::node::SumOperator, bertini::node::UnaryOperator, and bertini::node::Variable.
|
pure virtual |
Check for homogeneity, absolutely with respect to all variables, including path variables and all other variable types, or with respect to a single varaible, if passed.
Implemented in bertini::node::Differential, bertini::node::DiffLinear, bertini::node::IntegerPowerOperator, bertini::node::LinearProduct, bertini::node::MultOperator, bertini::node::NegateOperator, bertini::node::Number, bertini::node::PowerOperator, bertini::node::SumOperator, bertini::node::UnaryOperator, and bertini::node::Variable.
|
pure virtual |
Check for homogeneity, with respect to a variable group.
Implemented in bertini::node::Differential, bertini::node::DiffLinear, bertini::node::IntegerPowerOperator, bertini::node::LinearProduct, bertini::node::MultOperator, bertini::node::NegateOperator, bertini::node::Number, bertini::node::PowerOperator, bertini::node::SumOperator, bertini::node::UnaryOperator, and bertini::node::Variable.
| bool bertini::node::Node::IsPolynomial | ( | std::shared_ptr< Variable > const & | v = nullptr | ) | const |
Check if a Node is polynomial – it has degree at least 0. Negative degrees indicate non-polynomial.
| bool bertini::node::Node::IsPolynomial | ( | VariableGroup const & | v | ) | const |
Check if a Node is polynomial – it has degree at least 0. Negative degrees indicate non-polynomial.
|
pure virtual |
Compute the multidegree with respect to a variable group. This is for homogenization, and testing for homogeneity.
Implemented in bertini::node::Differential, bertini::node::DiffLinear, bertini::node::LinearProduct, bertini::node::MultOperator, bertini::node::Number, bertini::node::PowerOperator, bertini::node::SumOperator, bertini::node::UnaryOperator, and bertini::node::Variable.
|
pure virtual |
Change the precision of this variable-precision tree node.
| prec | the number of digits to change precision to. |
Implemented in bertini::node::Differential, bertini::node::DiffLinear, bertini::node::LinearProduct, bertini::node::NaryOperator, bertini::node::Number, bertini::node::PowerOperator, bertini::node::UnaryOperator, and bertini::node::Variable.
|
pure virtual |
Virtual method for printing Nodes to arbitrary output streams.
Implemented in bertini::node::ArcCosOperator, bertini::node::ArcSinOperator, bertini::node::ArcTanOperator, bertini::node::CosOperator, bertini::node::Differential, bertini::node::DiffLinear, bertini::node::ExpOperator, bertini::node::Float, bertini::node::Integer, bertini::node::IntegerPowerOperator, bertini::node::LinearProduct, bertini::node::LogOperator, bertini::node::MultOperator, bertini::node::NamedSymbol, bertini::node::NegateOperator, bertini::node::PowerOperator, bertini::node::Rational, bertini::node::SinOperator, bertini::node::SqrtOperator, bertini::node::SumOperator, and bertini::node::TanOperator.
|
virtual |
A mutating function which finds ways to reduce the depth of the tree.
Reimplemented in bertini::node::MultOperator, and bertini::node::SumOperator.
|
pure virtual |
Tells code to run a fresh eval on node next time.
Implemented in bertini::node::Differential, bertini::node::DiffLinear, bertini::node::LinearProduct, bertini::node::NaryOperator, bertini::node::Number, bertini::node::PowerOperator, bertini::node::UnaryOperator, and bertini::node::Variable.
|
protected |
Set the stored values for the Node to indicate a fresh eval on the next pass. This is so that Nodes which are referred to more than once, are only evaluated once. The first evaluation is fresh, and then the indicator for fresh/stored is set to stored. Subsequent evaluation calls simply return the stored number.
|
friend |