add scale node
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user