pub struct SymbolicDagBuilder<F: Field> {
pub expr_to_idx: FxHashMap<*const SymbolicExpression<F>, usize>,
pub node_to_idx: FxHashMap<SymbolicExpressionNode<F>, usize>,
pub nodes: Vec<SymbolicExpressionNode<F>>,
}Expand description
Builder for constructing a symbolic expression DAG with structural deduplication and algebraic simplifications.
Two caches are used:
expr_to_idx: Fast path for expressions with the same Arc pointernode_to_idx: Structural deduplication - catches identical nodes with different Arc pointers
Algebraic simplifications performed:
- Constant folding:
a + b→c,a - b→c,a * b→c,-a→c(for constants a,b) x + 0→x,0 + x→xx - 0→xx * 1→x,1 * x→xx * 0→0,0 * x→0x + (-y)→x - yx - (-y)→x + y
Fields§
§expr_to_idx: FxHashMap<*const SymbolicExpression<F>, usize>Cache: Arc pointer -> node index (fast path for same Arc)
node_to_idx: FxHashMap<SymbolicExpressionNode<F>, usize>Cache: node structure -> node index (structural deduplication)
nodes: Vec<SymbolicExpressionNode<F>>Nodes in topological order
Implementations§
Source§impl<F: Field> SymbolicDagBuilder<F>
impl<F: Field> SymbolicDagBuilder<F>
Trait Implementations§
Auto Trait Implementations§
impl<F> !Send for SymbolicDagBuilder<F>
impl<F> !Sync for SymbolicDagBuilder<F>
impl<F> Freeze for SymbolicDagBuilder<F>
impl<F> RefUnwindSafe for SymbolicDagBuilder<F>where
F: RefUnwindSafe,
impl<F> Unpin for SymbolicDagBuilder<F>where
F: Unpin,
impl<F> UnsafeUnpin for SymbolicDagBuilder<F>
impl<F> UnwindSafe for SymbolicDagBuilder<F>where
F: UnwindSafe + RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more