Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion tket-py/src/circuit/tk2circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use derive_more::From;
use hugr::{Hugr, HugrView, Wire};
use serde::Serialize;
use tket::circuit::CircuitHash;
use tket::modifier::qubit_types_utils::contain_qubit_term;
use tket::passes::pytket::lower_to_pytket;
use tket::passes::CircuitChunks;
use tket::serialize::pytket::{DecodeOptions, EncodeOptions};
Expand Down
1 change: 0 additions & 1 deletion tket/src/modifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pub mod control;
pub mod dagger;
pub mod modifier_resolver;
pub mod power;
pub mod qubit_types_utils;

pub use pass::ModifierResolverPass;

Expand Down
20 changes: 10 additions & 10 deletions tket/src/modifier/modifier_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,11 @@ pub mod dfg_modify;
pub mod global_phase_modify;
pub mod tket_op_modify;

use super::qubit_types_utils::contain_qubits;
use super::{CombinedModifier, ModifierFlags};
use crate::{
extension::{global_phase::GlobalPhase, modifier::Modifier},
modifier::modifier_resolver::global_phase_modify::delete_phase,
TketOp,
};
use crate::passes::unpack_container::TypeUnpacker;
use crate::{extension::global_phase::GlobalPhase, modifier::Modifier, TketOp};
use global_phase_modify::delete_phase;

use hugr::{
builder::{BuildError, CFGBuilder, Container, Dataflow, SubContainer},
core::HugrNode,
Expand Down Expand Up @@ -324,6 +322,7 @@ pub struct ModifierResolver<N = Node> {
// ```
// _modified_functions: HashMap<N, (CombinedModifier, Node)>,
// ```
qubit_finder: TypeUnpacker,
}

impl<N> ModifierResolver<N> {
Expand All @@ -335,6 +334,7 @@ impl<N> ModifierResolver<N> {
controls: Vec::default(),
worklist: VecDeque::default(),
call_map: HashMap::default(),
qubit_finder: TypeUnpacker::for_qubits(),
}
}
}
Expand Down Expand Up @@ -854,7 +854,7 @@ impl<N: HugrNode> ModifierResolver<N> {
loop {
// Wire inputs until the first quantum type
while let Some(ty) = in_ty {
if contain_qubits(ty) {
if self.qubit_finder.contains_element_type(ty) {
break;
}
self.map_insert(old_in_wire, new_in_wire)?;
Expand All @@ -865,7 +865,7 @@ impl<N: HugrNode> ModifierResolver<N> {

// Wire outputs until the first quantum type
while let Some(ty) = out_ty {
if contain_qubits(ty) {
if self.qubit_finder.contains_element_type(ty) {
break;
}
self.map_insert(old_out_wire, new_out_wire)?;
Expand All @@ -876,7 +876,7 @@ impl<N: HugrNode> ModifierResolver<N> {

// If both are quantum types, wire them in the opposite direction until the next non-quantum type
while let Some(ty) = in_ty {
if !contain_qubits(ty) {
if !self.qubit_finder.contains_element_type(ty) {
break;
}
let new_in = if !self.modifiers.dagger {
Expand All @@ -893,7 +893,7 @@ impl<N: HugrNode> ModifierResolver<N> {
in_ty = inputs.next();
}
while let Some(ty) = out_ty {
if !contain_qubits(ty) {
if !self.qubit_finder.contains_element_type(ty) {
break;
}
let new_out = if !self.modifiers.dagger {
Expand Down
95 changes: 0 additions & 95 deletions tket/src/modifier/qubit_types_utils.rs

This file was deleted.

Loading