Skip to content

Error correction with stabilizer codes #1365

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

Open
wants to merge 37 commits into
base: master
Choose a base branch
from

Conversation

alvaro-at-xanadu
Copy link
Collaborator

Before submitting

Please complete the following checklist when submitting a PR:

  • Ensure that your tutorial executes correctly, and conforms to the
    guidelines specified in the README.

  • Remember to do a grammar check of the content you include.

  • All tutorials conform to
    PEP8 standards.
    To auto format files, simply pip install black, and then
    run black -l 100 path/to/file.py.

When all the above are checked, delete everything above the dashed
line and fill in the pull request template.


Title:

Summary:

Relevant references:

Possible Drawbacks:

Related GitHub Issues:


If you are writing a demonstration, please answer these questions to facilitate the marketing process.

  • GOALS — Why are we working on this now?

    Eg. Promote a new PL feature or show a PL implementation of a recent paper.

  • AUDIENCE — Who is this for?

    Eg. Chemistry researchers, PL educators, beginners in quantum computing.

  • KEYWORDS — What words should be included in the marketing post?

  • Which of the following types of documentation is most similar to your file?
    (more details here)

  • Tutorial
  • Demo
  • How-to

Copy link

github-actions bot commented May 7, 2025

👋 Hey, looks like you've updated some demos!

🐘 Don't forget to update the dateOfLastModification in the associated metadata files so your changes are reflected in Glass Onion (search and recommendations).

Please hide this comment once the field(s) are updated. Thanks!

Copy link

github-actions bot commented May 7, 2025

Thank you for opening this pull request.

You can find the built site at this link.

Deployment Info:

  • Pull Request ID: 1365
  • Deployment SHA: 11cafb9b6c04962bced80150738787ae54681488
    (The Deployment SHA refers to the latest commit hash the docs were built from)

Note: It may take several minutes for updates to this pull request to be reflected on the deployed site.

Copy link
Contributor

@daniela-angulo daniela-angulo left a comment

Choose a reason for hiding this comment

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

Such a nice and explanatory demo!

Comment on lines +18 to +21
In this demo, we will introduce the stabilizer formalism using bottom-up approach. We construct and
some well-known codes using the quantum circuit formalism and then derive their **stabilizer generators,** from which
the code can be reconstructed. This enables the construction of a wide range of error correction codes
directly from their stabilizer generators.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
In this demo, we will introduce the stabilizer formalism using bottom-up approach. We construct and
some well-known codes using the quantum circuit formalism and then derive their **stabilizer generators,** from which
the code can be reconstructed. This enables the construction of a wide range of error correction codes
directly from their stabilizer generators.
In this demo, we will introduce the stabilizer formalism using bottom-up approach. We will start by constructing some well-known codes using the quantum circuit formalism. From these circuits, we'll derive their **stabilizer generators,** from which
the code can be reconstructed. This enables the construction of a wide range of error correction codes
directly from their stabilizer generators.

~~~~~~~~~~~~~~~

The first step in an error correction code is **encoding** one abstract or **logical qubit** into a set of many on-device **physical qubits.**
The rationale is that, if some external factor changes the state of one of the qubits, the remaining qubits still provide information about the original logical qubit.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The rationale is that, if some external factor changes the state of one of the qubits, the remaining qubits still provide information about the original logical qubit.
The rationale is that if an external factor changes the state of one of the qubits, the remaining qubits still provide information about the original logical qubit.


..

Let's code this below and verify the output
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's or let us? One is used above, the other here. Probably just change this one because it seems that 'let us' is the most used in the demo.


..

Let's code this below and verify the output
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Let's code this below and verify the output
Let's code this below and verify the output.


- Qubit encoding
- Error detection
- Error correction
Copy link
Contributor

Choose a reason for hiding this comment

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

do you want any punctuation here or it's fine as is?

##############################################################################
#
# .. note::
# In the literature, you may have come across an error correction code being called an ":math:`[n,k]`-stabilizer code." In this notation, the number :math:`n` represents
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# In the literature, you may have come across an error correction code being called an ":math:`[n,k]`-stabilizer code." In this notation, the number :math:`n` represents
# In the literature, you may have come across an error correction code called an ":math:`[n,k]`-stabilizer code." In this notation, the number :math:`n` represents

# .. math::
#
# \begin{align*}
# \vert \bar{0}\rangle = &\frac{1}{4}\left(\vert 00000 \rangle \vert 10010 \rangle + \vert 01001 \rangle + \vert 10100 \rangle + \vert 01010 \rangle - \vert 11011 \rangle - \vert 00110 \rangle \right.\\
Copy link
Contributor

Choose a reason for hiding this comment

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

there is a missing sign here between the first two states

# S_2 = X_0 I_1 X_2 Z_3 Z_4,\\
# S_3 = Z_0 X_1 I_2 Z_3 X_4.
#
# The calculations are a bit cumbersome, but with some patience we can find the common :math:`+1`-eigenspace of the stabilizer generators,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# The calculations are a bit cumbersome, but with some patience we can find the common :math:`+1`-eigenspace of the stabilizer generators,
# The calculations are a bit cumbersome, but with patience, we can determine the common :math:`+1`-eigenspace of the stabilizer generators

#
# \vert \bar{1}\rangle = X\otimes X \otimes X \otimes X \otimes X \vert \bar{0} \rangle.
#
# The logical operators bit-flip and phase-flip are for this code are :math:`\bar{X}= X^{\otimes 5}` and :math:`\bar{Z}=Z^{\otimes 5}.` With these
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# The logical operators bit-flip and phase-flip are for this code are :math:`\bar{X}= X^{\otimes 5}` and :math:`\bar{Z}=Z^{\otimes 5}.` With these
# The logical bit-flip and phase-flip operators for this code are :math:`\bar{X}= X^{\otimes 5}` and :math:`\bar{Z}=Z^{\otimes 5}.` With these

print(f"{error} {wire}", five_qubit_code(1/2, np.sqrt(3)/2, error, wire))
##############################################################################
#
# The syndrome table is printed, and with we can apply the necessary operators to fix the corresponding Pauli errors. The script above is straightforward
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# The syndrome table is printed, and with we can apply the necessary operators to fix the corresponding Pauli errors. The script above is straightforward
# The syndrome table is printed and with it, we can apply the necessary operators to fix the corresponding Pauli errors. The script above is straightforward

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants