![]() ![]() ![]() It switches the amplitudes associated with the 0 basis and the 1 basis, and so it turns 0s to 1s and 1s to 0s. What the X gate does is flip the qubit’s vector over the x axis in quantum space. We write two lines of code qc_one.x(0) and qc_one.x(1) to add X gates to the first two quantum gates. The two digits that we will add will be stored on qubits 0 and 1. Then, we define a quantum circuit called qc_one which has four qubits and two classical bits. Right now, we are going to assume that these numbers have already been converted to binary. Of course, the basic component of any calculator is to be able to add two digits together. The purpose of this article is just to go over how I did that. So, because I wanted to get a feel for how these gates work in the context of a quantum circuit, I decided to code a “number adder” (also called a calculator :)) which is capable of adding together two numbers using IBM’s quiskit python library. These algorithms leverage quantum gates which are analogous to the gates in a classical computer in that they take in qubits (the quantum parallel of bits) as input and return an output based on the combination. Now the way quantum computers go about solving certain problems is using algorithms - sets of instructions which tell the computer what to do and when to do it in order to arrive at a certain result. For instance, factoring huge numbers for bank encryption, simulating complex molecules for drug synthesis and optimizing circuits for energy storage. So, a couple weeks ago, I got pretty interested in this whole idea of “quantum computing” - a concept which is often described as having the potential to enable certain computing tasks that would be totally infeasible to impossible on a standard computer. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |