Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
Loading...
Searching...
No Matches
mhom.hpp
Go to the documentation of this file.
1//This file is part of Bertini 2.
2//
3//mhom.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//mhom.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 mhom.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
38
45 {
46 public:
47 MHomogeneous() = default;
48 virtual ~MHomogeneous() = default;
49
58
62 void CreateDegreeMatrix(System const& s);
63
68
72 int ChooseColumnInRow(System const& s,Vec<int>& variable_group_counter, int row, int column);
73
77 unsigned long long NumStartPoints() const override;
78
80 unsigned long long NumStartPointsForPartition(Vec<int> partition) const;
81
84
85 MHomogeneous& operator+=(System const& sys) = delete;
86
90 Mat<int> degree_matrix_; // stores degrees of all functions in all homogeneous variable groups.
91
95 std::deque< Vec<int> > valid_partitions_;
96
97
98 private:
99
105 Vec<complex_dbl> GenerateStartPoint(complex_dbl,unsigned long long index) const override;
106
112 Vec<complex_mp> GenerateStartPoint(complex_mp,unsigned long long index) const override;
113
117 template<typename T>
118 void GenerateStartPointT(Vec<T>& start_point, unsigned long long index) const;
119
120
121
122
123 std::vector< VariableGroup > var_groups_;
130 Mat<Mat<complex_mp>> linear_coeffs_;
131 std::vector< std::vector<size_t> > variable_cols_;
132 size_t num_hom_groups_ = 0;
133
134 mutable Vec<complex_mp> temp_v_mp_;
135
137
138 template <typename Archive>
139 void serialize(Archive& ar, const unsigned /*version*/)
140 {
141 // Serialize ALL persistent state. This object is broadcast to MPI workers via
142 // ZeroDimSolver::DistributeSystems (a polymorphic shared_ptr<StartSystem> archive);
143 // dropping any member leaves a worker with a hollow start system whose
144 // NumStartPoints() returns 0, sizing the per-path metadata to nothing and crashing
145 // the parallel solve. Order base-first so Boost object tracking re-links the
146 // var_groups_ shared_ptr<Variable> entries to the same Variable nodes serialized in
147 // the base System (variable_groups_/hom_variable_groups_), preserving node identity.
148 ar & boost::serialization::base_object<StartSystem>(*this);
149 ar & degree_matrix_;
151 ar & var_groups_;
152 ar & linear_coeffs_; // random factor coefficients: PRIMARY data, not recomputable
153 ar & variable_cols_;
154 ar & num_hom_groups_;
155 }
156
157 };
158 }//end start_system namespace
159}//end bertini namespace
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
std::deque< Vec< int > > valid_partitions_
Partitions used for creating start points in the multi-homogeneous start system.
Definition mhom.hpp:95
MHomogeneous(System const &s)
Constructor for making a multi-homogeneous start system from a polynomial system.
unsigned long long NumStartPoints() const override
Get the number of start points for this m-homogeneous start system.
MHomogeneous & operator*=(Nd const &n)
Multiply this start system in place by an expression node.
unsigned long long NumStartPointsForPartition(Vec< int > partition) const
Get the number of start points contributed by a given variable-group partition.
int ChooseColumnInRow(System const &s, Vec< int > &variable_group_counter, int row, int column)
Helper function that is used to find valid partitions in the degree matrix.
MHomogeneous & operator+=(System const &sys)=delete
friend class boost::serialization::access
Definition mhom.hpp:136
void GenerateValidPartitions(System const &s)
Creates all valid partitions for multi-homogeneous start system to create start points.
Mat< int > degree_matrix_
Degree matrix holding degrees for all functions in terms of all variable groups.
Definition mhom.hpp:90
void CreateDegreeMatrix(System const &s)
Creates a degree matrix for constructing the multi-homogeneous start system.
Abstract base class for other start systems.
Definition start_base.hpp:83
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
Eigen::Matrix< NumT, Eigen::Dynamic, Eigen::Dynamic > Mat
A dynamically-sized matrix of NumT.
Definition eigen_extensions.hpp:298
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.