LMCAS
Lamina Computer Algebra System
载入中...
搜索中...
未找到
LMCAS::NodeCompare结构体 参考

#include </home/runner/work/docs/docs/LMCAS/src/internal/normalization_utils.hpp>

LMCAS::NodeCompare 的协作图:

Public 成员函数

bool operator() (const std::shared_ptr< const SymbolicNode > &left, const std::shared_ptr< const SymbolicNode > &right) const

详细描述

在文件 normalization_utils.hpp 第 94 行定义.

成员函数说明

◆ operator()()

bool LMCAS::NodeCompare::operator() ( const std::shared_ptr< const SymbolicNode > & left,
const std::shared_ptr< const SymbolicNode > & right ) const

在文件 normalization_utils.cpp 第 108 行定义.

108 {
109 if (!lhs && !rhs) {
110 return false;
111 }
112 if (!lhs) {
113 return true;
114 }
115 if (!rhs) {
116 return false;
117 }
118
119 const BigInt d1 = get_node_degree_helper(lhs);
120 const BigInt d2 = get_node_degree_helper(rhs);
121 if (d1 != d2) {
122 return d1 > d2;
123 }
124
125 bool isNum1 = std::dynamic_pointer_cast<const NumberNode>(lhs) != nullptr;
126 bool isNum2 = std::dynamic_pointer_cast<const NumberNode>(rhs) != nullptr;
127 if (isNum1 != isNum2) {
128 return isNum1;
129 }
130
131 if (lhs->type_priority() != rhs->type_priority()) {
132 return lhs->type_priority() < rhs->type_priority();
133 }
134
135 return lhs->compare(*rhs) < 0;
136 }
BigInt get_node_degree_helper(const std::shared_ptr< const SymbolicNode > &node)
计算 AST 节点的多项式次数
const ExprPtr & rhs

引用了 LMCAS::get_node_degree_helper() , 以及 LMCAS::rhs.

函数调用图:

该结构体的文档由以下文件生成: