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

类

struct  TranscendentalDetector

函数

static BigInt degree_in_var (const std::shared_ptr< const SymbolicNode > &node, const std::string &var)
 计算节点关于指定变量的多项式次数。 与 var 无关的子表达式次数为 0。
static bool is_transcendental_func (FunctionNode::FuncType t)
 判断函数类型是否为 sin、cos、tan、exp 或 ln。
static BigInt product_degree (const MultiplyNode &product, const std::string &var)
static BigInt sum_degree (const AddNode &sum, const std::string &var)

函数说明

◆ degree_in_var()

BigInt LMCAS::anonymous_namespace{mixed_transcendental_classification.cpp}::degree_in_var ( const std::shared_ptr< const SymbolicNode > & node,
const std::string & var )
static

计算节点关于指定变量的多项式次数。 与 var 无关的子表达式次数为 0。

参数
[in]node符号节点。
[in]var变量名。
返回
关于 var 的次数;超出多项式次数支持域时返回 -1。

在文件 mixed_transcendental_classification.cpp 第 207 行定义.

207 {
208 if (!node) {
209 return 0;
210 }
211
212 if (!expression_depends_on_variable(node, var)) {
213 return 0;
214 }
215
216 if (auto v = std::dynamic_pointer_cast<const VariableNode>(node)) {
217 return (!v->is_constant() && v->name() == var) ? 1 : 0;
218 }
219
220 if (auto add = std::dynamic_pointer_cast<const AddNode>(node)) {
221 return sum_degree(*add, var);
222 }
223
224 if (auto mul = std::dynamic_pointer_cast<const MultiplyNode>(node)) {
225 return product_degree(*mul, var);
226 }
227
228 if (auto pow = std::dynamic_pointer_cast<const PowerNode>(node)) {
229 auto exp_num = std::dynamic_pointer_cast<const NumberNode>(pow->exponent());
230 BigInt e_val;
231 if (!try_get_integer_value(exp_num, e_val) || e_val.is_negative()) {
232 return -1;
233 }
234
235 BigInt base_deg = degree_in_var(pow->base(), var);
236 if (base_deg < 0) {
237 return -1;
238 }
239 return base_deg * e_val;
240 }
241 if (std::dynamic_pointer_cast<const FunctionNode>(node)) {
242 return -1;
243 }
244
245 return 0;
246}
static BigInt degree_in_var(const std::shared_ptr< const SymbolicNode > &node, const std::string &var)
计算节点关于指定变量的多项式次数。 与 var 无关的子表达式次数为 0。
static BigInt product_degree(const MultiplyNode &product, const std::string &var)
ExprResult pow(const ExprPtr &base, const ExprPtr &exponent, ComputationContext &context)
__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
bool try_get_integer_value(const std::shared_ptr< const NumberNode > &node, BigInt &value)
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)

引用了 LMCAS::add(), degree_in_var(), LMCAS::expression_depends_on_variable(), LMCAS::mul(), LMCAS::pow(), product_degree(), sum_degree(), LMCAS::try_get_integer_value() , 以及 LMCAS::v.

被这些函数引用 degree_in_var(), product_degree() , 以及 sum_degree().

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

◆ is_transcendental_func()

bool LMCAS::anonymous_namespace{mixed_transcendental_classification.cpp}::is_transcendental_func ( FunctionNode::FuncType t)
static

判断函数类型是否为 sin、cos、tan、exp 或 ln。

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

12 {
13 switch (t) {
19 return true;
20 default:
21 return false;
22 }
23}
__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, LMCAS::FunctionNode::Exp, is_transcendental_func(), LMCAS::FunctionNode::Ln, LMCAS::FunctionNode::Sin, LMCAS::t , 以及 LMCAS::FunctionNode::Tan.

被这些函数引用 is_transcendental_func() , 以及 LMCAS::anonymous_namespace{mixed_transcendental_classification.cpp}::TranscendentalDetector::visit().

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

◆ product_degree()

BigInt LMCAS::anonymous_namespace{mixed_transcendental_classification.cpp}::product_degree ( const MultiplyNode & product,
const std::string & var )
static

在文件 mixed_transcendental_classification.cpp 第 187 行定义.

187 {
188 BigInt total;
189 for (const auto& operand : product.operands()) {
190 auto degree = degree_in_var(operand, var);
191 if (degree < 0) {
192 return -1;
193 }
194 total += degree;
195 }
196 return total;
197}
const std::vector< std::shared_ptr< const SymbolicNode > > & operands() const noexcept

引用了 degree_in_var(), LMCAS::MultiplyNode::operands() , 以及 product_degree().

被这些函数引用 degree_in_var() , 以及 product_degree().

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

◆ sum_degree()

BigInt LMCAS::anonymous_namespace{mixed_transcendental_classification.cpp}::sum_degree ( const AddNode & sum,
const std::string & var )
static

在文件 mixed_transcendental_classification.cpp 第 173 行定义.

173 {
174 BigInt maximum;
175 for (const auto& operand : sum.operands()) {
176 auto degree = degree_in_var(operand, var);
177 if (degree < 0) {
178 return -1;
179 }
180 if (degree > maximum) {
181 maximum = std::move(degree);
182 }
183 }
184 return maximum;
185}
const std::vector< std::shared_ptr< const SymbolicNode > > & operands() const noexcept

引用了 degree_in_var(), LMCAS::AddNode::operands() , 以及 sum_degree().

被这些函数引用 degree_in_var() , 以及 sum_degree().

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