Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
Loading...
Searching...
No Matches
numerical_irreducible_decomposition.hpp
Go to the documentation of this file.
1//This file is part of Bertini 2.
2//
3//bertini2/nag_algorithms/numerical_irreducible_decomposition.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//bertini2/nag_algorithms/numerical_irreducible_decomposition.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 bertini2/nag_algorithms/numerical_irreducible_decomposition.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
22
28
29
30
31#pragma once
32
34
36#include "bertini2/tracking.hpp"
37
40
43
45
46#include <stdexcept>
47
48
49namespace bertini {
50
51 namespace algorithm {
52
53
62template< typename TrackerType, typename EndgameType,
63 typename SystemType = System >
65
66
67
74template< typename TrackerType, typename EndgameType,
75 typename SystemType >
89
90
91
93struct AnyNID : public virtual AnyAlgorithm
94{
95 virtual ~AnyNID() = default;
96};
97
98
99
109template< typename TrackerType, typename EndgameType,
110 typename SystemType >
112 public virtual AnyNID,
113 public detail::Configured<
114 typename AlgoTraits< NumericalIrreducibleDecomposition<TrackerType, EndgameType, SystemType> >::NeededConfigs>
115{
116 // these usings are for getters in python
117 using TrackerT = TrackerType;
118 using EndgameT = EndgameType;
119 using SystemT = SystemType;
120
121
125
130 using Config::Get;
131
132
137
139
140 // NID owns a cloned target system directly (no policy).
142 const SystemType& TargetSystem() const { return target_system_; }
144 SystemType& TargetSystem() { return target_system_; }
145
146
148
152 NumericalIrreducibleDecomposition(SystemType const& target)
153 : target_system_(Clone(target)), tracker_(TargetSystem()), endgame_(tracker_)
154 {
155 DefaultSetup();
156 }
157
159
160
162
166 void Run() override
167 {
168 Solve();
169 }
170
176 void Solve()
177 {
178 throw std::runtime_error("NumericalIrreducibleDecomposition is not yet implemented");
179 }
180
187 {
188 throw std::runtime_error("NumericalIrreducibleDecomposition::RegenerativeCascade is not yet implemented");
189 }
190
195 {
196 return decomposition_;
197 }
198
199
201
203 const TrackerType& GetTracker() const
204 {
205 return tracker_;
206 }
207
209 TrackerType& GetTracker()
210 {
211 return tracker_;
212 }
213
215 const EndgameType& GetEndgame() const
216 {
217 return endgame_;
218 }
219
221 EndgameType& GetEndgame()
222 {
223 return endgame_;
224 }
225
226
228
230 {
233 }
234
239 {
240 this->template Set<Regeneration>(Regeneration());
241 this->template Set<Tolerances>(Tolerances());
242 this->template Set<Sharpening>(Sharpening());
243 this->template Set<PostProcessing>(PostProcessing());
244 }
245
248 {
249 // homogenize + patch the owned target (the old CloneTarget::SystemSetup; a no-op of effect
250 // since Solve() throws, but kept so the prepared target is consistent if ever inspected).
251 target_system_.Homogenize();
252 target_system_.AutoPatch();
253 }
254
255
256private:
257 SystemType target_system_;
258 TrackerType tracker_;
259 EndgameType endgame_;
260 ResultT decomposition_;
261};
262
263
264 } // ns algorithm
265
266} // ns bertini
provides a common base type for algorithms to inherit from, for the abstraction layer above for calli...
The NID data type for Bertini2.
Definition numerical_irreducible_decomposition.hpp:49
Contains the detail/configured helper type, for templated getting/setting/storage of config structs.
Provides the NumericalIrreducibleDecomposition data type for Bertini2.
Definition algorithm_base.hpp:34
Definition algorithm_builder.hpp:36
System Clone(System const &sys)
Do a deep clone of the system.
Provides an Eigen-like NumTraits struct for querying traits of a number type.
Contains the observable base types.
typename tracking::TrackerTraits< TrackerType >::BaseComplexT BaseComplexT
The complex number type of the tracker.
Definition numerical_irreducible_decomposition.hpp:79
typename tracking::TrackerTraits< TrackerType >::BaseRealT BaseRealT
The real number type of the tracker.
Definition numerical_irreducible_decomposition.hpp:78
detail::TypeList< RegenerationConfig, TolerancesConfig, SharpeningConfig, PostProcessingConfig > NeededConfigs
The config types this algorithm reads (drives the reusable Python config interface).
Definition numerical_irreducible_decomposition.hpp:82
Definition config.hpp:271
Type-erased base for all nag algorithms, exposing a single Run() entry point.
Definition algorithm_base.hpp:46
Type-erased base for the Numerical Irreducible Decomposition algorithm.
Definition numerical_irreducible_decomposition.hpp:94
virtual ~AnyNID()=default
forward declare of the NumericalIrreducibleDecomposition algorithm.
Definition numerical_irreducible_decomposition.hpp:115
detail::Configured< typename AlgoTraits< NumericalIrreducibleDecomposition< TrackerType, EndgameType, SystemType > >::NeededConfigs > Config
The Configured base storing this algorithm's configuration structs.
Definition numerical_irreducible_decomposition.hpp:127
RegenerationConfig Regeneration
Regeneration configuration type.
Definition numerical_irreducible_decomposition.hpp:133
typename tracking::TrackerTraits< TrackerType >::BaseRealT BaseRealT
The real number type of the tracker.
Definition numerical_irreducible_decomposition.hpp:124
TrackerType & GetTracker()
Definition numerical_irreducible_decomposition.hpp:209
const ResultT & GetDecomposition() const
Get the most recently computed decomposition.
Definition numerical_irreducible_decomposition.hpp:194
void DefaultSettingsSetup()
Fills the configs from default values.
Definition numerical_irreducible_decomposition.hpp:238
const TrackerType & GetTracker() const
tracker / endgame access
Definition numerical_irreducible_decomposition.hpp:203
SystemType & TargetSystem()
Definition numerical_irreducible_decomposition.hpp:144
SystemType SystemT
The system type.
Definition numerical_irreducible_decomposition.hpp:119
void DefaultSystemSetup()
Homogenize and patch the owned target system to its default working form.
Definition numerical_irreducible_decomposition.hpp:247
NumericalIrreducibleDecomposition(SystemType const &target)
constructors
Definition numerical_irreducible_decomposition.hpp:152
EndgameType & GetEndgame()
Definition numerical_irreducible_decomposition.hpp:221
typename tracking::TrackerTraits< TrackerType >::BaseComplexT BaseComplexT
a bunch of using statements to reduce typing.
Definition numerical_irreducible_decomposition.hpp:123
void Run() override
the main functions
Definition numerical_irreducible_decomposition.hpp:166
const EndgameType & GetEndgame() const
Definition numerical_irreducible_decomposition.hpp:215
const SystemType & TargetSystem() const
Definition numerical_irreducible_decomposition.hpp:142
void Solve()
Perform the numerical irreducible decomposition.
Definition numerical_irreducible_decomposition.hpp:176
TolerancesConfig Tolerances
Tolerances configuration type.
Definition numerical_irreducible_decomposition.hpp:134
void DefaultSetup()
setup functions
Definition numerical_irreducible_decomposition.hpp:229
EndgameType EndgameT
The endgame type.
Definition numerical_irreducible_decomposition.hpp:118
ResultT RegenerativeCascade()
Run the regenerative cascade.
Definition numerical_irreducible_decomposition.hpp:186
SharpeningConfig Sharpening
Sharpening configuration type.
Definition numerical_irreducible_decomposition.hpp:135
PostProcessingConfig PostProcessing
Post-processing configuration type.
Definition numerical_irreducible_decomposition.hpp:136
nag_datatype::NumericalIrreducibleDecomposition< BaseComplexT > ResultT
The decomposition result type.
Definition numerical_irreducible_decomposition.hpp:138
TrackerType TrackerT
The path-tracker type.
Definition numerical_irreducible_decomposition.hpp:117
Configuration for post-processing solutions (reality/finiteness/singularity classification).
Definition config.hpp:140
Configuration for the regeneration cascade.
Definition config.hpp:116
Configuration for sharpening computed solutions.
Definition config.hpp:100
Newton and path-tracking tolerances.
Definition config.hpp:69
This templated struct allows one to provide a variable typelist of config structs (or anything else f...
Definition configured.hpp:83
const T & Get() const
Get the held configuration object of type T.
Definition configured.hpp:94
A basic typelist, in the style of Modern C++ Design, but using variadic templates.
Definition typelist.hpp:42
Trait lookup mapping a tracker type to its numeric types, event-emitter type, precision config,...
Definition config.hpp:387
Includes all files for tracking in Bertini2.
Contains the visitable base types.