Codebook: Multi-Qubit Gate Challenge

Ask here about the “Multi-Qubit Gate Challenge” Codebook topic from the “Circuits with Many Qubits” module.

Can someone help me understand why my code doesn’t work

IMPLEMENT THE MULTIPLEXER

# IF STATE OF FIRST TWO QUBITS IS 01, APPLY X TO THIRD QUBIT
qml.MultiControlledX(wires=[0, 1, 2], control_values='01')

# IF STATE OF FIRST TWO QUBITS IS 10, APPLY Z TO THIRD QUBIT
qml.Hadamard(wires=2)
qml.MultiControlledX(wires=[0, 1, 2], control_values='10')
qml.Hadamard(wires=2)

# IF STATE OF FIRST TWO QUBITS IS 11, APPLY Y TO THIRD QUBIT
qml.S(wires=2)
qml.Toffoli(wires=[0, 1, 2])
qml.adjoint(qml.S)(wires=2)

thanks

Hi @yoshypdf , welcome to the Forum!

You’re probably getting this error

Error: Your circuit does not have the correct action on |11>.

So you know that the problem is in the last section.
There you’ve got all the right components but some aren’t in the right order. I hope this hint helps you!

Thank you, that was helpful, I managed to solve my issue !

1 Like