44 template<
typename Iterator,
typename Skipper>
52 namespace phx = boost::phoenix;
62 using boost::spirit::lexeme;
63 using boost::spirit::as_string;
64 using boost::spirit::ascii::no_case;
68 std::string newton_before_name =
"tracktolbeforeeg";
69 std::string newton_during_name =
"tracktolduringeg";
72 root_rule_.name(
"config::Tolerances");
87 all_names_ = (no_case[newton_before_name] >>
':') | (no_case[newton_during_name] >>
':');
89 newton_before_endgame_.name(
"newton_before_endgame_");
90 newton_before_endgame_ = *(char_ - all_names_) >> (no_case[newton_before_name] >>
':')
91 >> mpfr_rules.number_string_[phx::bind( [](
T & num, std::string str)
94 }, _val, _1 )] >>
';';
96 newton_during_endgame_.name(
"newton_during_endgame_");
97 newton_during_endgame_ = *(char_ - all_names_) >> (no_case[newton_during_name] >>
':')
98 >> mpfr_rules.number_string_[phx::bind( [](
T & num, std::string str)
101 }, _val, _1 )] >>
';';
103 no_setting_.name(
"no_setting_");
104 no_setting_ = *(char_ - all_names_);
106 no_decl_.name(
"no_decl_");
113 qi::on_error<qi::fail>(
115 phx::bind(&
ReportParseError, _1, _2, _3, _4, std::string(
"config::Tolerances"))
125 qi::rule<Iterator, T(), ascii::space_type > newton_before_endgame_, newton_during_endgame_;
126 qi::rule<Iterator, ascii::space_type, std::string()> no_decl_, no_setting_, all_names_;
127 rules::LongNum<Iterator> mpfr_rules;
141 template<
typename Iterator,
typename Skipper>
148 namespace phx = boost::phoenix;
158 using boost::spirit::lexeme;
159 using boost::spirit::as_string;
160 using boost::spirit::ascii::no_case;
164 std::string init_prec_name =
"initialprec";
165 std::string max_cross_resolve_name =
"maxcrossedpathresolves";
166 std::string start_time_name =
"starttime";
167 std::string endgame_boundary_name =
"endgamebdry";
168 std::string target_time_name =
"targettime";
169 std::string path_variable_name_name =
"pathvarname";
172 root_rule_.name(
"config::ZeroDim");
199 >> -no_setting_) | no_setting_;
201 all_names_ = (no_case[init_prec_name] >>
':') |
202 (no_case[target_time_name] >>
':') |
203 (no_case[path_variable_name_name] >>
':') |
204 (no_case[max_cross_resolve_name] >>
':') |
205 (no_case[start_time_name] >>
':') |
206 (no_case[endgame_boundary_name] >>
':')
212 auto str_to_rational = [](
mpq_rational & num, std::string str)
224 valid_variable_name_.name(
"valid_variable_name_");
225 valid_variable_name_ = utf8_identifier_parser();
228 path_variable_name_.name(
"path_variable_name_");
229 path_variable_name_ = *(char_ - all_names_) >> (no_case[path_variable_name_name] >>
':') >> valid_variable_name_ >>
';';
231 init_prec_.name(
"init_prec_");
232 init_prec_ = *(char_ - all_names_) >> (no_case[init_prec_name] >>
':') >> qi::int_[_val=_1] >>
';';
234 max_cross_resolve_.name(
"max_cross_resolve_");
235 max_cross_resolve_ = *(char_ - all_names_) >> (no_case[max_cross_resolve_name] >>
':') >> qi::int_[_val=_1] >>
';';
237 start_time_.name(
"start_time_");
238 start_time_ = *(char_ - all_names_) >> (no_case[start_time_name] >>
':')
239 >> mpfr_rules.number_string_[phx::bind( str_to_rational, _val, _1 )] >>
';';
241 endgame_boundary_.name(
"endgame_boundary_");
242 endgame_boundary_ = *(char_ - all_names_) >> (no_case[endgame_boundary_name] >>
':')
243 >> mpfr_rules.number_string_[phx::bind( str_to_rational, _val, _1 )] >>
';';
245 target_time_.name(
"target_time_");
246 target_time_ = *(char_ - all_names_) >> (no_case[target_time_name] >>
':')
247 >> mpfr_rules.number_string_[phx::bind( str_to_rational, _val, _1 )] >>
';';
251 no_setting_.name(
"no_setting_");
252 no_setting_ = *(char_ - all_names_);
254 no_decl_.name(
"no_decl_");
260 qi::on_error<qi::fail>(
262 phx::bind(&
ReportParseError, _1, _2, _3, _4, std::string(
"config::ZeroDim"))
273 qi::rule<Iterator,
mpq_rational(), ascii::space_type > start_time_, target_time_, endgame_boundary_;
274 qi::rule<Iterator, int(), ascii::space_type > init_prec_, max_cross_resolve_;
275 qi::rule<Iterator, std::string(), ascii::space_type > valid_variable_name_, path_variable_name_;
278 qi::rule<Iterator, ascii::space_type, std::string()> no_decl_, no_setting_, all_names_;
279 rules::LongNum<Iterator> mpfr_rules;
285 template<
typename Iterator,
typename Skipper>
293 namespace phx = boost::phoenix;
303 using boost::spirit::lexeme;
304 using boost::spirit::as_string;
305 using boost::spirit::ascii::no_case;
309 std::string same_point_tol_name =
"midpathtol";
312 root_rule_.name(
"config::MidPath");
319 >> -no_setting_) | no_setting_;
321 all_names_ = (no_case[same_point_tol_name] >>
':');
323 auto str_to_T = [](
T & num, std::string str)
329 same_point_tol_.name(
"same_point_tol_");
330 same_point_tol_ = *(char_ - all_names_) >> (no_case[same_point_tol_name] >>
':')
331 >> mpfr_rules.number_string_[phx::bind( str_to_T, _val, _1 )] >>
';';
334 no_setting_.name(
"no_setting_");
335 no_setting_ = *(char_ - all_names_);
337 no_decl_.name(
"no_decl_");
343 qi::on_error<qi::fail>(
345 phx::bind(&
ReportParseError, _1, _2, _3, _4, std::string(
"config::MidPath"))
355 qi::rule<Iterator, T(), ascii::space_type > same_point_tol_;
356 qi::rule<Iterator, ascii::space_type, std::string()> no_decl_, no_setting_, all_names_;
357 rules::LongNum<Iterator> mpfr_rules;
362 template<
typename Iterator,
typename Skipper>
368 namespace phx = boost::phoenix;
372 root_rule_.name(
"config::Records");
383 template<
typename Iterator,
typename Skipper>
391 namespace phx = boost::phoenix;
401 using boost::spirit::lexeme;
402 using boost::spirit::as_string;
403 using boost::spirit::ascii::no_case;
407 std::string decrease_factor_name =
"retracktolfactor";
410 root_rule_.name(
"config::AutoRetrack");
417 >> -no_setting_) | no_setting_;
419 all_names_ = (no_case[decrease_factor_name] >>
':');
421 auto str_to_T = [](
T & num, std::string str)
427 decrease_factor.name(
"decrease_factor");
428 decrease_factor = *(char_ - all_names_) >> (no_case[decrease_factor_name] >>
':')
429 >> mpfr_rules.number_string_[phx::bind( str_to_T, _val, _1 )] >>
';';
432 no_setting_.name(
"no_setting_");
433 no_setting_ = *(char_ - all_names_);
435 no_decl_.name(
"no_decl_");
441 qi::on_error<qi::fail>(
443 phx::bind(&
ReportParseError, _1, _2, _3, _4, std::string(
"config::AutoRetrack"))
453 qi::rule<Iterator, T(), ascii::space_type > decrease_factor;
454 qi::rule<Iterator, ascii::space_type, std::string()> no_decl_, no_setting_, all_names_;
455 rules::LongNum<Iterator> mpfr_rules;
460 template<
typename Iterator,
typename Skipper>
468 namespace phx = boost::phoenix;
478 using boost::spirit::lexeme;
479 using boost::spirit::as_string;
480 using boost::spirit::ascii::no_case;
484 std::string sharpen_digits_name =
"sharpendigits";
485 std::string func_res_tol_name =
"functiontolerance";
486 std::string ratio_tol_name =
"ratiotolerance";
489 root_rule_.name(
"config::Sharpening");
504 >> -no_setting_) | no_setting_;
506 all_names_ = (no_case[sharpen_digits_name] >>
':') |
507 (no_case[func_res_tol_name] >>
':') |
508 (no_case[ratio_tol_name] >>
':')
512 auto str_to_T = [](
T & num, std::string str)
518 func_res_tol_.name(
"func_res_tol_");
519 func_res_tol_ = *(char_ - all_names_) >> (no_case[func_res_tol_name] >>
':')
520 >> mpfr_rules.number_string_[phx::bind( str_to_T, _val, _1 )] >>
';';
522 ratio_tol_.name(
"ratio_tol_");
523 ratio_tol_ = *(char_ - all_names_) >> (no_case[ratio_tol_name] >>
':')
524 >> mpfr_rules.number_string_[phx::bind( str_to_T, _val, _1 )] >>
';';
526 sharpen_digits_.name(
"sharpen_digits_");
527 sharpen_digits_ = *(char_ - all_names_) >> (no_case[sharpen_digits_name] >>
':') >> qi::uint_[_val=_1] >>
';';
531 no_setting_.name(
"no_setting_");
532 no_setting_ = *(char_ - all_names_);
534 no_decl_.name(
"no_decl_");
540 qi::on_error<qi::fail>(
542 phx::bind(&
ReportParseError, _1, _2, _3, _4, std::string(
"config::Sharpening"))
553 qi::rule<Iterator, T(), ascii::space_type > func_res_tol_, ratio_tol_;
554 qi::rule<Iterator,
unsigned int(), ascii::space_type > sharpen_digits_;
556 qi::rule<Iterator, ascii::space_type, std::string()> no_decl_, no_setting_, all_names_;
557 rules::LongNum<Iterator> mpfr_rules;
563 template<
typename Iterator,
typename Skipper>
571 namespace phx = boost::phoenix;
581 using boost::spirit::lexeme;
582 using boost::spirit::as_string;
583 using boost::spirit::ascii::no_case;
587 std::string regen_remove_inf_name =
"regenremoveinf";
588 std::string slice_before_name =
"slicetolbeforeeg";
589 std::string slice_during_name =
"slicetolduringeg";
590 std::string slice_final_name =
"slicefinaltol";
591 std::string higher_dim_check_name =
"regenhigherdimtest";
592 std::string start_level_name =
"regenstartlevel";
595 root_rule_.name(
"config::Regeneration");
622 >> -no_setting_) | no_setting_;
624 all_names_ = (no_case[regen_remove_inf_name] >>
':') |
625 (no_case[higher_dim_check_name] >>
':') |
626 (no_case[start_level_name] >>
':') |
627 (no_case[slice_before_name] >>
':') |
628 (no_case[slice_during_name] >>
':') |
629 (no_case[slice_final_name] >>
':')
633 auto str_to_T = [](
T & num, std::string str)
639 higher_dim_check_.name(
"higher_dim_check_");
640 higher_dim_check_ = *(char_ - all_names_) >> (no_case[higher_dim_check_name] >>
':') >> qi::int_[_val=_1] >>
';';
642 start_level_.name(
"start_level_");
643 start_level_ = *(char_ - all_names_) >> (no_case[start_level_name] >>
':') >> qi::int_[_val=_1] >>
';';
645 regen_remove_inf_.name(
"regen_remove_inf_");
646 regen_remove_inf_ = *(char_ - all_names_) >> (no_case[regen_remove_inf_name] >>
':') >> qi::int_[_val=_1] >>
';';
650 slice_before_.name(
"slice_before_");
651 slice_before_ = *(char_ - all_names_) >> (no_case[slice_before_name] >>
':')
652 >> mpfr_rules.number_string_[phx::bind( str_to_T, _val, _1 )] >>
';';
654 slice_during_.name(
"slice_during_");
655 slice_during_ = *(char_ - all_names_) >> (no_case[slice_during_name] >>
':')
656 >> mpfr_rules.number_string_[phx::bind( str_to_T, _val, _1 )] >>
';';
658 slice_final_.name(
"slice_final_");
659 slice_final_ = *(char_ - all_names_) >> (no_case[slice_final_name] >>
':')
660 >> mpfr_rules.number_string_[phx::bind( str_to_T, _val, _1 )] >>
';';
664 no_setting_.name(
"no_setting_");
665 no_setting_ = *(char_ - all_names_);
667 no_decl_.name(
"no_decl_");
673 qi::on_error<qi::fail>(
675 phx::bind(&
ReportParseError, _1, _2, _3, _4, std::string(
"config::Regeneration"))
686 qi::rule<Iterator, T(), ascii::space_type > slice_before_, slice_during_, slice_final_;
687 qi::rule<Iterator, int(), ascii::space_type > regen_remove_inf_, start_level_, higher_dim_check_;
689 qi::rule<Iterator, ascii::space_type, std::string()> no_decl_, no_setting_, all_names_;
690 rules::LongNum<Iterator> mpfr_rules;
697 template<
typename Iterator,
typename Skipper>
705 namespace phx = boost::phoenix;
715 using boost::spirit::lexeme;
716 using boost::spirit::as_string;
717 using boost::spirit::ascii::no_case;
721 std::string real_thresh_name =
"imagthreshold";
722 std::string endpoint_finite_name =
"endpointfinitethreshold";
723 std::string same_point_name =
"endpointsamethreshold";
724 std::string cond_num_name =
"condnumthreshold";
728 root_rule_.name(
"config::PostProcessing");
747 >> -no_setting_) | no_setting_;
749 all_names_ = (no_case[real_thresh_name] >>
':') |
750 (no_case[endpoint_finite_name] >>
':') |
751 (no_case[same_point_name] >>
':') |
752 (no_case[cond_num_name] >>
':')
756 auto str_to_T = [](
T & num, std::string str)
761 real_threshold_.name(
"real_thresh_");
762 real_threshold_ = *(char_ - all_names_) >> (no_case[real_thresh_name] >>
':')
763 >> mpfr_rules.number_string_[phx::bind( str_to_T, _val, _1 )] >>
';';
765 endpoint_finite_.name(
"endpoint_finite_");
766 endpoint_finite_ = *(char_ - all_names_) >> (no_case[endpoint_finite_name] >>
':')
767 >> mpfr_rules.number_string_[phx::bind( str_to_T, _val, _1 )] >>
';';
769 same_point_.name(
"same_point_");
770 same_point_ = *(char_ - all_names_) >> (no_case[same_point_name] >>
':')
771 >> mpfr_rules.number_string_[phx::bind( str_to_T, _val, _1 )] >>
';';
773 cond_num_.name(
"cond_num_");
774 cond_num_ = *(char_ - all_names_) >> (no_case[cond_num_name] >>
':')
775 >> mpfr_rules.number_string_[phx::bind( str_to_T, _val, _1 )] >>
';';
779 no_setting_.name(
"no_setting_");
780 no_setting_ = *(char_ - all_names_);
782 no_decl_.name(
"no_decl_");
788 qi::on_error<qi::fail>(
790 phx::bind(&
ReportParseError, _1, _2, _3, _4, std::string(
"config::PostProcessing"))
801 qi::rule<Iterator, T(), ascii::space_type > real_threshold_, endpoint_finite_, same_point_, cond_num_;
803 qi::rule<Iterator, ascii::space_type, std::string()> no_decl_, no_setting_, all_names_;
804 rules::LongNum<Iterator> mpfr_rules;
812 template<
typename Iterator,
typename Skipper>
820 namespace phx = boost::phoenix;
830 using boost::spirit::lexeme;
831 using boost::spirit::as_string;
832 using boost::spirit::ascii::no_case;
846 std::string setting_name =
"tracktype";
849 root_rule_.name(
"config::classic::AlgoChoice");
851 root_rule_ = config_name_[_val = _1] >> -no_setting_
854 config_name_.name(
"tracktype_");
855 config_name_ = *(char_ - (no_case[setting_name] >>
':')) >> (no_case[setting_name] >>
':') >> tracktype_[_val = _1] >>
';';
857 no_setting_.name(
"no_setting_");
858 no_setting_ = *(char_ - no_case[setting_name]);
860 no_decl_.name(
"no_decl_");
866 qi::on_error<qi::fail>(
868 phx::bind(&
ReportParseError, _1, _2, _3, _4, std::string(
"config::classic::AlgoChoice"))
878 qi::rule<Iterator, ascii::space_type, std::string()> no_decl_, no_setting_;
880 qi::symbols<char,algorithm::classic::AlgoChoice> tracktype_;
887 template<
typename Iterator,
typename Skipper>
889 struct ConfigSettingParser<Iterator,
algorithm::classic::EndgameChoiceConfig, Skipper> : qi::grammar<Iterator, algorithm::classic::EndgameChoiceConfig(), Skipper>
893 namespace phx = boost::phoenix;
900 using boost::spirit::ascii::no_case;
906 std::string setting_name =
"endgamenum";
909 enum_rule_.name(
"endgamechoice_");
910 enum_rule_ = *(char_ - (no_case[setting_name] >>
':')) >> (no_case[setting_name] >>
':') >> endgamechoice_[_val = _1] >>
';';
912 root_rule_.name(
"config::classic::EndgameChoiceConfig");
921 no_setting_.name(
"no_setting_");
922 no_setting_ = *(char_ - no_case[setting_name]);
924 no_decl_.name(
"no_decl_");
927 qi::on_error<qi::fail>(
929 phx::bind(&
ReportParseError, _1, _2, _3, _4, std::string(
"config::classic::EndgameChoiceConfig"))
936 qi::rule<Iterator, ascii::space_type, std::string()> no_decl_, no_setting_;
938 qi::symbols<char, algorithm::classic::EndgameChoice> endgamechoice_;
Provides the base type for config settings parsers.
AlgoChoice
Definition config.hpp:49
@ IsosingularStab
Definition config.hpp:60
@ NewtonIteration
Definition config.hpp:52
@ MembershipTest
Definition config.hpp:57
@ ZeroDim
Definition config.hpp:54
@ WitnessSetProjection
Definition config.hpp:59
@ NewtonIterationCondNum
Definition config.hpp:53
@ SampleComponent
Definition config.hpp:56
@ EvalFunctions
Definition config.hpp:50
@ ExtractWitnessSet
Definition config.hpp:58
@ NID
Definition config.hpp:55
@ EvalFunctionJacobian
Definition config.hpp:51
EndgameChoice
Definition config.hpp:37
@ Cauchy
Definition config.hpp:39
@ PowerSeries
Definition config.hpp:38
Definition algorithm_base.hpp:34
Definition classic_utilities.hpp:41
void ReportParseError(std::string::const_iterator begin, std::string::const_iterator end, std::string::const_iterator err_pos, boost::spirit::info const &what, std::string const &parser_name)
Report a parse error (via FormatParseError) to the log, for use in a Spirit on_error handler.
Definition qi_files.hpp:199
Definition classic_utilities.hpp:40
Definition algorithm_builder.hpp:36
boost::multiprecision::number< boost::multiprecision::mpfr_float_backend< 0 >, boost::multiprecision::et_on > real_mp
The arbitrary-precision real number type.
Definition mpfr_extensions.hpp:53
boost::multiprecision::number< boost::multiprecision::backends::gmp_rational, boost::multiprecision::et_on > mpq_rational
The exact rational number type.
Definition mpfr_extensions.hpp:55
Numeric traits for a bertini number type: digit counts, conversions, and companion types.
Definition num_traits.hpp:57
Configuration for auto-retracking paths flagged as crossed.
Definition config.hpp:90
T midpath_decrease_tolerance_factor
Factor by which tracking tolerances are tightened when re-tracking a crossed path.
Definition config.hpp:93
Configuration for the midpath (path-crossing) check.
Definition config.hpp:80
T same_point_tolerance
Two boundary points are "the same" if within this tolerance.
Definition config.hpp:83
Configuration for post-processing solutions (reality/finiteness/singularity classification).
Definition config.hpp:140
T endpoint_finite_threshold
Bertini 1's EndpointFiniteThreshold. An endpoint is considered to be at infinity if the infinity norm...
Definition config.hpp:145
T real_threshold
Bertini 1's ImagThreshold. Threshold on the imaginary part of a (dehomogenized) solution coordinate b...
Definition config.hpp:143
T condition_number_threshold
Bertini 1's CondNumThreshold. An endpoint is considered singular if it is the endpoint of multiple pa...
Definition config.hpp:149
T same_point_tolerance_multiplier
Bertini 1's EndpointSameThreshold. A multiplier (>= 1) on final_tolerance: two endpoints are consider...
Definition config.hpp:147
How a recording algorithm uses the records it finds: not what to compute, but what already-recorded w...
Definition config.hpp:197
Configuration for the regeneration cascade.
Definition config.hpp:116
unsigned start_level
The regeneration level to start from.
Definition config.hpp:122
bool remove_infinite_endpoints
Bool indicating whether endpoints during the regeneration start point buildup step which are infinite...
Definition config.hpp:119
T slice_newton_before_endgame
Slice-moving tracking tolerance before the endgame. SliceTolBeforeEG.
Definition config.hpp:132
T slice_newton_during_endgame
Slice-moving tracking tolerance during the endgame. SliceTolDuringEG.
Definition config.hpp:133
T slice_final_tolerance
Final tolerance to track the slice move to, using the endgame. SliceFinalTol.
Definition config.hpp:134
bool higher_dimension_check
RegenHigherDimTest.
Definition config.hpp:121
Configuration for sharpening computed solutions.
Definition config.hpp:100
unsigned sharpendigits
how many digits should be correct after sharpening. 0 = do not sharpen, which is Bertini 1's default....
Definition config.hpp:103
T function_residual_tolerance
A polynomial (or any function, really) evaluated at a point is considered to be 0 if the magnitude is...
Definition config.hpp:107
T ratio_tolerance
A computed value is considered to be zero if the ratio of two different approximations is smaller tha...
Definition config.hpp:109
Newton and path-tracking tolerances.
Definition config.hpp:69
T newton_before_endgame
Newton tolerance before the endgame (E.4.1).
Definition config.hpp:72
T newton_during_endgame
Newton tolerance during the endgame (E.4.2).
Definition config.hpp:73
Top-level configuration for a zero-dimensional solve (times, precision, threading).
Definition config.hpp:212
mpq_rational start_time
Homotopy start time (t=1).
Definition config.hpp:243
std::string path_variable_name
Name given to the homotopy's path variable.
Definition config.hpp:247
mpq_rational target_time
Homotopy target time (t=0).
Definition config.hpp:245
unsigned initial_ambient_precision
Initial ambient (working) precision for the solve.
Definition config.hpp:215
unsigned max_num_crossed_path_resolve_attempts
The maximum number of times to attempt to re-solve crossed paths at the endgame boundary.
Definition config.hpp:216
mpq_rational endgame_boundary
Time at which tracking hands off to the endgame (t=1/10).
Definition config.hpp:244
Selects which endgame to use (classic input).
Definition config.hpp:44
EndgameChoice endgame
The chosen endgame. Power series is Bertini 1's documented default (EndgameNum 1); see ADR-0058.
Definition config.hpp:45
double T
The number type used by this parser.
Definition algorithm.hpp:387
ConfigSettingParser()
Definition algorithm.hpp:389
double T
The number type used by this parser.
Definition algorithm.hpp:289
ConfigSettingParser()
Definition algorithm.hpp:291
double T
The number type used by this parser.
Definition algorithm.hpp:701
ConfigSettingParser()
Definition algorithm.hpp:703
ConfigSettingParser()
Definition algorithm.hpp:366
double T
The number type used by this parser.
Definition algorithm.hpp:567
ConfigSettingParser()
Definition algorithm.hpp:569
double T
The number type used by this parser.
Definition algorithm.hpp:464
ConfigSettingParser()
Definition algorithm.hpp:466
double T
The number type used by this parser.
Definition algorithm.hpp:48
ConfigSettingParser()
Definition algorithm.hpp:50
ConfigSettingParser()
Definition algorithm.hpp:146
ConfigSettingParser()
Definition algorithm.hpp:891
ConfigSettingParser()
Definition algorithm.hpp:818
double T
The number type used by this parser.
Definition algorithm.hpp:816