|
docc 0.8.3 (0d44999b)
C++ API Reference
|
Functions for transforming and analyzing expressions. More...
Functions | |
| Expression | sdfg::symbolic::expand (const Expression expr) |
| Expands an expression algebraically. | |
| Expression | sdfg::symbolic::factor (const Expression expr) |
| Factors an expression into a product of simpler terms. | |
| Expression | sdfg::symbolic::simplify (const Expression expr) |
| Simplifies an expression. | |
| Expression | sdfg::symbolic::overapproximate (const Expression expr) |
| Overapproximates an expression by resolving min/max to upper bounds. | |
| bool | sdfg::symbolic::eq (const Expression lhs, const Expression rhs) |
| Tests structural equality of two expressions. | |
| bool | sdfg::symbolic::null_safe_eq (const Expression lhs, const Expression rhs) |
| Tests equality of expressions with null-safety. | |
| bool | sdfg::symbolic::uses (const Expression expr, const Symbol sym) |
| Tests if an expression uses a specific symbol. | |
| bool | sdfg::symbolic::uses (const Expression expr, const std::string &name) |
| Tests if an expression uses a symbol with a specific name. | |
| SymbolSet | sdfg::symbolic::atoms (const Expression expr) |
| Extracts all symbols (atoms) from an expression. | |
| template<typename T> | |
| bool | sdfg::symbolic::has (const Expression expr) |
| Checks if an expression contains a specific SymEngine type. | |
| template<typename T> | |
| ExpressionSet | sdfg::symbolic::find (const Expression expr) |
| Finds all instances of a specific SymEngine type in an expression. | |
| bool | sdfg::symbolic::has_dynamic_sizeof (const Expression expr) |
| Checks if an expression contains a dynamic_sizeof operation. | |
| ExpressionSet | sdfg::symbolic::muls (const Expression expr) |
| Extracts all multiplication operations from an expression. | |
| Expression | sdfg::symbolic::subs (const Expression expr, const Expression old_expr, const Expression new_expr) |
| Substitutes a sub-expression with another expression. | |
| Expression | sdfg::symbolic::subs (const Expression expr, const symbolic::ExpressionMapping &replacements) |
| Bulk replacement. | |
| Condition | sdfg::symbolic::subs (const Condition expr, const Expression old_expr, const Expression new_expr) |
| Substitutes a sub-expression in a condition. | |
| Condition | sdfg::symbolic::subs (const Condition expr, const symbolic::ExpressionMapping &replacements) |
| Bulk replacement. | |
| bool | sdfg::symbolic::substitute (ExpressionSet &set, const symbolic::ExpressionMapping &replacements) |
| MultiExpression | sdfg::symbolic::substitute (const MultiExpression &vec, const symbolic::ExpressionMapping &replacements) |
| Expression | sdfg::symbolic::inverse (const Expression expr, const Symbol symbol) |
| Computes the inverse of an expression with respect to a symbol. | |
Functions for transforming and analyzing expressions.
These functions provide utilities for expanding, simplifying, and analyzing symbolic expressions. They are essential for expression optimization and analysis.
| SymbolSet sdfg::symbolic::atoms | ( | const Expression | expr | ) |
Extracts all symbols (atoms) from an expression.
| expr | Expression to analyze |
| bool sdfg::symbolic::eq | ( | const Expression | lhs, |
| const Expression | rhs ) |
Tests structural equality of two expressions.
| lhs | First expression |
| rhs | Second expression |
| Expression sdfg::symbolic::expand | ( | const Expression | expr | ) |
Expands an expression algebraically.
| expr | Expression to expand |
Performs algebraic expansion, such as distributing multiplications over additions.
| Expression sdfg::symbolic::factor | ( | const Expression | expr | ) |
Factors an expression into a product of simpler terms.
| expr | Expression to factor |
Attempts to factor polynomials by finding integer roots via trial division and detecting perfect squares. For example, x^2 - 4*x + 4 becomes (x - 2)^2. Recurses into Mul and Pow sub-expressions.
|
inline |
Finds all instances of a specific SymEngine type in an expression.
| T | SymEngine type to search for |
| expr | Expression to search |
|
inline |
Checks if an expression contains a specific SymEngine type.
| T | SymEngine type to search for |
| expr | Expression to search |
| bool sdfg::symbolic::has_dynamic_sizeof | ( | const Expression | expr | ) |
Checks if an expression contains a dynamic_sizeof operation.
| expr | Expression to check |
| Expression sdfg::symbolic::inverse | ( | const Expression | expr, |
| const Symbol | symbol ) |
Computes the inverse of an expression with respect to a symbol.
| expr | Expression to invert |
| symbol | Symbol to solve for |
For an expression y = f(x), computes x = f^(-1)(y).
| ExpressionSet sdfg::symbolic::muls | ( | const Expression | expr | ) |
Extracts all multiplication operations from an expression.
| expr | Expression to analyze |
| bool sdfg::symbolic::null_safe_eq | ( | const Expression | lhs, |
| const Expression | rhs ) |
Tests equality of expressions with null-safety.
| lhs | First expression (can be null) |
| rhs | Second expression (can be null) |
This is a null-safe version of eq() where both inputs being null is also considered equal.
| Expression sdfg::symbolic::overapproximate | ( | const Expression | expr | ) |
Overapproximates an expression by resolving min/max to upper bounds.
| expr | Expression to overapproximate |
Traverses the expression and replaces:
This is useful for computing conservative upper bounds on working set sizes, e.g. a tile extent of min(32, M - i_tile) overapproximates to 32.
| Expression sdfg::symbolic::simplify | ( | const Expression | expr | ) |
Simplifies an expression.
| expr | Expression to simplify |
Applies simplification rules to reduce the expression to a canonical form.
| Condition sdfg::symbolic::subs | ( | const Condition | expr, |
| const Expression | old_expr, | ||
| const Expression | new_expr ) |
Substitutes a sub-expression in a condition.
| expr | Condition to perform substitution in |
| old_expr | Sub-expression to replace |
| new_expr | Expression to substitute |
| Condition sdfg::symbolic::subs | ( | const Condition | expr, |
| const symbolic::ExpressionMapping & | replacements ) |
Bulk replacement.
| Expression sdfg::symbolic::subs | ( | const Expression | expr, |
| const Expression | old_expr, | ||
| const Expression | new_expr ) |
Substitutes a sub-expression with another expression.
| expr | Expression to perform substitution in |
| old_expr | Sub-expression to replace |
| new_expr | Expression to substitute |
|
inline |
Bulk replacement.
| MultiExpression sdfg::symbolic::substitute | ( | const MultiExpression & | vec, |
| const symbolic::ExpressionMapping & | replacements ) |
| bool sdfg::symbolic::substitute | ( | ExpressionSet & | set, |
| const symbolic::ExpressionMapping & | replacements ) |
| bool sdfg::symbolic::uses | ( | const Expression | expr, |
| const std::string & | name ) |
Tests if an expression uses a symbol with a specific name.
| expr | Expression to search |
| name | Name of the symbol to look for |
| bool sdfg::symbolic::uses | ( | const Expression | expr, |
| const Symbol | sym ) |
Tests if an expression uses a specific symbol.
| expr | Expression to search |
| sym | Symbol to look for |