Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

iniestarchen/bit-flip-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

3 Commits

Repository files navigation

Bit-Flip Error Correction Code

Category: error-correction | Difficulty: intermediate | Qubits: 3 | Gates: 8 | Depth: 6

The 3-qubit bit-flip code encodes a logical qubit |ps> _L = a|0> _L + b|1> _L into the physical state a|000> + b|111> . If any single qubit undergoes a bit-flip (X error), the syndrome measurement identifies the faulty qubit and a correction is applied. This circuit encodes the initial state, applies a simulated error on q[1], then performs syndrome-based majority-vote correction.

Expected Output

c[0]=0 (logical |+> decoded correctly despite X error on q[1])

Circuit

The OpenQASM 2.0 circuit is in circuit.qasm.

OPENQASM 2.0;
include "qelib1.inc";
// Bit-flip (repetition) code: encode |+> and correct one X error
qreg q[3];
creg c[1];
// Prepare logical |+> on data qubit q[0]
h q[0];
// Encode: spread to q[1] and q[2]
cx q[0],q[1];
cx q[0],q[2];
// Simulate a bit-flip error on q[1]
x q[1];
// Syndrome extraction and majority-vote correction
cx q[0],q[1];
cx q[0],q[2];
ccx q[1],q[2],q[0];
// Decode: measure logical qubit
h q[0];
measure q[0] -> c[0];

Tags

error-correction bit-flip repetition-code fault-tolerant

References

License

MIT -- part of the OpenQC Algorithm Catalog.

About

3-qubit repetition code that encodes 1 logical qubit and corrects single bit-flip (X) errors.

Topics

Resources

Readme

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors