LMCAS
Lamina Computer Algebra System
载入中...
搜索中...
未找到
LMCAS::expr_detail::expr_common 命名空间参考

函数

ExprResult comparison_value (const ExprPtr &expression, ComputationContext &context)
ExprResult expr_from_complex_result (const ExpressionResult &result, const char *operation)
ExprMatchResult expr_match_failure (CasErrc code, std::string message, const char *operation)
ExprResult expression_failure (CasErrc code, std::string message, const char *operation)
bool is_reserved_symbol_name (const std::string &name)
template<typename Factory>
ExprResult make_binary_expr (const ExprPtr &lhs, const ExprPtr &rhs, ComputationContext &context, const char *operation_name, Factory &&factory)
template<typename Factory>
ExprResult make_binary_math_expr (const ExprPtr &lhs, const ExprPtr &rhs, ComputationContext &context, const char *function_name, Factory &&factory)
ExprResult make_unary_function_expr (const ExprPtr &expression, ComputationContext &context, const char *function_name, FunctionNode::FuncType type)
ExprResult make_unary_math_expr (const ExprPtr &expression, ComputationContext &context, const char *function_name, ExprPtr(*factory)(ExprPtr))
ExprResult require_dimensionless (const ExprPtr &expression, const char *function_name)

变量

constexpr const char * kAbsOperation = "LMCAS.abs"
constexpr const char * kApproxOperation = "LMCAS.approx_real"
constexpr const char * kComplexOperation = "LMCAS.complex"
constexpr const char * kConjOperation = "LMCAS.conj"
constexpr const char * kDifferentiateOperation = "LMCAS.differentiate"
constexpr const char * kExpandOperation = "LMCAS.expand"
constexpr const char * kExprMatchOperation = "LMCAS.expr_match"
constexpr const char * kExprOperation = "LMCAS.expr_op"
constexpr const char * kImagOperation = "LMCAS.imag"
constexpr const char * kIntegerOperation = "LMCAS.integer"
constexpr const char * kMathOperation = "LMCAS.math"
constexpr const char * kRationalOperation = "LMCAS.rational"
constexpr const char * kRealOperation = "LMCAS.real"
constexpr const char * kSubstituteOperation = "LMCAS.substitute"
constexpr const char * kSymOperation = "LMCAS.sym"

函数说明

◆ comparison_value()

ExprResult LMCAS::expr_detail::expr_common::comparison_value ( const ExprPtr & expression,
ComputationContext & context )

在文件 expr_facade.cpp 第 123 行定义.

124 {
125 if (std::dynamic_pointer_cast<const QuantityNode>(LMCAS::detail::node(expression))) {
126 return strip_unit(expression, UnitStripMode::BaseValue, context);
127 }
128 return ExprResult::success(expression);
129}
static Result success(ExprPtr value)
const SymbolicNodePtr & node(const ::LMCAS::SymbolicExpr &expression) noexcept
const std::vector< Polynomial< BigInt > > const BigInt ComputationContext & context
QuantityResult strip_unit(const std::shared_ptr< SymbolicExpr > &expression, UnitStripMode mode, ComputationContext &context)

引用了 LMCAS::BaseValue, comparison_value(), LMCAS::context, LMCAS::detail::node(), LMCAS::strip_unit() , 以及 LMCAS::Result< ExprPtr >::success().

被这些函数引用 comparison_value(), LMCAS::eq() , 以及 LMCAS::quadrature_gaussian_numeric().

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

◆ expr_from_complex_result()

ExprResult LMCAS::expr_detail::expr_common::expr_from_complex_result ( const ExpressionResult & result,
const char * operation )

在文件 expr_facade.cpp 第 85 行定义.

86 {
87 if (!result) {
88 return ExprResult::failure(result.error());
89 }
90 if (!result.value() || !LMCAS::detail::node(result.value())) {
92 "complex expression result is null",
93 operation);
94 }
95 return ExprResult::success(result.value());
96}
CasError & error()
static Result failure(CasErrc code, std::string message, std::string operation={})
ExprResult expression_failure(CasErrc code, std::string message, const char *operation)

引用了 LMCAS::Result< T >::error(), expr_from_complex_result(), expression_failure(), LMCAS::Result< ExprPtr >::failure(), LMCAS::InternalInvariant, LMCAS::detail::node(), LMCAS::Result< ExprPtr >::success() , 以及 LMCAS::Result< T >::value().

