LMCAS
Lamina Computer Algebra System
载入中...
搜索中...
未找到
LMCAS::detail::anonymous_namespace{exact_root.cpp} 命名空间参考

函数

ApproxReal approximate_component (const Rational &lower, const Rational &upper)
Result< ApproxReal > approximate_real_isolation (ExactRealAlgebraic isolation, const NumericEvaluationOptions &options, ComputationContext &context, const std::string &operation)
double conversion_ulp (double value)
bool valid_options (const NumericEvaluationOptions &options)

函数说明

◆ approximate_component()

ApproxReal LMCAS::detail::anonymous_namespace{exact_root.cpp}::approximate_component ( const Rational & lower,
const Rational & upper )

在文件 exact_root.cpp 第 79 行定义.

81 {
82 const double lower_value = lower.to_double();
83 const double upper_value = upper.to_double();
84 const double value =
85 lower_value + (upper_value - lower_value) * 0.5;
86 const double error = std::abs(upper_value - lower_value) * 0.5 +
87 conversion_ulp(lower_value) + conversion_ulp(upper_value) +
90}
__attribute__((visibility("default"))) ExprResult function(const std __attribute__((visibility("default"))) ExprResult finite_set(std ExprPtr upper
const ExprPtr & lower
const std::string const ExprPtr & value

引用了 approximate_component(), conversion_ulp(), LMCAS::Finite, LMCAS::lower, LMCAS::upper , 以及 LMCAS::value.

被这些函数引用 approximate_component().

函数调用图:
这是这个函数的调用关系图:

◆ approximate_real_isolation()

Result< ApproxReal > LMCAS::detail::anonymous_namespace{exact_root.cpp}::approximate_real_isolation ( ExactRealAlgebraic isolation,
const NumericEvaluationOptions & options,
ComputationContext & context,
const std::string & operation )

在文件 exact_root.cpp 第 37 行定义.

41 {
42 while (isolation.lower != isolation.upper) {
43 const bool positive = isolation.lower > Rational(0) &&
44 isolation.upper <= Rational(2) * isolation.lower;
45 const bool negative = isolation.upper < Rational(0) &&
46 isolation.lower >= Rational(2) * isolation.upper;
47 if (positive || negative) break;
48 auto narrowed = refine_exact_real_algebraic(isolation, context, operation);
49 if (!narrowed) return Result<ApproxReal>::failure(narrowed.error());
50 }
51 const double scale = std::min(
52 std::abs(isolation.lower.to_double()), std::abs(isolation.upper.to_double()));
53 const double absolute_tolerance = std::min(
54 options.absolute_tolerance,
55 std::max(std::numeric_limits<double>::denorm_min(),
56 options.relative_tolerance * scale));
58 isolation, absolute_tolerance, options.relative_tolerance,
60 if (!refined) return Result<ApproxReal>::failure(refined.error());
61 const double lower = isolation.lower.to_double();
62 const double upper = isolation.upper.to_double();
63 const double value = lower + (upper - lower) * 0.5;
64 const double error = std::abs(upper - lower) * 0.5 +
67 if (!std::isfinite(value) || !std::isfinite(error) ||
68 (value == 0.0 &&
69 (isolation.lower > Rational(0) || isolation.upper < Rational(0)))) {
72 "certified root enclosure could not be represented as finite double",
73 operation);
74 }
77}
static Result failure(CasErrc code, std::string message, std::string operation={})
static Result success(T value)
Result< void > refine_exact_real_algebraic_to_tolerance(ExactRealAlgebraic &value, double absolute_tolerance, double relative_tolerance, ComputationContext &context, const std::string &operation)
Result< void > refine_exact_real_algebraic(ExactRealAlgebraic &value, ComputationContext &context, const std::string &operation)
ComputationContext const std::string & operation
std::size_t std::size_t ComputationContext & context
const std::string ComputationContext const SolveOptions & options

引用了 LMCAS::detail::absolute_tolerance, approximate_real_isolation(), LMCAS::detail::context, conversion_ulp(), LMCAS::Result< T >::failure(), LMCAS::Finite, LMCAS::detail::ExactRealAlgebraic::lower, LMCAS::lower, LMCAS::NumericFailure, LMCAS::detail::operation, LMCAS::options, LMCAS::detail::refine_exact_real_algebraic(), LMCAS::detail::refine_exact_real_algebraic_to_tolerance(), LMCAS::Result< T >::success(), LMCAS::detail::ExactRealAlgebraic::upper, LMCAS::upper , 以及 LMCAS::value.

被这些函数引用 approximate_real_isolation().

函数调用图:
这是这个函数的调用关系图:

◆ conversion_ulp()

double LMCAS::detail::anonymous_namespace{exact_root.cpp}::conversion_ulp ( double value)

在文件 exact_root.cpp 第 19 行定义.

19 {
20 if (!std::isfinite(value)) {
21 return std::numeric_limits<double>::infinity();
22 }
23 const double upward = std::nextafter(
24 value, std::numeric_limits<double>::infinity());
25 const double downward = std::nextafter(
26 value, -std::numeric_limits<double>::infinity());
27 double spacing = 0.0;
28 if (std::isfinite(upward)) {
29 spacing = std::max(spacing, std::abs(upward - value));
30 }
31 if (std::isfinite(downward)) {
32 spacing = std::max(spacing, std::abs(value - downward));
33 }
34 return spacing;
35}

引用了 conversion_ulp() , 以及 LMCAS::value.

被这些函数引用 approximate_component(), approximate_real_isolation() , 以及 conversion_ulp().

函数调用图:
这是这个函数的调用关系图:

◆ valid_options()

bool LMCAS::detail::anonymous_namespace{exact_root.cpp}::valid_options ( const NumericEvaluationOptions & options)

在文件 exact_root.cpp 第 12 行定义.

12 {
13 return options.absolute_tolerance > 0.0 &&
14 options.relative_tolerance > 0.0 &&
15 std::isfinite(options.absolute_tolerance) &&
16 std::isfinite(options.relative_tolerance);
17}

引用了 LMCAS::options , 以及 valid_options().

被这些函数引用 valid_options().

函数调用图:
这是这个函数的调用关系图: