53template <
typename ComplexT>
85template <
typename ComplexT>
89 unsigned max_iterations,
90 ComplexT time = ComplexT(0))
94 if (n_funcs != n_vars)
97 ss <<
"NewtonRefine requires a SQUARE system, but this one has "
98 << n_funcs <<
" total functions (user functions plus patches) over "
99 << n_vars <<
" variables. Square an overdetermined system by "
100 <<
"randomization (multiply by a generic full-rank matrix) before refining.";
101 throw std::runtime_error(ss.str());
103 if (start.size() !=
static_cast<Eigen::Index
>(n_vars))
105 std::stringstream ss;
106 ss <<
"NewtonRefine: start point has " << start.size()
107 <<
" coordinates but the system has " << n_vars <<
" variables.";
108 throw std::runtime_error(ss.str());
122 for (
unsigned it = 0; it < max_iterations; ++it)
137 result.
point -= step;
140 step.template lpNorm<Eigen::Infinity>());
The fundamental polynomial system class for Bertini2.
Definition system.hpp:106
void SetAndReset(Vec< T > const &new_space, T const &new_time) const
Stage the system's current point (variables and path value) for a subsequent Eval/Jacobian.
Definition system.hpp:964
void EvalInPlace(Vec< T > &function_values) const
Evaluate the system using the previously set variable (and time) values, in place.
Definition system.hpp:213
void JacobianInPlace(Mat< T > &J) const
Evaluate the Jacobian matrix of the system, using the previous space and time values,...
Definition system.hpp:413
bool HavePathVariable() const
Query whether a path variable is set for this system.
size_t NumVariables() const
Get the total number of variables in this system, including homogenizing variables.
size_t NumTotalFunctions() const
Get the total number of functions, including patches.
Stateful partial-pivot LU factor/solve with preallocated, precision-adjustable banks.
Definition lu_solver.hpp:58
void ChangeSize(unsigned n)
(Re)size the workspace to hold n x n systems.
Definition lu_solver.hpp:65
MatrixSuccessCode Factor(Mat< NumT > const &A)
Factor a copy of A with partial pivoting; A is preserved.
Definition lu_solver.hpp:90
void Solve(Vec< NumT > const &b, Eigen::MatrixBase< OutDerived > const &x_out) const
Solve A x = b using the stored factors.
Definition lu_solver.hpp:111
A stateful partial-pivot LU solver that owns precision-adjustable temporary banks.
Definition algorithm_base.hpp:34
NewtonRefineResult< ComplexT > NewtonRefine(System const &S, Vec< ComplexT > const &start, NumErrorT tolerance, unsigned max_iterations, ComplexT time=ComplexT(0))
Newton-refine a point against a square System, without a tracker.
Definition newton_refine.hpp:86
Definition algorithm_builder.hpp:36
@ Success
The decomposition looks healthy.
Definition eigen_extensions.hpp:465
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
double NumErrorT
The numeric type used to hold error/tolerance magnitudes throughout Bertini2 – tracking tolerances,...
Definition num_traits.hpp:48
SuccessCode
Definition config.hpp:42
@ FailedToConverge
Definition config.hpp:55
@ Success
Definition config.hpp:51
@ MatrixSolveFailure
Definition config.hpp:56
The outcome of a standalone Newton refinement.
Definition newton_refine.hpp:55
SuccessCode code
Success when the step norm reached the tolerance; FailedToConverge or MatrixSolveFailure otherwise.
Definition newton_refine.hpp:56
unsigned iterations
Number of Newton iterations taken.
Definition newton_refine.hpp:59
Vec< ComplexT > point
The refined point (the best iterate reached, even on failure).
Definition newton_refine.hpp:57
NumErrorT achieved
Infinity norm of the last Newton step – the consecutive-approximation agreement actually achieved.
Definition newton_refine.hpp:58
Provides the bertini::System class.