被这些函数引用 LMCAS::conj(), expr_from_complex_result(), LMCAS::imag() , 以及 LMCAS::real().

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

◆ expr_match_failure()

ExprMatchResult LMCAS::expr_detail::expr_common::expr_match_failure ( CasErrc code,
std::string message,
const char * operation )

在文件 expr_facade.cpp 第 18 行定义.

19 {
20 return ExprMatchResult::failure(code, std::move(message), operation);
21}

引用了 expr_match_failure() , 以及 LMCAS::Result< ExprMatch >::failure().

被这些函数引用 LMCAS::expr_match() , 以及 expr_match_failure().

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

◆ expression_failure()

ExprResult LMCAS::expr_detail::expr_common::expression_failure ( CasErrc code,
std::string message,
const char * operation )

◆ is_reserved_symbol_name()

bool LMCAS::expr_detail::expr_common::is_reserved_symbol_name ( const std::string & name)

在文件 expr_facade.cpp 第 99 行定义.

99 {
100 return name == "I" || name == "pi" || name == "π" ||
101 name == "e" || name == "phi";
102}
__attribute__((visibility("default"))) Result< EqvProfile > eqv_profile_from_name(const std const std::string & name

引用了 is_reserved_symbol_name() , 以及 LMCAS::name.

被这些函数引用 is_reserved_symbol_name() , 以及 LMCAS::sym().

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

◆ make_binary_expr()

template<typename Factory>
ExprResult LMCAS::expr_detail::expr_common::make_binary_expr ( const ExprPtr & lhs,
const ExprPtr & rhs,
ComputationContext & context,
const char * operation_name,
Factory && factory )

在文件 expr_common.hpp 第 88 行定义.

92 {
93 auto step = context.consume_steps(1, kExprOperation);
94 if (!step) return ExprResult::failure(step.error());
95 if (!lhs || !LMCAS::detail::node(lhs) ||
98 std::string(operation_name) +
99 " operands cannot be null",
101 }
102 try {
103 auto result = std::forward<Factory>(factory)(lhs, rhs);
104 if (!result || !LMCAS::detail::node(result)) {
106 std::string(operation_name) +
107 " expression construction failed",
109 }
110 return ExprResult::success(std::move(result));
111 } catch (const std::bad_alloc&) {
113 std::string(operation_name) +
114 " expression allocation failed",
116 } catch (const std::exception& error) {
117 return expression_failure(CasErrc::InvalidArgument, error.what(),
119 }
120}
constexpr const char * kExprOperation
const ExprPtr & rhs

引用了 LMCAS::context, expression_failure(), LMCAS::Result< ExprPtr >::failure(), LMCAS::InternalInvariant, LMCAS::InvalidArgument, kExprOperation, make_binary_expr(), LMCAS::detail::node(), LMCAS::ResourceLimit, LMCAS::rhs , 以及 LMCAS::Result< ExprPtr >::success().

被这些函数引用 LMCAS::eq() , 以及 make_binary_expr().

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

◆ make_binary_math_expr()

template<typename Factory>
ExprResult LMCAS::expr_detail::expr_common::make_binary_math_expr ( const ExprPtr & lhs,
const ExprPtr & rhs,
ComputationContext & context,
const char * function_name,
Factory && factory )

在文件 expr_common.hpp 第 53 行定义.

57 {
58 auto step = context.consume_steps(1, kMathOperation);
59 if (!step) return ExprResult::failure(step.error());
60 if (!lhs || !LMCAS::detail::node(lhs) ||
63 std::string(function_name) +
64 " arguments cannot be null",
66 }
67 try {
68 auto result = std::forward<Factory>(factory)(lhs, rhs);
69 if (!result || !LMCAS::detail::node(result)) {
71 std::string(function_name) +
72 " expression construction failed",
74 }
75 return ExprResult::success(std::move(result));
76 } catch (const std::bad_alloc&) {
78 std::string(function_name) +
79 " expression allocation failed",
81 } catch (const std::exception& error) {
84 }
85}
constexpr const char * kMathOperation

引用了 LMCAS::context, expression_failure(), LMCAS::Result< ExprPtr >::failure(), LMCAS::InternalInvariant, LMCAS::InvalidArgument, kMathOperation, make_binary_math_expr(), LMCAS::detail::node(), LMCAS::ResourceLimit, LMCAS::rhs , 以及 LMCAS::Result< ExprPtr >::success().

被这些函数引用 make_binary_math_expr().

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

◆ make_unary_function_expr()

ExprResult LMCAS::expr_detail::expr_common::make_unary_function_expr ( const ExprPtr & expression,
ComputationContext & context,
const char * function_name,
FunctionNode::FuncType type )

在文件 expr_facade.cpp 第 56 行定义.

59 {
60 auto step = context.consume_steps(1, kMathOperation);
61 if (!step) return ExprResult::failure(step.error());
62 if (!expression || !LMCAS::detail::node(expression)) {
64 std::string(function_name) +
65 " argument cannot be null",
67 }
68 try {
70 type, std::vector<std::shared_ptr<const SymbolicNode>>{
71 LMCAS::detail::node(expression)});
73 LMCAS::detail::make_expression_ptr(std::move(node)));
74 } catch (const std::bad_alloc&) {
76 std::string(function_name) +
77 " expression allocation failed",
79 } catch (const std::exception& error) {
82 }
83}
std::shared_ptr<::LMCAS::SymbolicExpr > make_expression_ptr(SymbolicNodePtr root)
std::shared_ptr< const Node > make_node(Args &&... args)

