Este vídeo pertenece al curso Introduction to Quantum Computing with Qiskit (with IBM Quantum) de openHPI. ¿Quiere ver más?
An error occurred while loading the video player, or it takes a long time to initialize. You can try clearing your browser cache. Please try again later and contact the helpdesk if the problem persists.
Scroll to current position
- 00:00hi again so now that you have done a recap of the fundamentals of quantum computing
- 00:06you are ready to start doing the handsome part and the first
- 00:10tool that we will use today it's the quantum composer
- 00:23so let's go back to the platform that we have already explored before
- 00:29let's go to the first tool so i will just click on launch composer
- 00:36and you will probably see something different than these but
- 00:40i have prepared it so that we can see
- 00:43piece by piece what we can use so here in view you have
- 00:48different things that you can set up the first one is what
- 00:52are the things that you're going to see
- 00:54so the first one that we're going to explore it's the graphical
- 00:57editor and when we click on it it appears here
- 01:02yes about the style you can also change the theme and you can
- 01:08make it colored or not
- 01:11depending on what you like best
- 01:15and so here basically we have a graphical editor it's line
- 01:19represents our quantum register and then the lines below represent
- 01:23the classical register where we will store the output
- 01:27of the measurements we can click on the first one and we can
- 01:32add as many as we want so for instance now let's add
- 01:37up to five Qubits it's the biggest
- 01:43processor we have access to
- 01:45i'm going to delete what we have here already we can give
- 01:51it a name so that it's saved everything we do it's automatically
- 01:56saved when we do some changes but you have to remember to give it a name
- 02:01as you can see we can also
- 02:07add more registers if we measure Qubits we will need
- 02:11as many classical register as quantum registers so that's why
- 02:15i have added here five so the number indicates how many classical registers we have
- 02:21and now let's build our first circuit so here on the left you have all the
- 02:30different gates that you can use for building your circuit
- 02:37depending on how many Qubits you have as you see there are some that
- 02:42appear in gray so for instance this
- 02:48gate here needs four Qubits so automatically when you don't
- 02:52have enough Qubits you cannot select it
- 02:56and we have different operations so we have
- 03:01the most widely use gates
- 03:05combining them we can create almost any gate
- 03:09and you also have some other operations such as initializing
- 03:14to zero you have barriers you have measurements etcetera
- 03:21and also there is the possibility to create
- 03:24a custom operation
- 03:29but we will talk about that a little bit later in the example
- 03:33so now for the first example that we are going to do we will
- 03:36only need two Qubits so i'm going to
- 03:40decrease the number of classical registers and Qubits we have two Qubits q[0], q[1]
- 03:45one and we have two classical registers
- 03:49so the first thing that we're going to do is using Hadamard gate
- 03:53that you already saw in the recap
- 03:56and we're going to put it apply it to the first Qubit both
- 04:01of them are initialized to zero automatically if you don't do anything else
- 04:06you have to assume that by default they are initialized to zero
- 04:10and now we are going to apply a
- 04:13CNOT gate and we are going to measure both Qubits
- 04:20here you can change
- 04:24the visualizations seed let's put whatever
- 04:31and you can set up the rest of settings of your experiment
- 04:37so first thing we have to do it's choosing a Backend that has
- 04:41enough Qubits for us to execute
- 04:44this experiment and in this case we're going to be using the
- 04:48qasm simulator as i explained earlier it's a simulator that mimics the
- 04:54behaviour of an actual device so this is the one that we are going to use
- 04:59because the rest of the devices
- 05:02are available for free for everyone with an account so there
- 05:07might be a queue usually you have a five units five jobs that
- 05:15that you can execute simultaneously so when you send the job to a Backend
- 05:21automatically one of these jobs
- 05:25disappears and when you get your results back you get your job back
- 05:29but keeping in mind that this is just a demo and anyway the
- 05:35the qasm simulator will mimic the behaviour of an actual
- 05:39device that's the one we're going to use right now it can simulate up
- 05:43to thirty two Qubits so we're good in terms of the number of Qubits
- 05:48and the other thing that we can select is the number of shots
- 05:53so the number of shots it's how many times this will be repeated
- 05:57because the result will be a probability distribution
- 06:02and therefore we need to repeat the execution of the circuits many times
- 06:06to estimate what's the probability of observing each of the states
- 06:14so we are going to give it a name
- 06:18and we will leave the default number of shots which is
- 06:23one thousand and twenty four (1024)
- 06:25and we will run it on our device
- 06:32so now our job should appear here
- 06:38in composer jobs it says it's already
- 06:44finished and we can have a preview here
- 06:49there are more details about the time it took how much the
- 06:54different steps that were done first
- 06:59the job was created and it was transpiled validated in queue and
- 07:04then running
- 07:07we can also check more details about what happened where it
- 07:13was executed and when the number of shots the job id that identifies uniquely this concrete
- 07:19job and then the result is shown in our histogram
- 07:24so of these one thousand and twenty four shots we observe the one one (11)
- 07:31state five hundred and fifteen (515) times and the zero zero (00) state
- 07:37five hundred and nine (509) times and if we want to see it into
- 07:41more detail we can also always come here and see the complete
- 07:46information even the transpiled circuit which in this case it's
- 07:52the same as the original circuit because
- 07:56since we run it in the qasm simulator
- 08:00the qasm simulator has basis gates both H and CNOT but if
- 08:05we had run it in another Backend
- 08:07the transpiled circuit would be different
- 08:10you can also check the qasm code that is
- 08:13equivalent to our experiment to the circuit that we created
- 08:18and also how it would be done with Qiskit
- 08:23okay so coming back to our composer tool
- 08:29let's hide this and let's see what are the things we can explore
- 08:35so in the view there is also other things that we can enable
- 08:41first one is a code editor that appears here on the right and here we can
- 08:46take directly as we create it i'm going for example delete this
- 08:53so that you can see how it changes automatically and maybe add some
- 08:59gates and as you can see they appeared here
- 09:04and they give us the equivalent code in Qiskit or in OpenQASM
- 09:09so depending on the kind of user that we are
- 09:12or on the kind of experiment that we are doing at a concrete time
- 09:16it might be interesting for us to have one code or the other
- 09:24so what are the things can we check
- 09:28we also have some of the
- 09:31graphics that we can
- 09:34explore so one is the Statevector that gives us
- 09:38the amplitude - if we have a
- 09:43measurement then it's before measurement, otherwise it will be after
- 09:49so here we can see the actual amplitudes that then resulted
- 09:53into the probability distribution that we observed
- 09:56that we observed in the experiment
- 10:02besides that it might be also interesting for us to see
- 10:08what would be the probabilities
- 10:11after measuring so this is also simulated here even before executing the experiment
- 10:18so that we can also have an idea if we are doing what we are supposed to do
- 10:23finally we also have
- 10:26visualization which is the Q-sphere
- 10:29that is the visualization we use when we have multiple Qubits
- 10:33and it enables us to also understand
- 10:38what's going to be the state after applying all these gates
- 10:43and with that we conclude
- 10:47we conclude the composer demo
- 10:50there will be an exercise that you can do to get more
- 10:55familiar with the platform and you are welcome to play around with it
- 11:01keep and execute your first experiments in the quantum devices
- 11:08so with that in the next video we're gonna move to the quantum
- 11:13lab and to start coding with Qiskit
- 11:16thank you so much for watching and looking forward to seeing
- 11:18you in the next video
To enable the transcript, please select a language in the video player settings menu.