Skip to content

Commit

Permalink
Feat: Add factory_count param to get_physical_cost and add distillati…
Browse files Browse the repository at this point in the history
…on/computational qubit value for CostEstimate
  • Loading branch information
SebastianMorawiec authored Nov 22, 2023
1 parent f4671ac commit 19fda16
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/benchq/resource_estimation/_footprint_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ class MagicStateFactory:
@dataclasses.dataclass(frozen=True, unsafe_hash=True)
class CostEstimate:
physical_qubit_count: int
physical_computation_qubit_count: int
physical_distillation_qubit_count: int
duration: float
algorithm_failure_probability: float
widget_name: str
Expand Down Expand Up @@ -64,7 +66,7 @@ def estimate_cost(self) -> CostEstimate:
* (1 + self.routing_overhead_proportion)
)
)
n_physical_qubits_used_for_clifford_circuit = (
n_physical_qubits_used_for_computation = (
n_logical_qubits_used_for_computation
* _physical_qubits_per_logical_qubit(self.logical_data_qubit_distance)
)
Expand All @@ -84,7 +86,7 @@ def estimate_cost(self) -> CostEstimate:

V_computation = (
self.proportion_of_bounding_box
* n_physical_qubits_used_for_clifford_circuit
* n_physical_qubits_used_for_computation
* total_distillation_cycles
)
data_failure = (
Expand All @@ -96,8 +98,10 @@ def estimate_cost(self) -> CostEstimate:
)

return CostEstimate(
physical_qubit_count=n_physical_qubits_used_for_clifford_circuit
physical_qubit_count=n_physical_qubits_used_for_computation
+ n_physical_qubits_used_for_distillation,
physical_computation_qubit_count=n_physical_qubits_used_for_computation,
physical_distillation_qubit_count=n_physical_qubits_used_for_distillation,
duration=total_distillation_cycles * self.surface_code_cycle_time,
algorithm_failure_probability=min(1.0, data_failure + distillation_failure),
widget_name=self.widget.details,
Expand Down Expand Up @@ -235,6 +239,7 @@ def cost_estimator(
portion_of_bounding_box=1.0,
routing_overhead_proportion=0.5,
hardware_failure_tolerance=1e-3,
factory_count: int = 4,
):
"""
Produce best cost in terms of physical qubits and real run time based on
Expand All @@ -255,7 +260,7 @@ def cost_estimator(
toffoli_count=num_toffoli,
t_count=num_t,
max_allocated_logical_qubits=num_logical_qubits,
factory_count=4,
factory_count=factory_count,
routing_overhead_proportion=routing_overhead_proportion,
proportion_of_bounding_box=portion_of_bounding_box,
)
Expand Down
2 changes: 2 additions & 0 deletions src/benchq/resource_estimation/openfermion_re.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ def get_physical_cost(
routing_overhead_proportion=0.5,
hardware_failure_tolerance=1e-3,
decoder_model=None,
factory_count: int = 4,
) -> OpenFermionResourceInfo:
"""Get the estimated resources for single factorized QPE as described in PRX Quantum
2, 030305.
Expand All @@ -265,6 +266,7 @@ def get_physical_cost(
surface_code_cycle_time=architecture_model.surface_code_cycle_time_in_seconds,
routing_overhead_proportion=routing_overhead_proportion,
hardware_failure_tolerance=hardware_failure_tolerance,
factory_count=factory_count,
)

decoder_info = get_decoder_info(
Expand Down

0 comments on commit 19fda16

Please sign in to comment.