From 39fa8653a03bca8a9d11474dc237941bc3463ea4 Mon Sep 17 00:00:00 2001 From: Seyon Sivarajah Date: Fri, 6 Sep 2024 12:28:55 +0100 Subject: [PATCH] use zzphase for crz --- tket2-hseries/src/extension/hseries.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tket2-hseries/src/extension/hseries.rs b/tket2-hseries/src/extension/hseries.rs index 5762e994..1c9d3aae 100644 --- a/tket2-hseries/src/extension/hseries.rs +++ b/tket2-hseries/src/extension/hseries.rs @@ -337,22 +337,19 @@ pub trait HSeriesOpBuilder: Dataflow { fn build_crz(&mut self, a: Wire, b: Wire, lambda: Wire) -> Result<[Wire; 2], BuildError> { // gate crz(lambda) a,b // { + // ZZPhase(-lambda/2) a, b; // Rz(lambda/2) b; - // cx a, b; - // Rz(-lambda/2) b; - // cx a, b; // } let two = self.add_load_const(Value::from(ConstF64::new(2.0))); let lambda_2 = self .add_dataflow_op(FloatOps::fdiv, [lambda, two])? .out_wire(0); - let b = self.add_rz(b, lambda_2)?; - let [a, b] = self.build_cx(a, b)?; let lambda_minus_2 = self .add_dataflow_op(FloatOps::fneg, [lambda_2])? .out_wire(0); - let b = self.add_rz(b, lambda_minus_2)?; - let [a, b] = self.build_cx(a, b)?; + + let [a, b] = self.add_zz_phase(a, b, lambda_minus_2)?; + let b = self.add_rz(b, lambda_2)?; Ok([a, b]) }