引用了 LMCAS::context, expression_failure(), LMCAS::Result< ExprPtr >::failure(), LMCAS::InternalInvariant, LMCAS::InvalidArgument, kMathOperation, LMCAS::detail::make_expression_ptr(), LMCAS::detail::make_node(), make_unary_function_expr(), LMCAS::detail::node(), LMCAS::ResourceLimit , 以及 LMCAS::Result< ExprPtr >::success().

被这些函数引用 LMCAS::acos(), LMCAS::asin(), LMCAS::atan(), LMCAS::ceil(), LMCAS::floor(), make_unary_function_expr() , 以及 LMCAS::round().

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

◆ make_unary_math_expr()

ExprResult LMCAS::expr_detail::expr_common::make_unary_math_expr ( const ExprPtr & expression,
ComputationContext & context,
const char * function_name,
ExprPtr(* factory )(ExprPtr) )

在文件 expr_facade.cpp 第 23 行定义.

26 {
27 auto step = context.consume_steps(1, kMathOperation);
28 if (!step) return ExprResult::failure(step.error());
29 if (!expression || !LMCAS::detail::node(expression)) {
31 std::string(function_name) +
32 " argument cannot be null",
34 }
35 try {
36 auto result = factory(expression);
37 if (!result || !LMCAS::detail::node(result)) {
39 std::string(function_name) +
40 " expression construction failed",
42 }
43 return ExprResult::success(std::move(result));
44 } catch (const std::bad_alloc&) {
46 std::string(function_name) +
47 " expression allocation failed",
49 } catch (const std::exception& error) {
52 }
53}

引用了 LMCAS::context, expression_failure(), LMCAS::Result< ExprPtr >::failure(), LMCAS::InternalInvariant, LMCAS::InvalidArgument, kMathOperation, make_unary_math_expr(), LMCAS::detail::node(), LMCAS::ResourceLimit , 以及 LMCAS::Result< ExprPtr >::success().

被这些函数引用 LMCAS::cos(), LMCAS::exp(), LMCAS::log(), make_unary_math_expr(), LMCAS::sin() , 以及 LMCAS::tan().

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

◆ require_dimensionless()

ExprResult LMCAS::expr_detail::expr_common::require_dimensionless ( const ExprPtr & expression,
const char * function_name )

在文件 expr_facade.cpp 第 105 行定义.

106 {
107 if (!expression || !LMCAS::detail::node(expression)) {
109 std::string(function_name) + " argument cannot be null",
111 }
112 auto dimension = dimension_of(*expression);
113 if (!dimension) return ExprResult::failure(dimension.error());
114 if (!dimension.value().is_dimensionless()) {
116 std::string(function_name) +
117 " requires a dimensionless argument",
119 }
120 return ExprResult::success(expression);
121}
Result< DimensionSignature > dimension_of(const SymbolicExpr &expression)

