46#ifndef BERTINI_FUNCTION_NODE_HPP
47#define BERTINI_FUNCTION_NODE_HPP
69 void print(std::ostream & target) const override;
72 Handle(std::
string const& new_name);
78 Handle(const std::shared_ptr<Node> & entry, std::
string const&
name =
"unnamed_function");
89 void SetRoot(std::shared_ptr<Node> const& entry);
95 void EnsureNotEmpty() const;
101 void Reset() const override;
108 const std::shared_ptr<Node>& EntryNode() const;
114 std::shared_ptr<Node> Differentiate(std::shared_ptr<Variable> const& v =
nullptr) const override;
119 int Degree(std::shared_ptr<Variable> const& v =
nullptr) const override;
122 int Degree(VariableGroup const& vars) const override;
129 std::vector<
int> MultiDegree(VariableGroup const& vars) const override;
132 void Homogenize(VariableGroup const& vars, std::shared_ptr<Variable> const& homvar) override;
134 bool IsHomogeneous(std::shared_ptr<Variable> const& v =
nullptr) const override;
139 bool IsHomogeneous(VariableGroup const& vars) const override;
147 void precision(
unsigned int prec) const override;
156 dbl FreshEval_d(std::shared_ptr<Variable> const& diff_variable) const override;
161 void FreshEval_d(dbl& evaluation_value, std::shared_ptr<Variable> const& diff_variable) const override;
167 mpfr_complex FreshEval_mp(std::shared_ptr<Variable> const& diff_variable) const override;
172 void FreshEval_mp(mpfr_complex& evaluation_value, std::shared_ptr<Variable> const& diff_variable) const override;
175 std::shared_ptr<Node> entry_node_ =
nullptr;
181 friend class boost::serialization::access;
183 template <typename Archive>
184 void serialize(Archive& ar, const
unsigned version) {
185 ar & boost::serialization::base_object<NamedSymbol>(*
this);
217 class Function :
public virtual Handle,
public virtual EnableSharedFromThisVirtual<Function>
220 BERTINI_DEFAULT_VISITABLE()
222 template<
typename... Ts>
224 std::shared_ptr<Function> Make(Ts&& ...ts){
225 return std::shared_ptr<Function>(
new Function(ts...) );
228 template<
typename... Ts>
230 std::shared_ptr<Function> MakeInPlace(Function* ptr, Ts&& ...ts){
231 return std::shared_ptr<Function>(
new(ptr) Function(ts...) );
236 Function(std::string
const& new_name);
242 Function(
const std::shared_ptr<Node> & entry, std::string
const&
name =
"unnamed_function");
248 virtual ~Function() =
default;
255 Function() =
default;
259 friend class boost::serialization::access;
263 template <
typename Archive>
264 void serialize(Archive& ar,
const unsigned version) {
265 ar & boost::serialization::base_object<Handle>(*
this);
Symbols which have names are named symbols.
Definition symbol.hpp:88
const std::string & name() const
Definition symbol.cpp:45
virtual void print(std::ostream &target) const =0
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