Programming Quantum Computer is something that is a real tech-savvy and as well as a real tough thing to carry on and in this post, we will be writing our first-ever quantum code with the help of Qiskit. Setting up the whole thing for quantum computers has been discussed in the earlier post.
So let's get doing with our first program that is the introduction to programming.
1. Just like all other codes we will first import the Qiskit and then we will take registers and join a connection between them just like this.
Output-
2. The output is not completed and interesting to make it full we will first apply a gate called Hadamard Gate to the first circuit. Get the output of the same.
Output-
3. After applying the Hadamard gate to the first circuit now it's time to connect the controlled X from 1st circuit to 2nd this works as the if-else statement in other languages.
Output-
4. Now we have a control gate and a Hadamard gate with the circuit so now we can have the entanglement. This made our quantum circuit and now we will be counting the number of Qubits by converting the qubits into the classical bits. For that now we will be writing a program.
Output-
5. So now we will be executing the following program. Before executing always remember to execute it into the normal computer then on the main Quantum simulator. So to simulate the program into the normal computer do as given below.Output-
So with this said we will be then executing our program onto the main quantum simulator of any IBM, Google, or Microsoft. Well then in the next post we will be going through the other higher parts of Quantum simulation and programming.
0 Comments