引用了 LMCAS::dimension_of(), LMCAS::DimensionMismatch, expression_failure(), LMCAS::Result< ExprPtr >::failure(), LMCAS::InvalidArgument, kMathOperation, LMCAS::detail::node(), require_dimensionless() , 以及 LMCAS::Result< ExprPtr >::success().

被这些函数引用 LMCAS::acos(), LMCAS::asin(), LMCAS::atan(), LMCAS::cos(), LMCAS::exp(), LMCAS::log(), LMCAS::log10(), require_dimensionless(), LMCAS::sin() , 以及 LMCAS::tan().

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

变量说明

◆ kAbsOperation

const char* LMCAS::expr_detail::expr_common::kAbsOperation = "LMCAS.abs"
inlineconstexpr

在文件 expr_common.hpp 第 22 行定义.

被这些函数引用 LMCAS::abs().

◆ kApproxOperation

const char* LMCAS::expr_detail::expr_common::kApproxOperation = "LMCAS.approx_real"
inlineconstexpr

在文件 expr_common.hpp 第 15 行定义.

被这些函数引用 LMCAS::approx_real().

◆ kComplexOperation

const char* LMCAS::expr_detail::expr_common::kComplexOperation = "LMCAS.complex"
inlineconstexpr

在文件 expr_common.hpp 第 16 行定义.

被这些函数引用 LMCAS::complex() , 以及 LMCAS::error_name().

◆ kConjOperation

const char* LMCAS::expr_detail::expr_common::kConjOperation = "LMCAS.conj"
inlineconstexpr

在文件 expr_common.hpp 第 21 行定义.

被这些函数引用 LMCAS::conj().

◆ kDifferentiateOperation

const char* LMCAS::expr_detail::expr_common::kDifferentiateOperation = "LMCAS.differentiate"
inlineconstexpr

在文件 expr_common.hpp 第 24 行定义.

被这些函数引用 LMCAS::differentiate().

◆ kExpandOperation

const char* LMCAS::expr_detail::expr_common::kExpandOperation = "LMCAS.expand"
inlineconstexpr

在文件 expr_common.hpp 第 23 行定义.

◆ kExprMatchOperation

const char* LMCAS::expr_detail::expr_common::kExprMatchOperation = "LMCAS.expr_match"
inlineconstexpr

在文件 expr_common.hpp 第 26 行定义.

被这些函数引用 LMCAS::expr_match().

◆ kExprOperation

const char* LMCAS::expr_detail::expr_common::kExprOperation = "LMCAS.expr_op"
inlineconstexpr

在文件 expr_common.hpp 第 17 行定义.

被这些函数引用 LMCAS::eq() , 以及 make_binary_expr().

◆ kImagOperation

const char* LMCAS::expr_detail::expr_common::kImagOperation = "LMCAS.imag"
inlineconstexpr

在文件 expr_common.hpp 第 20 行定义.

被这些函数引用 LMCAS::imag().

◆ kIntegerOperation

const char* LMCAS::expr_detail::expr_common::kIntegerOperation = "LMCAS.integer"
inlineconstexpr

在文件 expr_common.hpp 第 13 行定义.

被这些函数引用 LMCAS::integer() , 以及 LMCAS::integer().

◆ kMathOperation

const char* LMCAS::expr_detail::expr_common::kMathOperation = "LMCAS.math"
inlineconstexpr

◆ kRationalOperation

const char* LMCAS::expr_detail::expr_common::kRationalOperation = "LMCAS.rational"
inlineconstexpr

在文件 expr_common.hpp 第 14 行定义.

被这些函数引用 LMCAS::rational().

◆ kRealOperation

const char* LMCAS::expr_detail::expr_common::kRealOperation = "LMCAS.real"
inlineconstexpr

在文件 expr_common.hpp 第 19 行定义.

被这些函数引用 LMCAS::real().

◆ kSubstituteOperation

const char* LMCAS::expr_detail::expr_common::kSubstituteOperation = "LMCAS.substitute"
inlineconstexpr

在文件 expr_common.hpp 第 25 行定义.

被这些函数引用 LMCAS::binding() , 以及 LMCAS::substitute().

◆ kSymOperation

const char* LMCAS::expr_detail::expr_common::kSymOperation = "LMCAS.sym"
inlineconstexpr

在文件 expr_common.hpp 第 12 行定义.

被这些函数引用 LMCAS::error_name() , 以及 LMCAS::sym().