add scale node

This commit is contained in:
2026-04-22 18:16:26 +02:00
parent 42d1dd30dc
commit fc7db3c989

View File

@@ -11,6 +11,7 @@ new_key_type! { pub struct NodeId; }
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub enum Node<V: Var> {
Leaf(V),
Scale(NodeId, i32),
Sum(NodeId, NodeId),
Prod(NodeId, NodeId),
}
@@ -19,6 +20,7 @@ impl<V: Var> Node<V> {
pub fn children(&self) -> impl Iterator<Item = NodeId> {
match self {
Node::Leaf(_) => [None, None],
Node::Scale(n,_) => [Some(*n), None],
Node::Sum(l, r) | Node::Prod(l, r) => [Some(*l), Some(*r)],
}
.into_iter()