From aa312366200f6ec42845e7cdd5b5afc8ebfb254b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lie=20Gouzien?= Date: Fri, 30 Aug 2024 20:32:29 +0200 Subject: [PATCH] Fix the number of routing qubits in the factories. --- src/estimates.rs | 13 ++++++++----- src/factories.rs | 12 +++++++++--- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/estimates.rs b/src/estimates.rs index 545279e..b584714 100644 --- a/src/estimates.rs +++ b/src/estimates.rs @@ -25,12 +25,13 @@ impl AliceAndBobEstimates { #[must_use] /// Count the number of physical qubits, routing qubits included. pub fn physical_qubits(&self) -> u64 { - // Routing qubits must be added to ensure all-to-all connectivity + // "Vertical" routing qubits must be added to ensure all-to-all connectivity // Formula from arXiv: 2302.06639, p. 27. `logical_qubits()` include the "horizontal - // routing qubits". + // routing qubits", including the one between the computation qubits and factories. let additional_routing_qubits = 2 - * ((3 * self.layout_overhead().logical_qubits() - + self.toffoli_factory_part().map_or(0, FactoryPart::copies) * 6) + * ((3 + * (self.layout_overhead().logical_qubits() + + self.toffoli_factory_part().map_or(0, FactoryPart::copies) * 5)) - 1); self.0.physical_qubits() + additional_routing_qubits } @@ -111,7 +112,9 @@ impl Display for AliceAndBobEstimates { writeln!( f, "factories distance: {}", - self.toffoli_factory_part().expect("No factory part").factory() + self.toffoli_factory_part() + .expect("No factory part") + .factory() )?; writeln!(f, "factory fraction: {:.2}%", self.factory_fraction())?; writeln!(f, "─────────────────────────────") diff --git a/src/factories.rs b/src/factories.rs index f34b31b..a8bf30f 100644 --- a/src/factories.rs +++ b/src/factories.rs @@ -76,11 +76,17 @@ impl estimates::Factory for ToffoliFactory { /// Number of physical qubits in each factory. /// - /// Each Toffoli factory requires 4 logical qubits, see - /// [arXiv:2302.06639](https://arxiv.org/abs/2302.06639) (p. 27). + /// Each Toffoli factory requires 4 logical qubits + 1 "horizontal" routing qubit, + /// see [arXiv:2302.06639](https://arxiv.org/abs/2302.06639) (p. 27). + /// The routing qubit under the factories is associated with the compute qubits. + /// + /// Note that the formula might not be exact when factories internal distance is + /// different than the main code distance, but it is negligeable. + /// Additionnaly, note that that is might not even be a real problem as only one of the 4 + /// factory qubit needs to be accessed through all it's physical qubits. fn physical_qubits(&self) -> u64 { let num_logical_qubits: u64 = 4; - let horizontal_routing_qubits = num_logical_qubits.div_ceil(4) + 1; + let horizontal_routing_qubits: u64 = 1; (num_logical_qubits + horizontal_routing_qubits) * (2 * self.code_distance as u64 - 1) }