LMCAS
Lamina Computer Algebra System
Toggle main menu visibility
载入中...
搜索中...
未找到
numeric_evaluation.hpp
浏览该文件的文档.
1
#pragma once
2
3
#include "
numeric_value.hpp
"
4
#include <string>
5
#include <unordered_map>
6
7
#include "
computation_context.hpp
"
8
#include "
lmcas_export.hpp
"
9
10
namespace
LMCAS
{
11
12
class
SymbolicExpr;
13
14
using
NumericBindings
= std::unordered_map<std::string, double>;
15
16
/**
17
* @brief Evaluate a real expression using explicit symbol bindings and a computation context.
18
*
19
* Square roots of one or two real squares are evaluated as absolute values
20
* or hypot, avoiding intermediate overflow and underflow in norm expressions.
21
*
22
* @see ISO C11 committee draft N1570, 7.12.7.3 (hypot).
23
* https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
24
*
25
* Exact numeric exponents retain their integer classification and parity on
26
* negative real bases. Non-integral powers of negative real values report
27
* DomainError rather than rounding the exponent into the integer domain.
28
*
29
* @see ISO C11 committee draft N1570, 7.12.7.4 (pow).
30
* https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
31
*
32
* Complex phase on a real argument embeds the value as x + i(+0) and evaluates
33
* its principal argument with atan2(+0, x). Negative reals, including negative
34
* zero and negative-infinity bindings, therefore have phase +pi; positive reals
35
* and positive zero have phase +0. Argument-evaluation failures propagate through Result.
36
*
37
* @see ISO C11 committee draft N1570, 7.3.9.1 (carg), principal argument.
38
* https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
39
*/
40
LMCAS_API
Result<ApproxReal>
evaluate_numeric
(
const
SymbolicExpr& expression,
41
const
NumericBindings
&
bindings
,
42
ComputationContext
&
context
);
43
44
inline
Result<ApproxReal>
evaluate_numeric
(
const
SymbolicExpr& expression,
45
const
NumericBindings
&
bindings
= {}) {
46
ComputationContext
context
;
47
return
evaluate_numeric
(expression,
bindings
,
context
);
48
}
49
50
}
// namespace LMCAS
LMCAS::ComputationContext
定义
computation_context.hpp:99
LMCAS::Result
定义
result.hpp:39
computation_context.hpp
lmcas_export.hpp
LMCAS_API
#define LMCAS_API
定义
lmcas_export.hpp:13
LMCAS
定义
assumption.hpp:11
LMCAS::context
const std::vector< Polynomial< BigInt > > const BigInt ComputationContext & context
定义
exact_factorization.hpp:65
LMCAS::bindings
const std::vector< Binding > & bindings
定义
expr.hpp:310
LMCAS::evaluate_numeric
Result< ApproxReal > evaluate_numeric(const SymbolicExpr &expression, const NumericBindings &bindings={})
定义
numeric_evaluation.hpp:44
LMCAS::NumericBindings
std::unordered_map< std::string, double > NumericBindings
定义
numeric_evaluation.hpp:14
numeric_value.hpp
include
numeric_evaluation.hpp
生成于
, 为 LMCAS使用
1.18.0