41#ifndef BERTINI_FUNCTION_TREE_VARIABLE_HPP
42#define BERTINI_FUNCTION_TREE_VARIABLE_HPP
58 class Variable :
public virtual NamedSymbol,
public virtual EnableSharedFromThisVirtual<Variable>
61 BERTINI_DEFAULT_VISITABLE()
64 template<
typename... Ts>
66 std::shared_ptr<Variable> Make(Ts&& ...ts){
67 return std::shared_ptr<Variable>(
new Variable(ts...) );
71 Variable(std::string new_name);
76 virtual ~Variable() =
default;
80 explicit operator std::string(){
return name();}
86 void set_current_value(T
const& val);
103 template <
typename T>
109 std::shared_ptr<Node>
Differentiate(std::shared_ptr<Variable>
const& v =
nullptr)
const override;
111 void Reset()
const override;
118 int Degree(std::shared_ptr<Variable>
const& v =
nullptr)
const override;
121 int Degree(VariableGroup
const& vars)
const override;
123 std::vector<int>
MultiDegree(VariableGroup
const& vars)
const override;
126 void Homogenize(VariableGroup
const& vars, std::shared_ptr<Variable>
const& homvar)
override;
128 bool IsHomogeneous(std::shared_ptr<Variable>
const& v =
nullptr)
const override;
133 bool IsHomogeneous(VariableGroup
const& vars)
const override;
141 void precision(
unsigned int prec)
const override;
146 dbl
FreshEval_d(std::shared_ptr<Variable>
const& diff_variable)
const override;
148 void FreshEval_d(dbl& evaluation_value, std::shared_ptr<Variable>
const& diff_variable)
const override;
151 mpfr_complex
FreshEval_mp(std::shared_ptr<Variable>
const& diff_variable)
const override;
153 void FreshEval_mp(mpfr_complex& evaluation_value, std::shared_ptr<Variable>
const& diff_variable)
const override;
158 friend class boost::serialization::access;
160 template <
typename Archive>
161 void serialize(Archive& ar,
const unsigned version) {
162 ar & boost::serialization::base_object<NamedSymbol>(*
this);
NamedSymbol(const std::string &new_name)
Definition symbol.cpp:54
const std::string & name() const
Definition symbol.cpp:45
void Homogenize(VariableGroup const &vars, std::shared_ptr< Variable > const &homvar) override
Definition variable.cpp:146
void Reset() const override
Definition variable.cpp:102
void precision(unsigned int prec) const override
Definition variable.cpp:170
int Degree(std::shared_ptr< Variable > const &v=nullptr) const override
Definition variable.cpp:109
dbl FreshEval_d(std::shared_ptr< Variable > const &diff_variable) const override
Definition variable.cpp:178
mpfr_complex FreshEval_mp(std::shared_ptr< Variable > const &diff_variable) const override
Definition variable.cpp:189
std::shared_ptr< Node > Differentiate(std::shared_ptr< Variable > const &v=nullptr) const override
Definition variable.cpp:94
void SetToRandUnit()
Changes the value of the variable to be a random complex number, of magnitude 1.
Definition variable.cpp:87
void SetToRand()
Changes the value of the variable to be a random complex number.
Definition variable.cpp:78
void SetToNan()
Changes the value of the variable to be not-a-number.
Definition variable.cpp:68
std::vector< int > MultiDegree(VariableGroup const &vars) const override
Definition variable.cpp:134
bool IsHomogeneous(std::shared_ptr< Variable > const &v=nullptr) const override
Definition variable.cpp:151
Provides the differential Node class.
Defines the abstract Symbol and NamedSymbol classes,.