Exploring multi-qubit quantum logic gates in Silq
In Chapter 3, Multiple Quantum Bits, Entanglement, and Quantum Circuits, you looked at the most important multi-qubit quantum logic gates, which are used frequently to construct quantum circuits. As discussed in that chapter, having multiple qubits gives us an advantage in that we can encode more information in an efficient way. So, we will now dive into multi-qubit quantum logic gates in Silq. Let's start our discussion with the CNOT gate.
The quantum CX or CNOT gate
In Silq, the CX gate is usually created using an if
condition because when the condition becomes true, only then is the target qubit flipped.
Let's see the Silq implementation of the CX gate:
def main() { Â Â return CX(1:,0:); } def CX(const x:,y:):{ Â Â if x{ Â Â Â Â y := X(y); Â Â } Â Â return y; }
In the preceding code, you can see the function of the CX
gate, where the x
qubit (the first qubit...