|
smats
0.0.1
Satisfability Modulo Arithmetic Theories Symbols
|
#include <expression_cell.h>
Public Types | |
using | ExpressionMap = std::map<Expression<T>, T> |
Public Member Functions | |
NEW_OPERATOR_PARAMS (ExpressionAdd, PARAMS(T constant, ExpressionMap expr_to_coeff_map), PARAMS(constant, expr_to_coeff_map)) | |
void | hash (DelegatingHasher &) const override |
bool | equal_to (const ExpressionCell< T > &o) const override |
bool | less (const ExpressionCell< T > &o) const override |
T | evaluate (const Environment< T > &env) const override |
Expression< T > | evaluate_partial (const Environment< T > &env) const override |
Expression< T > | expand () const override |
Expression< T > | substitute (const Substitution< T > &s) const override |
Expression< T > | differentiate (const Variable &x) const override |
std::ostream & | display (std::ostream &os) const override |
const T & | constant () const |
T & | m_constant () |
const ExpressionMap & | expr_to_coeff_map () const |
ExpressionMap & | m_expr_to_coeff_map () |
![]() | |
long | use_count () const |
ExpressionKind | kind () const |
const Variables & | variables () const |
bool | is_polynomial () const |
bool | is_expanded () const |
void | set_expanded () |
template<template< class > class E> | |
const E< T > & | to () const |
template<template< class > class E> | |
E< T > & | to () |
Expression< T > | to_expression () const |
void | invalidate_cache () |
Static Public Attributes | |
static const ExpressionKind | expression_kind = ExpressionKind::Add |
Private Member Functions | |
void | compute_variables (std::optional< Variables > &variables) const override |
void | compute_is_polynomial (std::optional< bool > &is_polynomial) const override |
std::ostream & | display_term (std::ostream &os, bool print_plus, const T &coeff, const Expression< T > &term) const |
Static Private Member Functions | |
static Variables | extract_variables (const ExpressionMap &expr_to_coeff_map) |
Private Attributes | |
const T | constant_ |
Constant term of the addition. | |
const ExpressionMap | expr_to_coeff_map_ |
Map from expressions to their coefficients. | |
Additional Inherited Members | |
![]() | |
ExpressionCell (ExpressionKind kind, bool is_expanded) | |
ExpressionCell (ExpressionKind kind, bool is_polynomial, bool is_expanded) | |
Symbolic expression representing the addition of multiple terms.
The expression holds a constant term and a map from expressions to their coefficients. Let \( k \) be the constant term and \( E \) be the set of pairs \((c, e)\) where \( c \) is the coefficient and \( e \) is the expression. The ExpressionAdd cell represents the following expression:
\[ k + \sum_{(c, e) \in E} c \cdot e \]
T | type of the expression evaluation |
|
overrideprivatevirtual |
Implements smats::ExpressionCell< T >.
|
overrideprivatevirtual |
Implements smats::ExpressionCell< T >.
|
inlinenodiscard |
Get read-only access to the constant of the addition expression.
|
nodiscardoverridevirtual |
Differentiates this symbolic expression with respect to the variable var
.
x | variable |
std::runtime_exception | if it is not differentiable. |
Implements smats::ExpressionCell< T >.
|
overridevirtual |
Displays the expression in a human-readable format.
os | output stream |
Implements smats::ExpressionCell< T >.
|
private |
Utility function used to display a single term in a pretty format.
os | output stream |
print_plus | whether to print a plus at the beginning |
coeff | coefficient of the term |
term | expression of the term |
|
nodiscardoverridevirtual |
Compare two expression cells to determine if they are equal.
o | other object to compare against |
Implements smats::ExpressionCell< T >.
|
nodiscardoverridevirtual |
Evaluates under a given environment (by default, an empty environment).
env | environment |
std::runtime_exception | if NaN is detected during evaluation. |
Implements smats::ExpressionCell< T >.
|
nodiscardoverridevirtual |
Returns an Expression obtained by replacing all occurrences of the variables in env
in the current expression cell with the corresponding values in env
.
env | environment |
std::runtime_exception | if NaN is detected during substitution. |
Implements smats::ExpressionCell< T >.
|
nodiscardoverridevirtual |
Expands out products and positive integer powers in expression.
std::runtime_exception | if NaN is detected during expansion. |
Implements smats::ExpressionCell< T >.
|
inlinenodiscard |
Get read-only access to the map of the addition expression.
|
overridevirtual |
Sends all hash-relevant bytes for this ExpressionCell type into the given hasher, per the hash_append concept, except for kind(), because Expression already sends that.
Implements smats::ExpressionCell< T >.
|
nodiscardoverridevirtual |
Compare two expression cells to determine the order between them.
o | other object to compare against |
Implements smats::ExpressionCell< T >.
T & smats::ExpressionAdd< T >::m_constant | ( | ) |
Get read-write access to the constant of the addition expression.
ExpressionAdd< T >::ExpressionMap & smats::ExpressionAdd< T >::m_expr_to_coeff_map | ( | ) |
Get read-write access to the map of the addition expression.
|
nodiscardoverridevirtual |
Returns an Expression obtained by replacing all occurrences of the variables in s
in the current expression cell with the corresponding expressions in s
.
s | substitution |
std::runtime_exception | if NaN is detected during substitution. |
Implements smats::ExpressionCell< T >.