Before we write a program that implements Shor's code, we need a way to read in an arbitrary Pauli error, which brings us to our first codercise. Shor's code can even decode multi-qubit Pauli errors. So let's create a function that can generate any error we please. We'll use this extensively going forward.
The function that is available to you is called error
. It takes two keyword
arguments:
error_type
: a string associated with the error you'd like to create andwires
: a list
of wires that the error acts on.For example, if you want to create a error(error_type = "Y", wires = [7])
. If you want to create an error(error_type = "XYZ", wires = [4, 5, 1])
.
The error
function will return a list of Pennylane operators associated to
each error. For example, for the error
would
return [qml.PauliX(4), qml.PauilY(5), qml.PauliZ(1)]
.
You try!
To interact with codercises, please switch to a larger screen size.
Learning Objectives: