Bertini 2 - C++ Core
Software for Numerical Algebraic Geometry
Loading...
Searching...
No Matches
differential.hpp
Go to the documentation of this file.
1//This file is part of Bertini 2.
2//
3//differential.hpp is free software: you can redistribute it and/or modify
4//it under the terms of the GNU General Public License as published by
5//the Free Software Foundation, either version 3 of the License, or
6//(at your option) any later version.
7//
8//differential.hpp is distributed in the hope that it will be useful,
9//but WITHOUT ANY WARRANTY; without even the implied warranty of
10//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11//GNU General Public License for more details.
12//
13//You should have received a copy of the GNU General Public License
14//along with differential.hpp. If not, see <http://www.gnu.org/licenses/>.
15//
16// Copyright(C) 2015 - 2021 by Bertini2 Development Team
17//
18// See <http://www.gnu.org/licenses/> for a copy of the license,
19// as well as COPYING. Bertini2 is provided with permitted
20// additional terms in the b2/licenses/ directory.
21
22// individual authors of this file include:
23// James Collins
24// West Texas A&M University
25// Spring, Summer 2015
26//
27// silviana amethyst, university of wisconsin-eau claire
28//
29// Created by Collins, James B. on 4/30/15.
30//
31//
32// differential.hpp: Declares the class SpecialNumber.
33
40
41#ifndef BERTINI_NODE_DIFFERENTIAL_HPP
42#define BERTINI_NODE_DIFFERENTIAL_HPP
43
44#include <memory>
48
49
50
51namespace bertini {
52namespace node{
53 class Variable;
54
55
61 class Differential : public virtual NamedSymbol, public virtual EnableSharedFromThisVirtual<Differential>
62 {
63 public:
64 BERTINI_DEFAULT_VISITABLE()
65
66
67 template<typename... Ts>
68 static
69 std::shared_ptr<Differential> Make(Ts&& ...ts){
70 return std::shared_ptr<Differential>( new Differential(ts...) );
71 }
72
73
74 private:
78 Differential(std::shared_ptr<const Variable> diff_variable, std::string var_name);
79
80 public:
81
82 void Reset() const override;
83
84
85 const std::shared_ptr<const Variable>& GetVariable() const;
86
87
88 void print(std::ostream & target) const override;
89
90
91
95 std::shared_ptr<Node> Differentiate(std::shared_ptr<Variable> const& v = nullptr) const override;
96
97 virtual ~Differential() = default;
98
99
100
101
105 int Degree(std::shared_ptr<Variable> const& v = nullptr) const override;
106
107 int Degree(VariableGroup const& vars) const override;
108
109 std::vector<int> MultiDegree(VariableGroup const& vars) const override;
110
111 void Homogenize(VariableGroup const& vars, std::shared_ptr<Variable> const& homvar) override;
112
113 bool IsHomogeneous(std::shared_ptr<Variable> const& v = nullptr) const override;
114
118 bool IsHomogeneous(VariableGroup const& vars) const override;
119
120
126 void precision(unsigned int prec) const override;
127
128
129 protected:
130 // This should never be called for a Differential. Only for Jacobians.
131 dbl FreshEval_d(std::shared_ptr<Variable> const& diff_variable) const override;
132
133 void FreshEval_d(dbl& evaluation_value, std::shared_ptr<Variable> const& diff_variable) const override;
134
135
136 mpfr_complex FreshEval_mp(std::shared_ptr<Variable> const& diff_variable) const override;
137
138 void FreshEval_mp(mpfr_complex& evaluation_value, std::shared_ptr<Variable> const& diff_variable) const override;
139
140
141
142 private:
143 Differential() = default;
144 std::shared_ptr<const Variable> differential_variable_;
145
146
147 friend class boost::serialization::access;
148
149 template<class Archive>
150 void save(Archive & ar, const unsigned int version) const
151 {
152 ar & boost::serialization::base_object<NamedSymbol>(*this);
153 ar & differential_variable_;
154 // ar & const_cast<std::shared_ptr<const Variable> >(differential_variable_);
155 }
156
157 template<class Archive>
158 void load(Archive & ar, const unsigned int version)
159 {
160 ar & boost::serialization::base_object<NamedSymbol>(*this);
161 ar & std::const_pointer_cast<Variable>(differential_variable_);
162 }
163
164 // BOOST_SERIALIZATION_SPLIT_MEMBER()
165
166 };
167
168} // re: namespace node
169} // re: namespace bertini
170
171#endif
bool IsHomogeneous(std::shared_ptr< Variable > const &v=nullptr) const override
Definition differential.cpp:84
int Degree(std::shared_ptr< Variable > const &v=nullptr) const override
Definition differential.cpp:64
void precision(unsigned int prec) const override
Definition differential.cpp:103
std::vector< int > MultiDegree(VariableGroup const &vars) const override
Definition differential.cpp:74
mpfr_complex FreshEval_mp(std::shared_ptr< Variable > const &diff_variable) const override
Definition differential.cpp:135
void Homogenize(VariableGroup const &vars, std::shared_ptr< Variable > const &homvar) override
Definition differential.cpp:79
std::shared_ptr< Node > Differentiate(std::shared_ptr< Variable > const &v=nullptr) const override
Definition differential.cpp:55
dbl FreshEval_d(std::shared_ptr< Variable > const &diff_variable) const override
Definition differential.cpp:110
void Reset() const override
Definition differential.cpp:39
void print(std::ostream &target) const override
Definition differential.cpp:49
NamedSymbol(const std::string &new_name)
Definition symbol.cpp:54
Represents variable leaves in the function tree.
Definition variable.hpp:59
Defines the abstract Node base class.
Provides the Number Node types, including Rational, Float, and Integer.
Defines the abstract Symbol and NamedSymbol classes,.