diff --git a/Cargo.lock b/Cargo.lock index 7f07f1be..34f93a9b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -735,9 +735,9 @@ dependencies = [ [[package]] name = "hugr" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de2694a502f45f121f16b43b18b2d23e7b10e02140c7f15f0b75bb0f1fcd52bc" +checksum = "6bcfc2468cd2c63e86c562d491130a32d9a8e6f192dc67916818b9a3da02d7e0" dependencies = [ "hugr-core", "hugr-passes", @@ -745,9 +745,9 @@ dependencies = [ [[package]] name = "hugr-cli" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55a6e94c3256d4d0e8a627861b77b0880ce9e772dd76613f8e53bed2dfa94233" +checksum = "691c29c35c238fadb6b2605952f9d6cf539e6a3c36a850f3f9a3a256dda601ca" dependencies = [ "clap", "clap-stdin", @@ -759,9 +759,9 @@ dependencies = [ [[package]] name = "hugr-core" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8c876db355d019432300959c916e783c5cb63d9454fab353ef122c95fc08aa" +checksum = "7384f55699d0290a2d6d491518d0fe15f43d7c5d312814a112b8a17d5666d7c4" dependencies = [ "bitvec", "cgmath", @@ -790,9 +790,9 @@ dependencies = [ [[package]] name = "hugr-passes" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3ce02c8ff515af36391fa253ef52d43be3597d0547da2d4bde1ee8de84b4d5" +checksum = "a9905dac38c839a5ea493dde57a3761d656fe782526b6e2d2a258f574a40799a" dependencies = [ "hugr-core", "itertools 0.13.0", diff --git a/Cargo.toml b/Cargo.toml index 486e2b02..263a3c79 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,9 +24,9 @@ missing_docs = "warn" [workspace.dependencies] -hugr = "0.8.0" -hugr-cli = "0.1.4" -hugr-core = "0.5.0" +hugr = "0.9.0" +hugr-cli = "0.2.0" +hugr-core = "0.6.0" portgraph = "0.12" pyo3 = "0.21.2" itertools = "0.13.0" diff --git a/docs/quantum.md b/docs/quantum.md index 0bedbc39..57854f46 100644 --- a/docs/quantum.md +++ b/docs/quantum.md @@ -36,7 +36,7 @@ compatibility: 1. The `main` function takes one `Array` input and has one output of the same type (the same statically known size). -2. All Operations that have a `FunctionType` involving `Qubit` have as +2. All Operations that have a `Signature` involving `Qubit` have as many `Qubit` input wires as output. diff --git a/tket2-hseries/src/extension/futures.rs b/tket2-hseries/src/extension/futures.rs index 0265e95d..aef78107 100644 --- a/tket2-hseries/src/extension/futures.rs +++ b/tket2-hseries/src/extension/futures.rs @@ -10,9 +10,7 @@ use hugr::{ ExtensionBuildError, ExtensionId, ExtensionRegistry, OpDef, SignatureFunc, TypeDef, }, ops::{custom::ExtensionOp, CustomOp, OpType}, - types::{ - type_param::TypeParam, CustomType, FunctionType, PolyFuncType, Type, TypeArg, TypeBound, - }, + types::{type_param::TypeParam, CustomType, PolyFuncType, Signature, Type, TypeArg, TypeBound}, Extension, Wire, }; use lazy_static::lazy_static; @@ -97,15 +95,15 @@ impl MakeOpDef for FutureOp { let future_type = future_type(t_type.clone()); match self { FutureOp::Read => { - PolyFuncType::new([t_param], FunctionType::new(future_type, t_type)).into() + PolyFuncType::new([t_param], Signature::new(future_type, t_type)).into() } FutureOp::Dup => PolyFuncType::new( [t_param], - FunctionType::new(future_type.clone(), vec![future_type.clone(), future_type]), + Signature::new(future_type.clone(), vec![future_type.clone(), future_type]), ) .into(), FutureOp::Free => { - PolyFuncType::new([t_param], FunctionType::new(future_type.clone(), vec![])).into() + PolyFuncType::new([t_param], Signature::new(future_type.clone(), vec![])).into() } } } @@ -287,7 +285,7 @@ pub(crate) mod test { let hugr = { let mut func_builder = FunctionBuilder::new( "circuit", - PolyFuncType::new(vec![t_param], FunctionType::new(future_type, t.clone())), + PolyFuncType::new(vec![t_param], Signature::new(future_type, t.clone())), ) .unwrap(); let [future_w] = func_builder.input_wires_arr(); diff --git a/tket2-hseries/src/extension/quantum_lazy.rs b/tket2-hseries/src/extension/quantum_lazy.rs index 7be9f7e8..920dd230 100644 --- a/tket2-hseries/src/extension/quantum_lazy.rs +++ b/tket2-hseries/src/extension/quantum_lazy.rs @@ -11,7 +11,7 @@ use hugr::{ ExtensionId, ExtensionRegistry, OpDef, SignatureFunc, PRELUDE, }, ops::{CustomOp, OpType}, - types::FunctionType, + types::Signature, Extension, Wire, }; @@ -66,7 +66,7 @@ pub enum LazyQuantumOp { impl MakeOpDef for LazyQuantumOp { fn signature(&self) -> SignatureFunc { match self { - Self::Measure => FunctionType::new(QB_T, vec![QB_T, future_type(BOOL_T)]).into(), + Self::Measure => Signature::new(QB_T, vec![QB_T, future_type(BOOL_T)]).into(), } } @@ -147,8 +147,7 @@ mod test { fn circuit() { let hugr = { let mut func_builder = - FunctionBuilder::new("circuit", FunctionType::new(QB_T, vec![QB_T, BOOL_T])) - .unwrap(); + FunctionBuilder::new("circuit", Signature::new(QB_T, vec![QB_T, BOOL_T])).unwrap(); let [qb] = func_builder.input_wires_arr(); let [qb, lazy_b] = func_builder.add_lazy_measure(qb).unwrap(); let [b] = func_builder.add_read(lazy_b, BOOL_T).unwrap(); diff --git a/tket2-hseries/src/extension/result.rs b/tket2-hseries/src/extension/result.rs index e3986407..23e30528 100644 --- a/tket2-hseries/src/extension/result.rs +++ b/tket2-hseries/src/extension/result.rs @@ -1,6 +1,7 @@ //! This module defines the Hugr extension used to represent result reporting operations, //! with static string tags. //! +use hugr::types::Signature; use hugr::{ builder::{BuildError, Dataflow}, extension::{ @@ -21,7 +22,7 @@ use hugr::{ type_row, types::{ type_param::{CustomTypeArg, TypeParam}, - FunctionType, PolyFuncType, Type, TypeArg, + PolyFuncType, Type, TypeArg, }, Extension, Wire, }; @@ -175,7 +176,7 @@ impl ResultOpDef { PolyFuncType::new( [vec![string_param], self.type_params()].concat(), - FunctionType::new(self.arg_type(), type_row![]), + Signature::new(self.arg_type(), type_row![]), ) .into() } @@ -412,6 +413,7 @@ impl ResultOpBuilder for D {} #[cfg(test)] pub(crate) mod test { use cool_asserts::assert_matches; + use hugr::types::Signature; use hugr::{ builder::{Dataflow, DataflowHugr, FunctionBuilder}, extension::prelude::array_type, @@ -455,7 +457,7 @@ pub(crate) mod test { .concat(); let hugr = { let mut func_builder = - FunctionBuilder::new("circuit", FunctionType::new(in_row, type_row![])).unwrap(); + FunctionBuilder::new("circuit", Signature::new(in_row, type_row![])).unwrap(); let ops = [ ResultOp::new_bool("b"), ResultOp::new_f64("f"), diff --git a/tket2-hseries/src/lazify_measure.rs b/tket2-hseries/src/lazify_measure.rs index 7f0d93dc..c9bcf648 100644 --- a/tket2-hseries/src/lazify_measure.rs +++ b/tket2-hseries/src/lazify_measure.rs @@ -13,7 +13,7 @@ use hugr::{ ExtensionRegistry, }, hugr::{hugrmut::HugrMut, views::SiblingSubgraph, Rewrite}, - types::FunctionType, + types::Signature, Hugr, HugrView, IncomingPort, Node, OutgoingPort, SimpleReplacement, }; use tket2::Tk2Op; @@ -85,7 +85,7 @@ impl State { lazy_static! { static ref MEASURE_READ_HUGR: Hugr = { - let mut builder = DFGBuilder::new(FunctionType::new(QB_T, vec![QB_T, BOOL_T])).unwrap(); + let mut builder = DFGBuilder::new(Signature::new(QB_T, vec![QB_T, BOOL_T])).unwrap(); let [qb] = builder.input_wires_arr(); let [qb, lazy_r] = builder.add_lazy_measure(qb).unwrap(); let [r] = builder.add_read(lazy_r, BOOL_T).unwrap(); @@ -99,7 +99,7 @@ fn measure_replacement(num_dups: usize) -> Hugr { let mut out_types = vec![QB_T]; out_types.extend((0..num_dups).map(|_| BOOL_T)); let num_out_types = out_types.len(); - let mut builder = DFGBuilder::new(FunctionType::new(QB_T, out_types)).unwrap(); + let mut builder = DFGBuilder::new(Signature::new(QB_T, out_types)).unwrap(); let [qb] = builder.input_wires_arr(); let [qb, mut future_r] = builder.add_lazy_measure(qb).unwrap(); let mut future_rs = vec![]; @@ -215,7 +215,7 @@ mod test { #[test] fn simple() { let mut hugr = { - let mut builder = DFGBuilder::new(FunctionType::new(QB_T, vec![QB_T, BOOL_T])).unwrap(); + let mut builder = DFGBuilder::new(Signature::new(QB_T, vec![QB_T, BOOL_T])).unwrap(); let [qb] = builder.input_wires_arr(); let outs = builder .add_dataflow_op(Tk2Op::Measure, [qb]) @@ -248,7 +248,7 @@ mod test { #[test] fn multiple_uses() { let mut builder = - DFGBuilder::new(FunctionType::new(QB_T, vec![QB_T, BOOL_T, BOOL_T])).unwrap(); + DFGBuilder::new(Signature::new(QB_T, vec![QB_T, BOOL_T, BOOL_T])).unwrap(); let [qb] = builder.input_wires_arr(); let [qb, bool] = builder .add_dataflow_op(Tk2Op::Measure, [qb]) @@ -267,7 +267,7 @@ mod test { #[test] fn no_uses() { - let mut builder = DFGBuilder::new(FunctionType::new_endo(QB_T)).unwrap(); + let mut builder = DFGBuilder::new(Signature::new_endo(QB_T)).unwrap(); let [qb] = builder.input_wires_arr(); let [qb, _] = builder .add_dataflow_op(Tk2Op::Measure, [qb]) diff --git a/tket2-py/src/circuit.rs b/tket2-py/src/circuit.rs index 65c55047..25e620f0 100644 --- a/tket2-py/src/circuit.rs +++ b/tket2-py/src/circuit.rs @@ -10,7 +10,7 @@ use hugr::extension::prelude::{BOOL_T, QB_T}; use hugr::hugr::IdentList; use hugr::ops::custom::{ExtensionOp, OpaqueOp}; use hugr::ops::{CustomOp, NamedOp, OpName, OpType}; -use hugr::types::{CustomType, FunctionType, Type, TypeBound}; +use hugr::types::{CustomType, Type, TypeBound}; use pyo3::prelude::*; use std::fmt; diff --git a/tket2-py/src/circuit/convert.rs b/tket2-py/src/circuit/convert.rs index 17e7d0e7..9e9387fc 100644 --- a/tket2-py/src/circuit/convert.rs +++ b/tket2-py/src/circuit/convert.rs @@ -6,7 +6,7 @@ use hugr::builder::{CircuitBuilder, DFGBuilder, Dataflow, DataflowHugr}; use hugr::extension::prelude::QB_T; use hugr::ops::handle::NodeHandle; use hugr::ops::{CustomOp, OpType}; -use hugr::types::{FunctionType, Type}; +use hugr::types::Type; use itertools::Itertools; use pyo3::exceptions::{PyAttributeError, PyValueError}; use pyo3::types::{PyAnyMethods, PyModule, PyString, PyTypeMethods}; diff --git a/tket2-py/src/circuit/tk2circuit.rs b/tket2-py/src/circuit/tk2circuit.rs index 3d80497a..fe46d49e 100644 --- a/tket2-py/src/circuit/tk2circuit.rs +++ b/tket2-py/src/circuit/tk2circuit.rs @@ -6,7 +6,7 @@ use hugr::builder::{CircuitBuilder, DFGBuilder, Dataflow, DataflowHugr}; use hugr::extension::prelude::QB_T; use hugr::ops::handle::NodeHandle; use hugr::ops::{CustomOp, OpType}; -use hugr::types::{FunctionType, Type}; +use hugr::types::Type; use itertools::Itertools; use pyo3::exceptions::{PyAttributeError, PyValueError}; use pyo3::types::{PyAnyMethods, PyModule, PyString, PyTypeMethods}; diff --git a/tket2-py/src/ops.rs b/tket2-py/src/ops.rs index 2e9aec28..747edce6 100644 --- a/tket2-py/src/ops.rs +++ b/tket2-py/src/ops.rs @@ -3,7 +3,7 @@ use derive_more::{From, Into}; use hugr::hugr::IdentList; use hugr::ops::custom::{ExtensionOp, OpaqueOp}; -use hugr::types::FunctionType; +use hugr::types::Signature; use pyo3::prelude::*; use std::fmt; use std::str::FromStr; @@ -252,7 +252,7 @@ impl PyCustomOp { op_name, Default::default(), [], - FunctionType::new(into_vec(input_types), into_vec(output_types)), + Signature::new(into_vec(input_types), into_vec(output_types)), )) .into()) } diff --git a/tket2/benches/benchmarks/generators.rs b/tket2/benches/benchmarks/generators.rs index 6d4642a7..bde3114a 100644 --- a/tket2/benches/benchmarks/generators.rs +++ b/tket2/benches/benchmarks/generators.rs @@ -1,7 +1,7 @@ use hugr::builder::{BuildError, CircuitBuilder, DFGBuilder, Dataflow, DataflowHugr}; use hugr::extension::prelude::QB_T; use hugr::extension::PRELUDE_REGISTRY; -use hugr::types::FunctionType; +use hugr::types::Signature; use hugr::Hugr; use tket2::Tk2Op; @@ -13,7 +13,7 @@ pub fn build_simple_circuit( f: impl FnOnce(&mut CircuitBuilder>) -> Result<(), BuildError>, ) -> Result { let qb_row = vec![QB_T; num_qubits]; - let mut h = DFGBuilder::new(FunctionType::new(qb_row.clone(), qb_row))?; + let mut h = DFGBuilder::new(Signature::new(qb_row.clone(), qb_row))?; let qbs = h.input_wires(); diff --git a/tket2/src/circuit.rs b/tket2/src/circuit.rs index e03d84e8..2c8ee5d6 100644 --- a/tket2/src/circuit.rs +++ b/tket2/src/circuit.rs @@ -16,7 +16,7 @@ use itertools::Either::{Left, Right}; use hugr::hugr::hugrmut::HugrMut; use hugr::ops::dataflow::IOTrait; use hugr::ops::{Input, NamedOp, OpParent, OpTag, OpTrait, Output}; -use hugr::types::{FunctionType, PolyFuncType}; +use hugr::types::{PolyFuncType, Signature}; use hugr::{Hugr, PortIndex}; use hugr::{HugrView, OutgoingPort}; use itertools::Itertools; @@ -123,7 +123,7 @@ impl Circuit { /// Returns the function type of the circuit. #[inline] - pub fn circuit_signature(&self) -> FunctionType { + pub fn circuit_signature(&self) -> Signature { let op = self.hugr.get_optype(self.parent); op.inner_function_type() .unwrap_or_else(|| panic!("{} is an invalid circuit parent type.", op.name())) @@ -555,7 +555,7 @@ fn update_signature( } } OpType::FuncDefn(defn) => { - let mut sig: FunctionType = defn.signature.clone().try_into().map_err(|_| { + let mut sig: Signature = defn.signature.clone().try_into().map_err(|_| { CircuitError::ParametricSignature { parent, optype: OpType::FuncDefn(defn.clone()), @@ -576,7 +576,7 @@ fn update_signature( } OpType::Case(case) => { let out_types = out_types.unwrap_or_else(|| case.signature.output().clone()); - case.signature = FunctionType::new(inp_types, out_types) + case.signature = Signature::new(inp_types, out_types) } OpType::TailLoop(_) => { unimplemented!("TailLoop signature update") @@ -597,7 +597,7 @@ mod tests { use cool_asserts::assert_matches; use rstest::{fixture, rstest}; - use hugr::types::FunctionType; + use hugr::types::Signature; use hugr::{ builder::{DFGBuilder, DataflowHugr}, extension::{prelude::BOOL_T, PRELUDE_REGISTRY}, @@ -713,7 +713,7 @@ mod tests { #[test] fn remove_bit() { - let h = DFGBuilder::new(FunctionType::new(vec![BOOL_T], vec![])).unwrap(); + let h = DFGBuilder::new(Signature::new(vec![BOOL_T], vec![])).unwrap(); let mut circ: Circuit = h .finish_hugr_with_outputs([], &PRELUDE_REGISTRY) .unwrap() diff --git a/tket2/src/circuit/command.rs b/tket2/src/circuit/command.rs index 88de1e7e..bb89869a 100644 --- a/tket2/src/circuit/command.rs +++ b/tket2/src/circuit/command.rs @@ -481,7 +481,7 @@ mod test { use hugr::ops::{NamedOp, Value}; use hugr::std_extensions::arithmetic::float_ops::FLOAT_OPS_REGISTRY; use hugr::std_extensions::arithmetic::float_types::ConstF64; - use hugr::types::FunctionType; + use hugr::types::Signature; use itertools::Itertools; use rstest::{fixture, rstest}; use std::collections::hash_map::DefaultHasher; @@ -588,7 +588,7 @@ mod test { #[test] fn commands_nonlinear() { let qb_row = vec![QB_T; 1]; - let mut h = DFGBuilder::new(FunctionType::new(qb_row.clone(), qb_row)).unwrap(); + let mut h = DFGBuilder::new(Signature::new(qb_row.clone(), qb_row)).unwrap(); let [q_in] = h.input_wires_arr(); let constant = h.add_constant(Value::extension(ConstF64::new(0.5))); @@ -659,7 +659,7 @@ mod test { #[test] fn alloc_free() -> Result<(), Box> { let qb_row = vec![QB_T; 1]; - let mut h = DFGBuilder::new(FunctionType::new(qb_row.clone(), qb_row))?; + let mut h = DFGBuilder::new(Signature::new(qb_row.clone(), qb_row))?; let [q_in] = h.input_wires_arr(); @@ -715,7 +715,7 @@ mod test { #[test] fn test_impls() -> Result<(), Box> { let qb_row = vec![QB_T; 1]; - let mut h = DFGBuilder::new(FunctionType::new(qb_row.clone(), vec![]))?; + let mut h = DFGBuilder::new(Signature::new(qb_row.clone(), vec![]))?; let [q_in] = h.input_wires_arr(); h.add_dataflow_op(Tk2Op::QFree, [q_in])?; let circ: Circuit = h.finish_hugr_with_outputs([], ®ISTRY)?.into(); diff --git a/tket2/src/circuit/extract_dfg.rs b/tket2/src/circuit/extract_dfg.rs index 7cbec647..38b12d85 100644 --- a/tket2/src/circuit/extract_dfg.rs +++ b/tket2/src/circuit/extract_dfg.rs @@ -2,7 +2,7 @@ use hugr::hugr::hugrmut::HugrMut; use hugr::ops::{OpTrait, OpType, Output, DFG}; -use hugr::types::{FunctionType, SumType, TypeEnum}; +use hugr::types::{Signature, SumType, TypeEnum}; use hugr::HugrView; use hugr_core::hugr::internal::HugrMutInternals; use itertools::Itertools; @@ -39,8 +39,8 @@ pub(super) fn rewrite_into_dfg(circ: &mut Circuit) -> Result<(), CircuitMutError /// when possible. fn remove_cfg_empty_output_tuple( circ: &mut Circuit, - signature: FunctionType, -) -> Result { + signature: Signature, +) -> Result { let sig = signature; let input_node = circ.input_node(); @@ -93,6 +93,6 @@ fn remove_cfg_empty_output_tuple( } // Return the updated circuit signature. - let sig = FunctionType::new(sig.input, new_types); + let sig = Signature::new(sig.input, new_types); Ok(sig) } diff --git a/tket2/src/extension.rs b/tket2/src/extension.rs index 66a71e26..ca4276a7 100644 --- a/tket2/src/extension.rs +++ b/tket2/src/extension.rs @@ -10,7 +10,7 @@ use hugr::extension::{CustomSignatureFunc, ExtensionId, ExtensionRegistry, Signa use hugr::hugr::IdentList; use hugr::std_extensions::arithmetic::float_types::{EXTENSION as FLOAT_EXTENSION, FLOAT64_TYPE}; use hugr::types::type_param::{TypeArg, TypeParam}; -use hugr::types::{CustomType, FunctionType, PolyFuncType, TypeBound}; +use hugr::types::{CustomType, PolyFuncType, PolyFuncTypeRV, Signature, TypeBound}; use hugr::{type_row, Extension}; use lazy_static::lazy_static; use smol_str::SmolStr; @@ -66,13 +66,14 @@ impl CustomSignatureFunc for Tk1Signature { arg_values: &[TypeArg], _def: &'o hugr::extension::OpDef, _extension_registry: &ExtensionRegistry, - ) -> Result { + ) -> Result { let [TypeArg::Opaque { arg }] = arg_values else { // This should have already been checked. panic!("Wrong number of arguments"); }; let op: OpaqueTk1Op = serde_yaml::from_value(arg.value.clone()).unwrap(); // TODO Errors! - Ok(op.signature().into()) + let poly_func: PolyFuncType = op.signature().into(); + Ok(poly_func.into()) } fn static_params(&self) -> &[TypeParam] { @@ -116,7 +117,7 @@ pub static ref TKET2_EXTENSION: Extension = { e.add_op( SYM_OP_ID, "Store a sympy expression that can be evaluated to a float.".to_string(), - PolyFuncType::new(vec![sym_expr_param], FunctionType::new(type_row![], type_row![FLOAT64_TYPE])), + PolyFuncType::new(vec![sym_expr_param], Signature::new(type_row![], type_row![FLOAT64_TYPE])), ) .unwrap(); diff --git a/tket2/src/extension/angle.rs b/tket2/src/extension/angle.rs index a6f02a3f..1da19dd1 100644 --- a/tket2/src/extension/angle.rs +++ b/tket2/src/extension/angle.rs @@ -2,11 +2,12 @@ use std::{cmp::max, num::NonZeroU64}; use hugr::extension::ExtensionSet; use hugr::ops::constant::{downcast_equal_consts, CustomConst}; +use hugr::types::PolyFuncTypeRV; use hugr::{ extension::{prelude::ERROR_TYPE, SignatureError, SignatureFromArgs, TypeDef}, types::{ type_param::{TypeArgError, TypeParam}, - ConstTypeError, CustomType, FunctionType, PolyFuncType, Type, TypeArg, TypeBound, + ConstTypeError, CustomType, PolyFuncType, Signature, Type, TypeArg, TypeBound, }, Extension, }; @@ -141,12 +142,14 @@ fn abinop_sig() -> impl SignatureFromArgs { fn compute_signature( &self, arg_values: &[TypeArg], - ) -> Result { + ) -> Result { let [arg0, arg1] = collect_array(arg_values); let m: u8 = get_log_denom(arg0)?; let n: u8 = get_log_denom(arg1)?; let l: u8 = max(m, n); - Ok(FunctionType::new(vec![angle_type(m), angle_type(n)], vec![angle_type(l)]).into()) + let poly_func: PolyFuncType = + Signature::new(vec![angle_type(m), angle_type(n)], vec![angle_type(l)]).into(); + Ok(poly_func.into()) } fn static_params(&self) -> &[TypeParam] { @@ -188,7 +191,7 @@ pub(super) fn add_to_extension(extension: &mut Extension) { PolyFuncType::new( vec![LOG_DENOM_TYPE_PARAM, LOG_DENOM_TYPE_PARAM], // atrunc_sig(extension).unwrap(), - FunctionType::new( + Signature::new( vec![generic_angle_type(0, &angle_type_def)], vec![generic_angle_type(1, &angle_type_def)], ), @@ -204,11 +207,11 @@ pub(super) fn add_to_extension(extension: &mut Extension) { .to_owned(), PolyFuncType::new( vec![LOG_DENOM_TYPE_PARAM, LOG_DENOM_TYPE_PARAM], - FunctionType::new( + Signature::new( vec![generic_angle_type(0, &angle_type_def)], vec![Type::new_sum([ - generic_angle_type(1, &angle_type_def).into(), - ERROR_TYPE.into(), + generic_angle_type(1, &angle_type_def), + ERROR_TYPE, ])], ), ), @@ -233,7 +236,7 @@ pub(super) fn add_to_extension(extension: &mut Extension) { "negation of an angle".to_owned(), PolyFuncType::new( vec![LOG_DENOM_TYPE_PARAM], - FunctionType::new_endo(vec![generic_angle_type(0, &angle_type_def)]), + Signature::new_endo(vec![generic_angle_type(0, &angle_type_def)]), ), ) .unwrap(); @@ -295,10 +298,9 @@ mod test { .compute_signature(&[type_arg(23), type_arg(42)]) .unwrap(); - assert_eq!( - sig, - FunctionType::new(vec![angle_type(23), angle_type(42)], vec![angle_type(42)]).into() - ); + let poly_type: PolyFuncType = + Signature::new(vec![angle_type(23), angle_type(42)], vec![angle_type(42)]).into(); + assert_eq!(sig, poly_type.into()); assert!(binop_sig .compute_signature(&[type_arg(23), type_arg(89)]) diff --git a/tket2/src/ops.rs b/tket2/src/ops.rs index 080ba287..7f284f08 100644 --- a/tket2/src/ops.rs +++ b/tket2/src/ops.rs @@ -14,7 +14,7 @@ use hugr::{ type_row, types::{ type_param::{CustomTypeArg, TypeArg}, - FunctionType, + Signature, }, }; @@ -117,23 +117,23 @@ impl MakeOpDef for Tk2Op { let two_qb_row = type_row![QB_T, QB_T]; match self { H | T | S | X | Y | Z | Tdg | Sdg | Reset => { - FunctionType::new(one_qb_row.clone(), one_qb_row) + Signature::new(one_qb_row.clone(), one_qb_row) } - CX | ZZMax | CZ => FunctionType::new(two_qb_row.clone(), two_qb_row), - ZZPhase => FunctionType::new(type_row![QB_T, QB_T, FLOAT64_TYPE], two_qb_row), - Measure => FunctionType::new(one_qb_row, type_row![QB_T, BOOL_T]), - RzF64 | RxF64 => FunctionType::new(type_row![QB_T, FLOAT64_TYPE], one_qb_row), - PhasedX => FunctionType::new(type_row![QB_T, FLOAT64_TYPE, FLOAT64_TYPE], one_qb_row), - AngleAdd => FunctionType::new( + CX | ZZMax | CZ => Signature::new(two_qb_row.clone(), two_qb_row), + ZZPhase => Signature::new(type_row![QB_T, QB_T, FLOAT64_TYPE], two_qb_row), + Measure => Signature::new(one_qb_row, type_row![QB_T, BOOL_T]), + RzF64 | RxF64 => Signature::new(type_row![QB_T, FLOAT64_TYPE], one_qb_row), + PhasedX => Signature::new(type_row![QB_T, FLOAT64_TYPE, FLOAT64_TYPE], one_qb_row), + AngleAdd => Signature::new( type_row![FLOAT64_TYPE, FLOAT64_TYPE], type_row![FLOAT64_TYPE], ), - TK1 => FunctionType::new( + TK1 => Signature::new( type_row![QB_T, FLOAT64_TYPE, FLOAT64_TYPE, FLOAT64_TYPE], one_qb_row, ), - QAlloc => FunctionType::new(type_row![], one_qb_row), - QFree => FunctionType::new(one_qb_row, type_row![]), + QAlloc => Signature::new(type_row![], one_qb_row), + QFree => Signature::new(one_qb_row, type_row![]), } .into() } diff --git a/tket2/src/optimiser/badger.rs b/tket2/src/optimiser/badger.rs index 17401208..e5b8c551 100644 --- a/tket2/src/optimiser/badger.rs +++ b/tket2/src/optimiser/badger.rs @@ -500,7 +500,7 @@ mod tests { builder::{DFGBuilder, Dataflow, DataflowHugr}, extension::prelude::QB_T, std_extensions::arithmetic::float_types::FLOAT64_TYPE, - types::FunctionType, + types::Signature, }; use rstest::{fixture, rstest}; @@ -521,7 +521,7 @@ mod tests { fn rz_rz() -> Circuit { let input_t = vec![QB_T, FLOAT64_TYPE, FLOAT64_TYPE]; let output_t = vec![QB_T]; - let mut h = DFGBuilder::new(FunctionType::new(input_t, output_t)).unwrap(); + let mut h = DFGBuilder::new(Signature::new(input_t, output_t)).unwrap(); let mut inps = h.input_wires(); let qb = inps.next().unwrap(); diff --git a/tket2/src/optimiser/badger/qtz_circuit.rs b/tket2/src/optimiser/badger/qtz_circuit.rs index f9701c76..4c7740ed 100644 --- a/tket2/src/optimiser/badger/qtz_circuit.rs +++ b/tket2/src/optimiser/badger/qtz_circuit.rs @@ -6,7 +6,7 @@ use hugr::builder::{DFGBuilder, Dataflow, DataflowHugr}; use hugr::extension::prelude::QB_T; use hugr::ops::OpType as Op; use hugr::std_extensions::arithmetic::float_types::FLOAT64_TYPE; -use hugr::types::{FunctionType, Type}; +use hugr::types::{Signature, Type}; use hugr::{CircuitUnit, Hugr}; use itertools::Itertools; use serde::{Deserialize, Serialize}; @@ -63,7 +63,7 @@ impl From for Circuit { fn from(RepCircData { circ: rc, meta }: RepCircData) -> Self { let qb_types: Vec = vec![QB_T; meta.n_qb]; let param_types: Vec = vec![FLOAT64_TYPE; meta.n_input_param]; - let mut builder = DFGBuilder::new(FunctionType::new( + let mut builder = DFGBuilder::new(Signature::new( [qb_types.clone(), param_types].concat(), qb_types, )) diff --git a/tket2/src/passes/chunks.rs b/tket2/src/passes/chunks.rs index fba83be9..d07c12d3 100644 --- a/tket2/src/passes/chunks.rs +++ b/tket2/src/passes/chunks.rs @@ -14,7 +14,7 @@ use hugr::hugr::views::{HierarchyView, SiblingGraph, SiblingSubgraph}; use hugr::hugr::{HugrError, NodeMetadataMap}; use hugr::ops::handle::DataflowParentID; use hugr::ops::OpType; -use hugr::types::FunctionType; +use hugr::types::Signature; use hugr::{HugrView, IncomingPort, Node, OutgoingPort, PortIndex, Wire}; use itertools::Itertools; use portgraph::algorithms::ConvexChecker; @@ -228,7 +228,7 @@ enum ConnectionTarget { #[derive(Debug, Clone)] pub struct CircuitChunks { /// The original circuit's signature. - signature: FunctionType, + signature: Signature, /// The original circuit's root metadata. root_meta: Option, diff --git a/tket2/src/passes/commutation.rs b/tket2/src/passes/commutation.rs index 970f0eb5..342e074c 100644 --- a/tket2/src/passes/commutation.rs +++ b/tket2/src/passes/commutation.rs @@ -332,7 +332,7 @@ mod test { extension::prelude::{BOOL_T, QB_T}, std_extensions::arithmetic::float_types::FLOAT64_TYPE, type_row, - types::FunctionType, + types::Signature, }; use rstest::{fixture, rstest}; @@ -435,7 +435,7 @@ mod test { // Gate being commuted has a non-linear input fn non_linear_inputs() -> Circuit { let build = || { - let mut dfg = DFGBuilder::new(FunctionType::new( + let mut dfg = DFGBuilder::new(Signature::new( type_row![QB_T, QB_T, FLOAT64_TYPE], type_row![QB_T, QB_T], ))?; @@ -457,7 +457,7 @@ mod test { // Gates being commuted have non-linear outputs fn non_linear_outputs() -> Circuit { let build = || { - let mut dfg = DFGBuilder::new(FunctionType::new( + let mut dfg = DFGBuilder::new(Signature::new( type_row![QB_T, QB_T], type_row![QB_T, QB_T, BOOL_T], ))?; diff --git a/tket2/src/passes/pytket.rs b/tket2/src/passes/pytket.rs index e2275b4c..87c7ecb8 100644 --- a/tket2/src/passes/pytket.rs +++ b/tket2/src/passes/pytket.rs @@ -52,7 +52,7 @@ mod test { use hugr::extension::{ExtensionSet, PRELUDE_REGISTRY}; use hugr::ops::handle::NodeHandle; use hugr::ops::{MakeTuple, OpType, Tag, UnpackTuple}; - use hugr::types::{FunctionType, TypeRow}; + use hugr::types::{Signature, TypeRow}; use hugr::{type_row, HugrView}; use rstest::{fixture, rstest}; @@ -65,7 +65,7 @@ mod test { fn guppy_like_circuit() -> Circuit { fn build() -> Result { let two_qbs = type_row![QB_T, QB_T]; - let circ_signature = FunctionType::new_endo(two_qbs.clone()); + let circ_signature = Signature::new_endo(two_qbs.clone()); let circ; let mut builder = ModuleBuilder::new(); diff --git a/tket2/src/passes/tuple_unpack.rs b/tket2/src/passes/tuple_unpack.rs index 8c19c8db..43e566f7 100644 --- a/tket2/src/passes/tuple_unpack.rs +++ b/tket2/src/passes/tuple_unpack.rs @@ -125,7 +125,7 @@ mod test { use hugr::extension::prelude::{BOOL_T, QB_T}; use hugr::ops::{MakeTuple, UnpackTuple}; use hugr::type_row; - use hugr::types::FunctionType; + use hugr::types::Signature; use rstest::{fixture, rstest}; /// A simple pack operation followed by an unpack operation. @@ -133,7 +133,7 @@ mod test { /// These can be removed entirely. #[fixture] fn simple_pack_unpack() -> Circuit { - let mut h = DFGBuilder::new(FunctionType::new_endo(type_row![QB_T, BOOL_T])).unwrap(); + let mut h = DFGBuilder::new(Signature::new_endo(type_row![QB_T, BOOL_T])).unwrap(); let mut inps = h.input_wires(); let qb1 = inps.next().unwrap(); let b2 = inps.next().unwrap(); @@ -154,7 +154,7 @@ mod test { /// These can be removed entirely. #[fixture] fn multi_unpack() -> Circuit { - let mut h = DFGBuilder::new(FunctionType::new( + let mut h = DFGBuilder::new(Signature::new( type_row![BOOL_T, BOOL_T], type_row![BOOL_T, BOOL_T, BOOL_T, BOOL_T], )) @@ -182,7 +182,7 @@ mod test { /// The unpack operation can be removed, but the pack operation cannot. #[fixture] fn partial_unpack() -> Circuit { - let mut h = DFGBuilder::new(FunctionType::new( + let mut h = DFGBuilder::new(Signature::new( type_row![BOOL_T, BOOL_T], vec![BOOL_T, BOOL_T, Type::new_tuple(type_row![BOOL_T, BOOL_T])], )) diff --git a/tket2/src/portmatching.rs b/tket2/src/portmatching.rs index ca8a2fce..29644b11 100644 --- a/tket2/src/portmatching.rs +++ b/tket2/src/portmatching.rs @@ -10,12 +10,12 @@ //! use hugr::builder::{DFGBuilder, Dataflow, DataflowHugr}; //! use hugr::extension::prelude::QB_T; //! use hugr::ops::handle::NodeHandle; -//! use hugr::types::FunctionType; +//! use hugr::types::Signature; //! //! # fn doctest() -> Result<(), Box> { //! // Define a simple pattern that matches a single qubit allocation. //! let circuit_pattern = { -//! let mut dfg = DFGBuilder::new(FunctionType::new(vec![], vec![QB_T]))?; +//! let mut dfg = DFGBuilder::new(Signature::new(vec![], vec![QB_T]))?; //! let alloc = dfg.add_dataflow_op(Tk2Op::QAlloc, [])?; //! dfg.finish_hugr_with_outputs(alloc.outputs(), &tket2::extension::REGISTRY) //! }?.into(); @@ -27,7 +27,7 @@ //! // | //! // 0|--[Z]--o--- //! let (circuit, alloc_node) = { -//! let mut dfg = DFGBuilder::new(FunctionType::new(vec![QB_T], vec![QB_T, QB_T]))?; +//! let mut dfg = DFGBuilder::new(Signature::new(vec![QB_T], vec![QB_T, QB_T]))?; //! let [input_wire] = dfg.input_wires_arr(); //! let alloc = dfg.add_dataflow_op(Tk2Op::QAlloc, [])?; //! let [alloc_wire] = alloc.outputs_arr(); @@ -206,7 +206,7 @@ mod tests { use hugr::{ builder::{DFGBuilder, Dataflow, DataflowHugr}, extension::{prelude::QB_T, PRELUDE_REGISTRY}, - types::FunctionType, + types::Signature, }; use rstest::{fixture, rstest}; @@ -214,7 +214,7 @@ mod tests { #[fixture] fn lhs() -> Circuit { - let mut h = DFGBuilder::new(FunctionType::new(vec![], vec![QB_T])).unwrap(); + let mut h = DFGBuilder::new(Signature::new(vec![], vec![QB_T])).unwrap(); let res = h.add_dataflow_op(Tk2Op::QAlloc, []).unwrap(); let q = res.out_wire(0); @@ -226,7 +226,7 @@ mod tests { #[fixture] pub fn circ() -> Circuit { - let mut h = DFGBuilder::new(FunctionType::new(vec![QB_T], vec![QB_T])).unwrap(); + let mut h = DFGBuilder::new(Signature::new(vec![QB_T], vec![QB_T])).unwrap(); let mut inps = h.input_wires(); let q_in = inps.next().unwrap(); diff --git a/tket2/src/portmatching/pattern.rs b/tket2/src/portmatching/pattern.rs index e90a627a..b241bf77 100644 --- a/tket2/src/portmatching/pattern.rs +++ b/tket2/src/portmatching/pattern.rs @@ -169,7 +169,7 @@ mod tests { use hugr::extension::prelude::QB_T; use hugr::ops::OpType; use hugr::std_extensions::arithmetic::float_types::FLOAT64_TYPE; - use hugr::types::FunctionType; + use hugr::types::Signature; use crate::extension::REGISTRY; use crate::utils::build_simple_circuit; @@ -190,7 +190,7 @@ mod tests { fn circ_with_copy() -> Circuit { let input_t = vec![QB_T, FLOAT64_TYPE]; let output_t = vec![QB_T]; - let mut h = DFGBuilder::new(FunctionType::new(input_t, output_t)).unwrap(); + let mut h = DFGBuilder::new(Signature::new(input_t, output_t)).unwrap(); let mut inps = h.input_wires(); let qb = inps.next().unwrap(); @@ -208,7 +208,7 @@ mod tests { fn circ_with_copy_disconnected() -> Circuit { let input_t = vec![QB_T, QB_T, FLOAT64_TYPE]; let output_t = vec![QB_T, QB_T]; - let mut h = DFGBuilder::new(FunctionType::new(input_t, output_t)).unwrap(); + let mut h = DFGBuilder::new(Signature::new(input_t, output_t)).unwrap(); let mut inps = h.input_wires(); let qb1 = inps.next().unwrap(); diff --git a/tket2/src/rewrite.rs b/tket2/src/rewrite.rs index 15315261..8b920e14 100644 --- a/tket2/src/rewrite.rs +++ b/tket2/src/rewrite.rs @@ -13,7 +13,7 @@ use derive_more::{From, Into}; use hugr::hugr::hugrmut::HugrMut; use hugr::hugr::views::sibling_subgraph::{InvalidReplacement, InvalidSubgraph}; use hugr::hugr::views::ExtractHugr; -use hugr::types::FunctionType; +use hugr::types::Signature; use hugr::{ hugr::{views::SiblingSubgraph, Rewrite, SimpleReplacementError}, SimpleReplacement, @@ -52,7 +52,7 @@ impl Subcircuit { } /// The signature of the subcircuit. - pub fn signature(&self, circ: &Circuit) -> FunctionType { + pub fn signature(&self, circ: &Circuit) -> Signature { self.subgraph.signature(circ.hugr()) } diff --git a/tket2/src/serialize/pytket/decoder.rs b/tket2/src/serialize/pytket/decoder.rs index 8c70249b..319856f3 100644 --- a/tket2/src/serialize/pytket/decoder.rs +++ b/tket2/src/serialize/pytket/decoder.rs @@ -7,7 +7,7 @@ use hugr::extension::prelude::{BOOL_T, QB_T}; use hugr::ops::handle::NodeHandle; use hugr::ops::OpType; -use hugr::types::FunctionType; +use hugr::types::Signature; use hugr::{Hugr, Wire}; use itertools::{EitherOrBoth, Itertools}; @@ -44,7 +44,7 @@ impl Tk1Decoder { pub fn try_new(serialcirc: &SerialCircuit) -> Result { let num_qubits = serialcirc.qubits.len(); let num_bits = serialcirc.bits.len(); - let sig = FunctionType::new_endo([vec![QB_T; num_qubits], vec![BOOL_T; num_bits]].concat()) + let sig = Signature::new_endo([vec![QB_T; num_qubits], vec![BOOL_T; num_bits]].concat()) .with_extension_delta(TKET1_EXTENSION_ID); let name = serialcirc.name.clone().unwrap_or_default(); diff --git a/tket2/src/serialize/pytket/op/native.rs b/tket2/src/serialize/pytket/op/native.rs index 23848070..506a6e7f 100644 --- a/tket2/src/serialize/pytket/op/native.rs +++ b/tket2/src/serialize/pytket/op/native.rs @@ -4,7 +4,7 @@ use hugr::extension::prelude::{BOOL_T, QB_T}; use hugr::ops::{Noop, OpTrait, OpType}; use hugr::std_extensions::arithmetic::float_types::FLOAT64_TYPE; -use hugr::types::FunctionType; +use hugr::types::Signature; use hugr::IncomingPort; use tket_json_rs::circuit_json; @@ -136,7 +136,7 @@ impl NativeOp { } /// Returns the dataflow signature for this operation. - pub fn signature(&self) -> Option { + pub fn signature(&self) -> Option { self.op.dataflow_signature() } diff --git a/tket2/src/serialize/pytket/op/serialised.rs b/tket2/src/serialize/pytket/op/serialised.rs index 463f96c1..390c914f 100644 --- a/tket2/src/serialize/pytket/op/serialised.rs +++ b/tket2/src/serialize/pytket/op/serialised.rs @@ -6,7 +6,7 @@ use hugr::ops::custom::{CustomOp, ExtensionOp}; use hugr::ops::{NamedOp, OpType}; use hugr::std_extensions::arithmetic::float_types::FLOAT64_TYPE; use hugr::types::type_param::CustomTypeArg; -use hugr::types::{FunctionType, TypeArg}; +use hugr::types::{Signature, TypeArg}; use hugr::IncomingPort; use serde::de::Error; @@ -107,14 +107,14 @@ impl OpaqueTk1Op { /// `num_bits` bit inputs, followed by `num_params` `f64` inputs. It has /// `num_qubits` qubit outputs followed by `num_bits` bit outputs. #[inline] - pub fn signature(&self) -> FunctionType { + pub fn signature(&self) -> Signature { let linear = [ vec![QB_T; self.num_qubits], vec![BOOL_T.clone(); self.num_bits], ] .concat(); let params = vec![FLOAT64_TYPE; self.num_params]; - FunctionType::new([linear.clone(), params].concat(), linear) + Signature::new([linear.clone(), params].concat(), linear) .with_extension_delta(TKET1_EXTENSION_ID) } diff --git a/tket2/src/serialize/pytket/tests.rs b/tket2/src/serialize/pytket/tests.rs index f6e8c760..150e50b5 100644 --- a/tket2/src/serialize/pytket/tests.rs +++ b/tket2/src/serialize/pytket/tests.rs @@ -8,7 +8,7 @@ use hugr::extension::prelude::{BOOL_T, QB_T}; use hugr::hugr::hugrmut::HugrMut; use hugr::std_extensions::arithmetic::float_types::{ConstF64, FLOAT64_TYPE}; -use hugr::types::FunctionType; +use hugr::types::Signature; use hugr::HugrView; use rstest::{fixture, rstest}; use tket_json_rs::circuit_json::{self, SerialCircuit}; @@ -134,7 +134,7 @@ fn compare_serial_circs(a: &SerialCircuit, b: &SerialCircuit) { fn circ_preset_qubits() -> Circuit { let input_t = vec![QB_T]; let output_t = vec![QB_T, QB_T]; - let mut h = DFGBuilder::new(FunctionType::new(input_t, output_t)).unwrap(); + let mut h = DFGBuilder::new(Signature::new(input_t, output_t)).unwrap(); let [qb0] = h.input_wires_arr(); let [qb1] = h.add_dataflow_op(Tk2Op::QAlloc, []).unwrap().outputs_arr(); @@ -161,7 +161,7 @@ fn circ_preset_qubits() -> Circuit { fn circ_measure_ancilla() -> Circuit { let input_t = vec![QB_T]; let output_t = vec![BOOL_T, BOOL_T]; - let mut h = DFGBuilder::new(FunctionType::new(input_t, output_t)).unwrap(); + let mut h = DFGBuilder::new(Signature::new(input_t, output_t)).unwrap(); let [qb] = h.input_wires_arr(); let [anc] = h.add_dataflow_op(Tk2Op::QAlloc, []).unwrap().outputs_arr(); @@ -190,7 +190,7 @@ fn circ_measure_ancilla() -> Circuit { fn circ_add_angles_symbolic() -> Circuit { let input_t = vec![QB_T, FLOAT64_TYPE, FLOAT64_TYPE]; let output_t = vec![QB_T]; - let mut h = DFGBuilder::new(FunctionType::new(input_t, output_t)).unwrap(); + let mut h = DFGBuilder::new(Signature::new(input_t, output_t)).unwrap(); let [qb, f1, f2] = h.input_wires_arr(); let [f12] = h @@ -208,7 +208,7 @@ fn circ_add_angles_symbolic() -> Circuit { #[fixture] fn circ_add_angles_constants() -> Circuit { let qb_row = vec![QB_T]; - let mut h = DFGBuilder::new(FunctionType::new(qb_row.clone(), qb_row)).unwrap(); + let mut h = DFGBuilder::new(Signature::new(qb_row.clone(), qb_row)).unwrap(); let qb = h.input_wires().next().unwrap(); @@ -260,9 +260,9 @@ fn json_file_roundtrip(#[case] circ: impl AsRef) { /// /// Note: this is not a pure roundtrip as the encoder may add internal qubits/bits to the circuit. #[rstest] -#[case::meas_ancilla(circ_measure_ancilla(), FunctionType::new_endo(vec![QB_T, QB_T, BOOL_T, BOOL_T]))] -#[case::preset_qubits(circ_preset_qubits(), FunctionType::new_endo(vec![QB_T, QB_T, QB_T]))] -fn circuit_roundtrip(#[case] circ: Circuit, #[case] decoded_sig: FunctionType) { +#[case::meas_ancilla(circ_measure_ancilla(), Signature::new_endo(vec![QB_T, QB_T, BOOL_T, BOOL_T]))] +#[case::preset_qubits(circ_preset_qubits(), Signature::new_endo(vec![QB_T, QB_T, QB_T]))] +fn circuit_roundtrip(#[case] circ: Circuit, #[case] decoded_sig: Signature) { let ser: SerialCircuit = SerialCircuit::encode(&circ).unwrap(); let deser: Circuit = ser.clone().decode().unwrap(); diff --git a/tket2/src/utils.rs b/tket2/src/utils.rs index 55af83a9..52876871 100644 --- a/tket2/src/utils.rs +++ b/tket2/src/utils.rs @@ -10,7 +10,7 @@ use hugr::Hugr; use hugr::{ builder::{BuildError, CircuitBuilder, Dataflow, DataflowHugr}, extension::prelude::QB_T, - types::FunctionType, + types::Signature, }; use crate::circuit::Circuit; @@ -27,7 +27,7 @@ where { let qb_row = vec![QB_T; num_qubits]; let signature = - FunctionType::new(qb_row.clone(), qb_row).with_extension_delta(float_types::EXTENSION_ID); + Signature::new(qb_row.clone(), qb_row).with_extension_delta(float_types::EXTENSION_ID); let mut h = FunctionBuilder::new("main", signature)?; let qbs = h.input_wires(); @@ -52,7 +52,7 @@ where let mut builder = ModuleBuilder::new(); let circ = { let qb_row = vec![QB_T; num_qubits]; - let circ_signature = FunctionType::new(qb_row.clone(), qb_row); + let circ_signature = Signature::new(qb_row.clone(), qb_row); let mut dfg = builder.define_function("main", circ_signature)?; let mut circ = dfg.as_circuit(dfg.input_wires()); f(&mut circ)?;