31#ifndef BERTINI_NODE_DIFFERENTIAL_HPP
32#define BERTINI_NODE_DIFFERENTIAL_HPP
58 template<
typename... Ts>
60 std::shared_ptr<Differential>
Make(Ts&& ...ts){
61 return std::static_pointer_cast<Differential>(
Intern(std::shared_ptr<Node>(
new Differential(ts...) )));
69 Differential(std::shared_ptr<const Variable> diff_variable, std::string var_name);
79 void print(std::ostream & target)
const override;
86 std::shared_ptr<Node>
Differentiate(std::shared_ptr<Variable>
const& v =
nullptr)
const override;
96 int Degree(std::shared_ptr<Variable>
const& v =
nullptr)
const override;
102 bool IsHomogeneous(std::shared_ptr<Variable>
const& v =
nullptr)
const override;
127 Differential() =
default;
128 std::shared_ptr<const Variable> differential_variable_;
133 template<
class Archive>
134 void save(Archive & ar,
const unsigned int )
const
136 ar & boost::serialization::base_object<NamedSymbol>(*
this);
137 ar & differential_variable_;
141 template<
class Archive>
142 void load(Archive & ar,
const unsigned int )
144 ar & boost::serialization::base_object<NamedSymbol>(*
this);
145 ar & std::const_pointer_cast<Variable>(differential_variable_);
Provides the differential type for differentiation of expression trees.
Definition differential.hpp:52
bool IsHomogeneous(VariableGroup const &vars) const override
Check for homogeneity, with respect to a variable group.
bool IsHomogeneous(std::shared_ptr< Variable > const &v=nullptr) const override
Check for homogeneity, absolutely with respect to all variables, including path variables and all oth...
int Degree(std::shared_ptr< Variable > const &v=nullptr) const override
Compute the degree with respect to a single variable.
std::vector< int > MultiDegreeImpl(VariableGroup const &vars) const override
Per-node-type multidegree.
int Degree(VariableGroup const &vars) const override
Compute the overall degree with respect to a variable group.
virtual ~Differential()=default
const std::shared_ptr< const Variable > & GetVariable() const
static std::shared_ptr< Differential > Make(Ts &&...ts)
Construct (and intern) a Differential node.
Definition differential.hpp:60
std::shared_ptr< Node > Differentiate(std::shared_ptr< Variable > const &v=nullptr) const override
Differentiates a number.
friend class boost::serialization::access
Definition differential.hpp:131
void print(std::ostream &target) const override
Virtual method for printing Nodes to arbitrary output streams.
NamedSymbol(const std::string &new_name)
Parameterized constructor, sets the name of the symbol.
Represents variable leaves in the function tree.
Definition variable.hpp:48
Definition canonical.hpp:56
std::shared_ptr< Node > Intern(std::shared_ptr< Node > const &candidate)
Hash-cons a freshly-built node: return an existing structurally-equal node if one is live,...
Definition algorithm_builder.hpp:36
std::vector< std::shared_ptr< node::Variable > > VariableGroup
An ordered group of variables (the unit of homogenization / variable grouping).
Definition node.hpp:69
Defines the abstract Node base class.
Provides the Number Node types, including Rational, Complex, and Integer.
Defines the abstract Symbol and NamedSymbol classes,.
#define BERTINI_DEFAULT_VISITABLE()
macro for classes which want default Accept implementation, having nothing fancy to do when accepting...
Definition visitable.hpp:121