Skip to content

Commit

Permalink
Query whether a port is linear in command
Browse files Browse the repository at this point in the history
  • Loading branch information
aborgna-q committed Sep 21, 2023
1 parent 65426a7 commit dad511c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/circuit/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ impl<'circ, Circ: Circuit> Command<'circ, Circ> {
.find(|(cu, _, _)| *cu == unit)
.map(|(_, port, _)| port)
}

/// Returns whether the port is a linear port.
#[inline]
pub fn is_linear_port(&self, port: Port) -> bool {
self.optype()
.port_kind(port)
.map_or(false, |kind| kind.is_linear())
}
}

impl<'a, 'circ, Circ: Circuit> UnitLabeller for &'a Command<'circ, Circ> {
Expand Down

0 comments on commit dad511c

Please sign in to comment.