Skip to content

Commit

Permalink
chore(deps-rs)!: Update hugr to 0.13.1 (#660)
Browse files Browse the repository at this point in the history
drive-by: Update some other deps that don't require code changes
drive-by: Fix a small TODO that required the latest hugr version

BREAKING CHANGE: Updated `hugr` to `0.13.1`
  • Loading branch information
aborgna-q authored Oct 14, 2024
1 parent 994153e commit d42842d
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 33 deletions.
76 changes: 56 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ missing_docs = "warn"
[workspace.dependencies]

# Make sure to run `just recompile-eccs` if the hugr serialisation format changes.
hugr = "0.13.0"
hugr-core = "0.10.0"
hugr-cli = "0.6.0"
hugr = "0.13.1"
hugr-core = "0.13.1"
hugr-cli = "0.13.1"
portgraph = "0.12"
pyo3 = "0.21.2"
itertools = "0.13.0"
Expand All @@ -42,7 +42,7 @@ clap = "4.5.19"
criterion = "0.5.1"
crossbeam-channel = "0.5.8"
csv = "1.2.2"
delegate = "0.13.0"
delegate = "0.13.1"
derive_more = "1.0.0"
downcast-rs = "1.2.0"
fxhash = "0.2.1"
Expand All @@ -51,13 +51,13 @@ num-complex = "0.4"
num-rational = "0.4"
num_cpus = "1.16.0"
peak_alloc = "0.2.0"
pest = "2.7.13"
pest_derive = "2.7.13"
pest = "2.7.14"
pest_derive = "2.7.14"
petgraph = { version = "0.6.3", default-features = false }
priority-queue = "2.1.1"
rayon = "1.5"
rmp-serde = "1.1.2"
rstest = "0.19.0"
rstest = "0.23.0"
serde = "1.0"
serde_json = "1.0"
smol_str = "0.3.1"
Expand Down
9 changes: 6 additions & 3 deletions tket2-hseries/src/extension/hseries/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ fn build_to_radians(b: &mut DFGBuilder<Hugr>, rotation: Wire) -> Result<Wire, Bu

/// Lower `Tk2Op` operations to `HSeriesOp` operations.
pub fn lower_tk2_op(hugr: &mut impl HugrMut) -> Result<Vec<hugr::Node>, LowerTk2Error> {
let replaced_nodes = lower_direct(hugr)?;
let mut replaced_nodes = lower_direct(hugr)?;
let mut hugr_map: HashMap<Tk2Op, Hugr> = HashMap::new();
for op in Tk2Op::iter() {
match op_to_hugr(op) {
Expand All @@ -122,9 +122,12 @@ pub fn lower_tk2_op(hugr: &mut impl HugrMut) -> Result<Vec<hugr::Node>, LowerTk2
};
}

let lowered_nodes = hugr::algorithms::lower_ops(hugr, |op| hugr_map.get(&op.cast()?).cloned())?;
let lowered_nodes = hugr::algorithms::lower_ops(hugr, |op| hugr_map.get(&op.cast()?).cloned())?
.into_iter()
.map(|(n, _)| n);

Ok([replaced_nodes, lowered_nodes].concat())
replaced_nodes.extend(lowered_nodes);
Ok(replaced_nodes)
}

fn lower_direct(hugr: &mut impl HugrMut) -> Result<Vec<Node>, LowerTk2Error> {
Expand Down
4 changes: 1 addition & 3 deletions tket2/src/serialize/pytket/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,7 @@ impl Tk1Decoder {
let res = hugr.add_dataflow_op(op, input_wires).unwrap_or_else(|e| {
panic!("Error while decoding pytket operation parameter \"{param}\". {e}",)
});
// TODO: Replace with `res.num_value_outputs`
// https://github.com/CQCL/hugr/pull/1560
assert_eq!(res.outputs().count(), 1, "An operation decoded from the pytket op parameter \"{param}\" had {} outputs", res.outputs().count());
assert_eq!(res.num_value_outputs(), 1, "An operation decoded from the pytket op parameter \"{param}\" had {} outputs", res.num_value_outputs());
LoadedParameter::float(res.out_wire(0))
}
}
Expand Down

0 comments on commit d42842d

Please sign in to comment.