Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create data classes used by the Azure physical costing model #356

Closed
wants to merge 4 commits into from

Conversation

NoureldinYosri
Copy link
Contributor

part 1 of splitting #327

@NoureldinYosri NoureldinYosri mentioned this pull request Aug 23, 2023
Copy link
Collaborator

@mpharrigan mpharrigan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initial review.

This is still a large PR. it might move more quickly if we can iterate on smaller chunks

Comment on lines 35 to 40
algorithm_qubits = _PRETTY_FLOAT # Number of algorithm qubits $Q_{alg}$
measurements = _PRETTY_FLOAT # Number of measurements $M_R$.
t_gates = _PRETTY_FLOAT # Number of T gates $M_T$.
toffoli_gates = _PRETTY_FLOAT # Number of Toffoli gates $M_{Tof}$.
rotation_gates = _PRETTY_FLOAT # Number of Rotations $M_R$.
rotation_circuit_depth = _PRETTY_FLOAT # Depth of rotation circuit $D_R$.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these comments are redundant with the attributes section. You can put the latex in the attributes docstring

qualtran/surface_code/algorithm_specs.py Outdated Show resolved Hide resolved
qualtran/surface_code/algorithm_specs.py Outdated Show resolved Hide resolved


@frozen
class AlgorithmSpecs:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spec? that's short for specification. This doesn't really specify an algorithm. These are properties of an algorithm

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this class redundant with magic_state_factory.MagicStateCount? Can you refactor to remove code duplication

"""AlgorithmSpecs is a summary of a quantum algorithm/circuit.

Attributes:
algorithm_qubits: Number of qubits used by the algorithm.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each of these defaults to zero. Is this a sensible default? Please document this fact somewhere in the docstring since there is indirection in the attribute field type

Comment on lines +48 to +49
def physical_qubits(self, code_distance: int | np.ndarray) -> int | np.ndarray:
"""Computes number of physical qubits"""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"""The number of physical qubits for the given code distance using this scheme.

also: this needs an abc.abstractmethod or NotImplementedError.

def logical_time_step(
self, code_distance: int | np.ndarray, physical_parameters: PhysicalParameters
) -> float:
"""Computes the logical time step."""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what



@frozen
class QuantumErrorCorrectionScheme:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this abstract?


@frozen
class QuantumErrorCorrectionScheme:
"""QuantumErrorCorrectionScheme represents a quantum error correction scheme.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is an unhelpful line.

A full quantum error correction scheme would include a particular code, decoder, way of doing gates, and many more things. As I understand it: this class captures a small slice of the relevant characteristics of an error correcting code. Consider a more helpful name for this class. And/or consider making this abstract and giving it a concise name (and meaningful names to the implementations).

Comment on lines +31 to +32
error_rate_scaler: Logical error rate coefficient.
error_rate_threshold: Logical error rate threshold.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please document these constants in terms of the mathematical formula in which they appear. I don't think "error_rate_scaler" is a common term and "error_rate_threshold" would imply that this is a property of the code whereas in reality this is yet another fuzzy parameter that captures the empirical behavior of the error suppression.

Note that we measure/target/think about the parameter $\Lambda$ which is $p*/p$ instead of factoring things into the "physical error rate" and the "error rate threshold". Lambda is an experimentally measurable and relevant property.

Copy link
Contributor Author

@NoureldinYosri NoureldinYosri Oct 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is $\Lambda$ equal to $\frac{p*}{p}$ or to $\log{p^*}$?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The definition of lambda definitely includes the physical error rate $p$, so it can't just be $\log p^*$.

you can use https://arxiv.org/abs/2207.06431 as a reference for lambda. It's the error at d divided by the error at d+2; i.e. how much suppression you get by increasing the code distance.

@NoureldinYosri NoureldinYosri marked this pull request as draft October 5, 2023 22:40
@NoureldinYosri NoureldinYosri deleted the physical_data_classes branch November 6, 2023 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants