pub enum Node {
Var(u16),
Lit(u64),
Add(ExprId, ExprId),
Mul(ExprId, ExprId),
Neg(ExprId),
Recip(ExprId),
Sqrt(ExprId),
Sin(ExprId),
Atan2(ExprId, ExprId),
Exp2(ExprId),
Log2(ExprId),
Select(ExprId, ExprId, ExprId),
}Expand description
A node in the expression graph.
9 RISC primitive operations + 2 atom types. Every higher-level math
operation decomposes into these primitives via the Scalar impl.
Variants§
Var(u16)
Input variable by index.
Lit(u64)
Literal f64 value stored as bits for Hash/Eq.
Add(ExprId, ExprId)
Addition.
Mul(ExprId, ExprId)
Multiplication.
Neg(ExprId)
Negation.
Recip(ExprId)
Reciprocal (1/x).
Sqrt(ExprId)
Square root.
Sin(ExprId)
Sine (only trig primitive).
Atan2(ExprId, ExprId)
Two-argument arctangent atan2(y, x).
Exp2(ExprId)
Base-2 exponential (2^x).
Log2(ExprId)
Base-2 logarithm.
Select(ExprId, ExprId, ExprId)
Branchless select: returns a if cond > 0, else b.
Implementations§
Trait Implementations§
impl Copy for Node
impl Eq for Node
impl StructuralPartialEq for Node
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnsafeUnpin for Node
impl UnwindSafe for Node
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