Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
Loading...
Searching...
No Matches
total_degree_binomial.hpp
Go to the documentation of this file.
1//This file is part of Bertini 2.
2//
3//total_degree_binomial.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//total_degree_binomial.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 total_degree_binomial.hpp. If not, see <http://www.gnu.org/licenses/>.
15//
16// Copyright(C) 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
27
28#pragma once
29
32
33namespace bertini
34{
35 namespace start_system{
36
37
50 {
51 public:
53 virtual ~TotalDegreeBinomial() = default;
54
61
62
68 template<typename NumT>
69 NumT RandomValue(size_t index) const
70 {
71 // A direct read of the literal constant --- no node-level evaluation. The Complex
72 // node stores a complex_mp at its (max) creation precision; convert to NumT.
73 auto const& v = random_values_[index]->GetValue();
74 if constexpr (std::is_same<NumT, complex_dbl>::value)
75 return complex_dbl(double(v.real()), double(v.imag()));
76 else
77 return NumT(v);
78 }
79
80
84 std::vector<std::shared_ptr<node::Complex> > const& RandomValues()
85 {
86 return random_values_;
87 }
88
89
93 unsigned long long NumStartPoints() const override;
94
97
98 TotalDegreeBinomial& operator+=(System const& sys) = delete;
99
101 void SanityChecks(System const& s);
102
103 private:
104
108 void CopyDegrees(System const& s);
109
113 void SeedRandomValues(int num_functions);
114
118 void GenerateFunctions();
119
120
126 Vec<complex_dbl> GenerateStartPoint(complex_dbl,unsigned long long index) const override;
127
133 Vec<complex_mp> GenerateStartPoint(complex_mp,unsigned long long index) const override;
134
135 std::vector<std::shared_ptr<node::Complex> > random_values_;
136 std::vector<unsigned long long> degrees_;
137
138
140
141 template <typename Archive>
142 void serialize(Archive& ar, const unsigned /*version*/) {
143 ar & boost::serialization::base_object<StartSystem>(*this);
144 ar & random_values_;
145 ar & degrees_;
146 }
147
148 };
149 }
150}
System()
The default constructor for a system.
Definition system.hpp:117
std::shared_ptr< node::Node > Nd
Shorthand for a shared pointer to a generic expression-tree node.
Definition system.hpp:112
Abstract base class for other start systems.
Definition start_base.hpp:83
TotalDegreeBinomial & operator*=(Nd const &n)
Multiply this start system in place by an expression node.
TotalDegreeBinomial(System const &s)
Constructor for making a roots-of-unity start system from a polynomial system.
void SanityChecks(System const &s)
Check that the target system is suitable for a roots-of-unity start system.
NumT RandomValue(size_t index) const
Get the random value for start function with index.
Definition total_degree_binomial.hpp:69
std::vector< std::shared_ptr< node::Complex > > const & RandomValues()
Get all the random values, in their Node form.
Definition total_degree_binomial.hpp:84
unsigned long long NumStartPoints() const override
Get the number of start points for this roots-of-unity start system.
TotalDegreeBinomial & operator+=(System const &sys)=delete
friend class boost::serialization::access
Definition total_degree_binomial.hpp:139
Definition zero_dim_solve.hpp:68
Definition algorithm_builder.hpp:36
std::complex< double > complex_dbl
The double-precision complex number type.
Definition double_extensions.hpp:47
Eigen::Matrix< NumT, Eigen::Dynamic, 1 > Vec
A dynamically-sized column vector of NumT.
Definition eigen_extensions.hpp:296
bmp::number< mpc_complex_backend< 0 >, bmp::et_on > complex_mp
The arbitrary-precision complex number type.
Definition mpfr_complex.hpp:58
Defines generic start system type.
utilities for start system code.