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

类

struct  PeriodicCollector

函数

static lmmc_real_t extract_linear_coefficient (const std::shared_ptr< const SymbolicNode > &node, const std::string &var)
static lmmc_real_t extract_real_value (const std::shared_ptr< const SymbolicNode > &node)
static bool is_periodic_func (FunctionNode::FuncType t)
static lmmc_real_t product_linear_coefficient (const MultiplyNode &product, const std::string &var)

函数说明

◆ extract_linear_coefficient()

lmmc_real_t LMCAS::anonymous_namespace{mixed_transcendental_search.cpp}::extract_linear_coefficient ( const std::shared_ptr< const SymbolicNode > & node,
const std::string & var )
static

在文件 mixed_transcendental_search.cpp 第 47 行定义.

50{
51 if (!node || !expression_depends_on_variable(node, var)) {
52 return 0.0;
53 }
54
55 if (auto v = std::dynamic_pointer_cast<const VariableNode>(node)) {
56 if (!v->is_constant() && v->name() == var) {
57 return 1.0;
58 }
59 return std::numeric_limits<lmmc_real_t>::quiet_NaN();
60 }
61
62 if (auto mul = std::dynamic_pointer_cast<const MultiplyNode>(node)) {
63 return product_linear_coefficient(*mul, var);
64 }
65
66 if (auto add = std::dynamic_pointer_cast<const AddNode>(node)) {
67 lmmc_real_t coeff = std::numeric_limits<lmmc_real_t>::quiet_NaN();
68 bool found_var_term = false;
69
70 for (const auto& op : add->operands()) {
72 continue;
73 }
74 if (found_var_term) {
75 return std::numeric_limits<lmmc_real_t>::quiet_NaN();
76 }
77 found_var_term = true;
78 coeff = extract_linear_coefficient(op, var);
79 }
80
81 return found_var_term ? coeff : std::numeric_limits<lmmc_real_t>::quiet_NaN();
82 }
83
84 return std::numeric_limits<lmmc_real_t>::quiet_NaN();
85}
static lmmc_real_t extract_linear_coefficient(const std::shared_ptr< const SymbolicNode > &node, const std::string &var)
static lmmc_real_t product_linear_coefficient(const MultiplyNode &product, const std::string &var)
__attribute__((visibility("default"))) VectorCalculusExprResult surface_integral_scalar_checked(const std __attribute__((visibility("default"))) VectorCalculusExprResult surface_integral_scalar_checked(const std __attribute__((visibility("default"))) std const VectorField const std::string const std::string & v
ExprResult mul(const ExprPtr &lhs, const ExprPtr &rhs, ComputationContext &context)
bool expression_depends_on_variable(const detail::SymbolicNodePtr &expression, const std::string &variable, detail::RewriteBudget *budget)
ExprResult add(const ExprPtr &lhs, const ExprPtr &rhs, ComputationContext &context)
const ExprPtr RelationOp op

引用了 LMCAS::add(), LMCAS::expression_depends_on_variable(), extract_linear_coefficient(), LMCAS::mul(), LMCAS::op, product_linear_coefficient() , 以及 LMCAS::v.

被这些函数引用 LMCAS::anonymous_namespace{mixed_transcendental_search.cpp}::PeriodicCollector::collect_period() , 以及 extract_linear_coefficient().

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

◆ extract_real_value()

lmmc_real_t LMCAS::anonymous_namespace{mixed_transcendental_search.cpp}::extract_real_value ( const std::shared_ptr< const SymbolicNode > & node)
static

在文件 mixed_transcendental_search.cpp 第 9 行定义.

9 {
10 auto num = std::dynamic_pointer_cast<const NumberNode>(node);
11 if (!num) {
12 return std::numeric_limits<lmmc_real_t>::quiet_NaN();
13 }
14
15 if (std::holds_alternative<Rational>(num->value())) {
16 return static_cast<lmmc_real_t>(std::get<Rational>(num->value()).to_double());
17 }
18 if (std::holds_alternative<BigInt>(num->value())) {
19 return static_cast<lmmc_real_t>(std::get<BigInt>(num->value()).to_double());
20 }
21 return std::numeric_limits<lmmc_real_t>::quiet_NaN();
22}
std::shared_ptr< SymbolicExpr > num(int value)

引用了 extract_real_value() , 以及 LMCAS::polynomial_solver_detail::num().

被这些函数引用 extract_real_value() , 以及 product_linear_coefficient().

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

◆ is_periodic_func()

bool LMCAS::anonymous_namespace{mixed_transcendental_search.cpp}::is_periodic_func ( FunctionNode::FuncType t)
static

在文件 mixed_transcendental_search.cpp 第 87 行定义.

87 {
88 switch (t) {
92 return true;
93 default:
94 return false;
95 }
96}
__attribute__((visibility("default"))) VectorCalculusExprResult curve_integral_scalar_checked(const std __attribute__((visibility("default"))) VectorCalculusExprResult curve_integral_scalar_checked(const std __attribute__((visibility("default"))) std const VectorField const std::string & t

引用了 LMCAS::FunctionNode::Cos, is_periodic_func(), LMCAS::FunctionNode::Sin, LMCAS::t , 以及 LMCAS::FunctionNode::Tan.

被这些函数引用 LMCAS::anonymous_namespace{mixed_transcendental_search.cpp}::PeriodicCollector::collect_period() , 以及 is_periodic_func().

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

◆ product_linear_coefficient()

lmmc_real_t LMCAS::anonymous_namespace{mixed_transcendental_search.cpp}::product_linear_coefficient ( const MultiplyNode & product,
const std::string & var )
static

在文件 mixed_transcendental_search.cpp 第 25 行定义.

26 {
27 if (product.operands().size() != 2) {
28 return std::numeric_limits<lmmc_real_t>::quiet_NaN();
29 }
30 std::shared_ptr<const SymbolicNode> number;
31 bool has_variable = false;
32 for (const auto& operand : product.operands()) {
33 if (operand->is_number()) {
34 number = operand;
35 } else if (auto variable = std::dynamic_pointer_cast<const VariableNode>(operand)) {
36 if (!variable->is_constant() && variable->name() == var) {
37 has_variable = true;
38 }
39 }
40 }
41 if (number && has_variable) {
42 return extract_real_value(number);
43 }
44 return std::numeric_limits<lmmc_real_t>::quiet_NaN();
45}
const std::vector< std::shared_ptr< const SymbolicNode > > & operands() const noexcept
static lmmc_real_t extract_real_value(const std::shared_ptr< const SymbolicNode > &node)
const std::string & variable

引用了 extract_real_value(), LMCAS::MultiplyNode::operands(), product_linear_coefficient() , 以及 LMCAS::variable.

被这些函数引用 extract_linear_coefficient() , 以及 product_linear_coefficient().

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