Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
Loading...
Searching...
No Matches
start_base.hpp
Go to the documentation of this file.
1//This file is part of Bertini 2.
2//
3//start_base.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//start_base.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 start_base.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
29#pragma once
30
32
33#include <functional>
34#include <memory>
35
36
37namespace bertini
38{
39 namespace start_system{
40
41 // forward declare so the StartSystemFactory alias / MakeStartFactory below can be defined
42 // here (they only need the StartSystem base, declared just below).
43 class StartSystem;
44
53 template<typename SystemType>
55 std::function<std::shared_ptr<StartSystem>(SystemType const&)>;
56
67 template<typename StartType, typename SystemType = bertini::System>
69 {
70 return [](SystemType const& target) -> std::shared_ptr<StartSystem> {
71 return std::make_shared<StartType>(target);
72 };
73 }
74
82 class StartSystem : public System
83 {
84
85 public:
86
87
89 virtual unsigned long long NumStartPoints() const = 0;
90
95 template<typename T>
96 Vec<T> StartPoint(unsigned long long index) const
97 {
98 return GenerateStartPoint(T(),index);
99 }
100
101 virtual ~StartSystem() = default;
102
103 private:
104 virtual Vec<complex_dbl> GenerateStartPoint(complex_dbl,unsigned long long index) const = 0;
105 virtual Vec<complex_mp> GenerateStartPoint(complex_mp,unsigned long long index) const = 0;
106
108
110 template <typename Archive>
111 void serialize(Archive& ar, const unsigned /*version*/) {
112 ar & boost::serialization::base_object<System>(*this);
113 }
115
116 };
117
118 }
119}
System()
The default constructor for a system.
Definition system.hpp:117
Abstract base class for other start systems.
Definition start_base.hpp:83
Vec< T > StartPoint(unsigned long long index) const
Get the start point at the given index, in the requested number type.
Definition start_base.hpp:96
friend class boost::serialization::access
Definition start_base.hpp:107
virtual unsigned long long NumStartPoints() const =0
Get the number of start points (an upper bound on the number of target solutions).
Definition zero_dim_solve.hpp:68
StartSystemFactory< SystemType > MakeStartFactory()
Build a StartSystemFactory that mints a concrete start system from the target.
Definition start_base.hpp:68
std::function< std::shared_ptr< StartSystem >(SystemType const &)> StartSystemFactory
A factory that builds a start system from a (prepared) target system.
Definition start_base.hpp:54
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
Provides the bertini::System class.