Primitives | Coding with Qiskit 1.x | Programming on Quantum Computers
작성자 정보
- 작성자 bryanai
- 작성일
컨텐츠 정보
- 조회 1,705
본문
https://www.youtube.com/watch?v=35ykEg3fG4c
Primitives | Coding with Qiskit 1.x | Programming on Quantum Computers
Join us in Episode 4 of "Coding with Qiskit 1.x" as Derek Wang dives deeper into Qiskit Primitives. The Estimator and Sampler primitives, for computing expectation values and sampling of quantum states, simplify interactions with quantum hardware. We'll use practical examples inspired by a pioneering IBM Quantum study featured in Nature.
Whether you're a quantum novice or enthusiast, this tutorial is for you. Like, subscribe, and tune in to expand your quantum programming toolkit!
Qiskit Resources:
GitHub notebook for this episode
Nature Paper "Evidence for the utility of quantum computing before fault tolerance
Primitives | Coding with Qiskit 1.x | Programming on Quantum Computers - YouTube
Transcript:
(00:01) [Music] welcome back to coding with kuit one I'm your host Derek Wong and this is episode four on kkit Primitives in the previous episode recall that we called the quantum Hardware using an estimator an example of a kuit primitive and I promise that we discuss this in more detail so first what is a primitive in Computing A Primitive is the smallest processing instruction for a given abstraction level but simply you can think of Primitives as the simplest building blocks you can give to a user to create something useful from the
(00:38) user's perspective they're black boxes that do something you need but you don't care about the specific details of how and so they abstract away implementation details in the context of quantum Computing a high level user is generally interested in writing Quantum algorithms without worrying about Hardware details based on this good candidates for Primitives have started to emerge an estimator primitive computes expectation values of observables with respect to States prepared by Quantum circuits if you're hearing about
(01:08) expectation values for the first time check out this quick primer below users generally specify a list of circuits observables and possibly some additional configuration with which a program can efficiently evaluate expectation values and variances the sampler primitive returns shotby shot bit strings sampled from the probability distribution of the quantum State prepared on the device importantly while one could could use a sampler to compute expectation values you then might have to implement laws of post-processing
(01:35) yourself that the estimator handles automatically conversely you wouldn't get individual bit strings from the estimator unless you were to break into its internals but this is fine for many applications in Quantum Computing so let's walk through utility scale example of both the sampler and estimator to see how these Primitives simplify Quantum computations in practice the circuits that we'll be using as an example are based on those in IBM quantum's recent nature paper evidence for the utility of
(02:00) quantum Computing before fault tolerance and in this paper they studi the Dynamics of a kicked icing model on 127 cubits so let's head over to our laptop look up these circuits and Implement them on The Primitives okay so the first thing to do is to look up the circuits that we want to run with The Primitives so what I'm going to do is look up the paper now evidence for the utility of quantum Computing you can see I've looked it up before click on the link here and so this is the paper relas just a few
(02:30) months ago where they do the kicked icy model on 127 cubits and compare it against various classical methods so what I'm looking for here is the actual circuit that they run so here you can see the device connectivity 127 cubits and it looks like they use this 2D topology and they have these three layers of gates in between um we might do something a little bit simpler okay and here we go so this is the hamiltonian that they're implementing this is a transverse field icing model model transverse field because they have
(03:01) this x field going in a perpend perpendicular direction from the interactions between the spins that are nearest neighbors marked by this left and right angle bracket here and then when you do the first order trotz you can see that you get these exponentiated forms here and then it results in these layers of RZ Z Gates and these layers of RX Gates here so in terms of a circuit what this turns into is this here you can see that that we have um we can break down each one of these RZ Z interactions into this gate over here so this is all the
(03:39) information we need actually to code up this uh icing circuit is there any other information that we could use here no so what the circuit is going to look like basically is that we're going to Define some connectivity between the cubits and uh the nearest neighbors are then going to be connected by these interactions over here and then we'll have this transverse field being applied to every Cubit after each troter step as well so let's H over to uh our um IDE now this is The Notebook from last episode let me make a new one now
(04:14) so make a new file let's call this um episode 4 Primitives that II Notebook okay so the first thing we want to do is map the problem into circuits and operators what I have in mind now is to show what the sampler can do which is to collect bit strings and so what I want to do here is use this circuit as an example for the sampler and to make it a situation where we care about bit string probabilities what we're going to do is do this trotz icing forward in time and then we're going to do it backwards in time so
(04:55) we'll apply a unary u followed by an inverse unary and the overall result should be that if we start from some state in this case it's going to be the all zero bit string State we should end at the all zero bit string State however because of noise we might find that this probability changes and so instead of having all zeros at the end we might have some other bit strings that come out and that signals that we have some noise and this is a quick and dirty way to measure the strength of our noise using a circuit that we can later use
(05:24) for some interesting applications so the first thing we need to do then is code up this circuit it so let's write this here we're going to be looking at the uh transverse field icing model to demo Primitives and the first thing we need to do now is to make a circuit that allows us to create this transverse field icing model trotterz so let's see what I want to do then is write a function that generates the 1D transverse field icing model circuit and if we go back to this paper you can see that this circuit is defined
(06:06) by the number of cubits that we have the number of Trotter steps that we do in total as well as this angle inside the RX gate here which is proportional to or equal to 2 H delta T which relates to the parameters of the hamiltonian here so let's make this circuit then we're going to have num cubits as an input the number of Trotter steps and then and the RX angle okay so what I do is create the quantum circuit QC equals Quantum circuit and we'll put the num cubits inside here and then for each uh Trotter step
(06:46) in the total number of Trotter steps I want to add one layer of this 1D transverse field icing model in this case I'm doing the 1D model instead of the 2D model in the paper just because it's a little simpler for implementation but one could straightforwardly do that as well I'm going to pass in the quantum circuit the RX angle and that should be it and then I can just return the quantum circuit and now I need to write another function here I need to write the function to add a 1D transfer field icing model Trotter layer to the Circuit
(07:26) it's going to take in these inputs that we have here and see now we have to consult actually the paper to see what they did if we look at the paper here we see that the circuit consist of these layers of RZ Z Gates between nearest neighbors followed by RX Gates on all the cubits so we're going to do that first what I'm going to do is try to compress these Gates because if you notice that if they're going to be between all the nearest neighbors if we just did them naively I equal 0 1 2 3 4 we will get this ladder
(08:01) of RZ Z Gates and that's not as compressed as it could be the depth of the circuit is quite large and we might find that there's more noise from the idle times so a more efficient way to do it is to do it by layers and that's actually what this figure is showing here is they show in the 2D case there are three unique layers you can create those colored by red blue and green in the 1D case you can see how that there's only two layers those between cubits 0 1 2 3 4 five and then those between cubits
(08:32) 1 2 3 4 5 6 Etc so I'll call those the even and odd layers just because the even layers the first index is an even number and in the odd layer the first index is an odd number so let me code that here first let's write the code for adding the RZ Z Gates between in the even layers so for I in range zero and then Q 2 c.
(09:05) num cubits - 1 2 we want to add the RZ Z Gates um one other thing that might be helpful later on is that you can see here that the RZ z g rzz gate can actually be broken into these Gates here so this s dagger s dagger followed by a root y a cot and then a root y inverse and so I'll just use those as well um and break it up maybe it'll help the transpiler later on to merge these Gates together so what I'll do is qc.
(09:32) sdg that stands for S dagger and I'm going to apply it on cubits I and I + 1 because in this case U we're applying to both cubits in a given Cubit pair and then I want to do qc. append s gate I think and apply that onto Cubit I + 1 then I'll do the SC notate that the paper says to do between I and I + 1 followed by the Sy dagger gate on uh Cubit i+ 1 yet again so that should match what's goes on here and if you look carefully you'll see that this Sy gate has this yellow line underneath it in my particular IDE that means that
(10:17) is not defined and so what this is telling me is that well first I need to import as all these packages and Gates that I haven't done so far so let me do that first from KGET import Quantum circuit and then from kit. circuit Library let's see if we can import the s y gate no we don't have that so we do have the SX gate but we don't have the s y gate so instead what I will do is create my own sygate what to so I can import the Y gate and then this generic unitary gate that allows me to create new unitary
(10:56) Gates so I'll write the Sy gate as the unitary gate and it's going to be the Y gate to the square root and I'll label this as this so it's going to be yes this square root y yep and I want to do the same thing for the inverse so in this case the syy dagre gate will simply be the unitary gate of the inverse of the Y gate so I'll take this Sy y gate.
(11:37) inverse and I'll do the square roots and put to the dagger here okay so now what I've done is basically defined my own custom Gates because they weren't originally available in this kitkit circuit library and I'll go back to coding up the circuit now okay so that's RZ Z in the even layers I can do the same thing in the odd layers Now by just starting this from one and then going all the way up to the same exact value and then the final thing to do is to apply this RX gate onto all the cubits
(12:12) so I'll do the same here now so qc. RX and let's apply the RX angle for all of the cubits in the circuit all right and that should be it let's make sure that this out correctly by writing a quick test here so let's say the number of cubits equals 6 we'll set the number of strotter steps to one for now and then let's set the RX angle to let's say 0.
(12:46) 5 times pi oh I need to import num Pi let's get the circuit using our new function by passing in Num cubits the num Trotter steps and the RX angle okay that's it and then let's draw it qc. draw output again MPL to make it look pretty um it might be long circuit say fold equals minus one so it's all on one line and let's try this function out okay that ran just fine and let's hit enter here to see how it looks okay so there we go we can see we have the six Cubit circuit and we're assuming they're all connected nearest
(13:32) neighbor into a 1D chain and we've got the Sager Gates on all cubits followed by the square root of Y followed by the cots between Pairs followed by the square root of Y inverse and Then followed by the same thing on the odd layers here and then we have an RX gate applied to each one this visualization is a little bit confusing so why don't I throw in an extra uh keyword here that allows me to put in barriers if I would like so let's call this um let's have two kinds let's have whether we can have barriers between the
(14:13) even and odd layers and then let's have barriers that are between the different troter steps so we'll say troter barriers default to false and the layer barriers default the false as well and now what we can do is after each Trotter step if Trotter barriers is true then we can add a barrier and then in this case um for the layer barriers why don't we pass this in as well and make this an optional keyword here and if the layer barrier is true then we'll add a barrier between each layer again just for visualization
(14:55) purposes so if layer barriers qc. barrier if layer barriers qc. barrier and finally one more time at the end if layer barriers qc. barrier okay run this again let's pass in uh layer barriers oh Trotter barriers equals true and layer barriers also equals true okay so this is a lot clearer to see now um so these are the gates exactly as shown here for each rzz decomposition on the even layers in the even layer followed by the same thing and the odd layer followed by this RX gate now I can set tro steps to two for example and we can
(15:46) see what happens now now we get this circuit followed by the exact same thing again so it looks like we have the circuit now to generate the one-dimensional transverse field troed icing model okay the next thing to do let's start going into implementing this for the sampler so demo sampler and like I said before for the sampler I'm interested in showing how we can collect information on a bit string by bit string level and so what I want to do is plot the probability of having the all zero bit string after we run the
(16:24) circuit forwards and then backwards so far I've coded the circuit going forwards and now I need to do the same thing for the circuit going backwards so let me do that write that up really quick as well here okay so there is probably a smart way to do this in which I can take each instruction in the given circuit and just invert it but for the sake of clarity what I'll do is actually just create a function that makes a cir but the inverse from right to left and so the most straight forward way to do this
(17:01) might be to just copy and paste all this information here and then just rewrite it so generate mirrored 1D transverse field icing model circuit and we probably also want to make this an in place type method where we pass in a circuit and it doesn't return a new circuit but it just adds G to the Circuit itself so we'll call this a pend mirrored 1D transverse field icing model circuit it'll take as an input the quantum circuit and it'll take the same exact information as before okay so in this case we don't need to
(17:45) redefine the quantum circuit and then for each Trotter step in the range number of Trotter steps we want to add the mirrored 1D transverse field iing model Trotter layer and and we need to make a function for that as well add mirrored 1D tfim Trotter layer and in this case what we're going to do is uh do this first so we're going to add all the single Cub at RX Gates first and to invert it it's as simple as setting the angle to the negative sign so we'll do that here and then we'll uh want to add
(18:22) the RZ Z to all the odd layers so we'll copy and paste this and add it over here and we're going to want to invert all of these Gates over here so this should be pretty straightforward because we know that the inverse of the syy dagger gate is simply the s y gate then we can append the S uh the CATE which is its own inverse then we'll go backwards and take care of this line syy dagger gate and then finally we'll invert uh this s dagger with an S gate oh sorry we don't need this last one and then we can do this exact same
(19:05) thing for the even layers and it might be more straightforward just to co copy and paste this line here and then change this to starting from zero making sure we continue to add the layer barriers if we would like and that should be it so what I've done is just Rewritten this function by taking the old one and now I should mirror everything let's check to see that this all makes oops all makes sense by doing this so now what we can do is take our original Quantum circuit from above and we can say QC mirrored
(19:42) equals append mirrored oh we don't even need to return this actually because we're just adding it directly we'll just do append mirrored 1D transverse field icy model circuit to QC and then pass in all the same variables as before num Trotter steps the RX angle and the same exact keywords as before Trotter barriers equals true layer barriers equals true and now let's see what the new circuit looks like qc.
(20:22) draw output equals npl fold equals minus one and let's make the number of CH STS back to one so the circuit doesn't get too long see how this looks okay cool so yeah it looks like the circuit was inverted properly again this is the original for direction we'll call this U uh for just generic unitary and then you can see the inverse is over here where we have the RX has a negative angle so this should turn into identity and then we have this square root of white dagger that's inverted by this this c not inverts itself square root of
(20:59) Y dagger inverts the square root of Y here these S Gates invert the S dagger the exact same thing happens in this even layer and so overall the the result of the circuit should be that it turns into the identity and so if you start with the all zero State on the left side here we expect to see the all zero State on the right side as well okay so with this done now what we can do is start to follow the steps from kis patterns and remember this is steps 1 2 3 4 map the problem to Circ observable optimize the circuit uh execute it on
(21:32) hardware and finally look at the postprocessed results so let's do that now um let's create the circuits and the observables that we're interested in so step one um let's map the problem to circuits and observables and what the problem is again is we're looking at the effect of noise as we increase the depth of the circuit and so logically what we want to do is increase the number of Trotter steps in this circuit while inverting at every single step and seeing the survivability or the survival
(22:08) probability with all zero bit string so let's say that we want the maximum number of Trotter steps to be 10 the number of cubits to be 100 to make this at the utility scale and let's say that we're interested in the survivability of the all zero bit string for the middle two cubits so let's say that we're going to measure these cubits uh 49 and 50 over here so then for each Trotter step um in the range of Max troter steps what we're going to do is create a quantum circuit list like so so we'll do
(22:48) QC equals generate 1D transverse field icing model circuit pass in the number of cubits as before actually I can just copy and paste this entire line just take that yep and then what I can do is mirror the circuit so that would be the exact same line as here and then what I want to do is measure on just two cubits so I'll take this qc.
(23:24) measure and I will measure on the measured cubits that we input above and assign it to to the classical registers 0 and one and so I need to actually Define that now and then add this to the QC list so what I realized I forgotten to do is to make sure that these Quantum circuits have classical registers in them and so I'll just go to my original function I I designed up here and then put in something that says like the number of classical bits let's say and then make sure that when I instantiate this circuit that I am indeed adding classical bits num
(24:04) classical bits here uh to make this cleaner why don't I say if num classical bits equals zero we'll just create the quantum circuit without a classical register and if not then I will make sure it has a classical register I think that should take care of this make sure it all runs again all right oh index 49 is out of range for size six Ah that's because I didn't redefine the number of cubits that I want so okay CU I forgot to assign it to QC no still doesn't work index Zer is out of range for
(25:03) zero H what's going on here I forgot to pass the number of classical bits into this so yeah that goes here so num classical bits equals the length of measur bits that's it I never created the classical bit register oh measured cubits okay so this should work better now just to make sure why don't we visualize what the very the what it looks like for the first Trotter step QC list at one.
(25:37) draw same as before this might take a while because this is 100 cubits actually so let me stop this and redo this with a smaller circuit same size as before we'll say size eight on cubits four and five in the middle and then try it again okay so you can see we have the circuit going forwards backwards just like before now we have the measurements appended on these middle two cubits over here okay so now we can just change this back to 100 and I'm fairly confident this will work now and we won't draw at
(26:20) this time just make sure it's running but we wanted this to be flexible for the number of classical bits so list range length measured cubits great okay so that's step one step two is now going to be optimize and you can see how straight oops you should be able to see how straightforward this is following a similar workflow as we had before so call step two optimize okay so just like before let's do from kkit import um this time I'll just use the generic transpile function instead of the preset pass manager from
(27:03) kkit IBM runtime import kkit runtime service we're again going to be using IBM Brisbane service oops and then instantiate the service and call the back end cool and now let's do the transpilation for each of these circuits transpile QC list back end equals back end and set the optimization level just a one this time done instantiating in done getting the back end typo optimization level equals 1 okay okay we've got in the back end now
(28:09) we're transpiling 10 circuits on 100 cubits that probably have thousands of gates it should only take a few seconds all right so that was 10 circuits and something like 40 seconds total of which 10 of it was just getting the back end and now let's go to the next step that's taken care of let's execute on hardware and this follows the exact same process as before except now we're using the sampler primitive so from Kiss IBM runtime let's import the new V2 sampler that makes submitting things a
(28:46) lot easier a lot more intuitive and then we'll import sampler options as well do sampler options so we can fine-tune the performance of our particular ular run and so in this case I'll instantiate the sampler by passing in the back end and then I'll change the options oh I actually don't need this line at all then I will just change yes I'll change the options like the sampler.
(29:19) options in this case because I think there's going to be a decent amount of idle time yet again I'm going to turn on dynamically decoupling and I'll also just make sure I set the type of dynamical decoupling xy4 just like before and that's all I need to do to set up this run so then I can just execute by doing sampler.
(29:50) run sending in my list of circuits it should return a job and we're going to print this job ID uh keep simp oh typo there dynamical decoupling ah job. job ID job. jobid method sometimes you just have to guess around okay so that's the job ID let's go over to our IBM Quantum website now to take a look at it see it's popped up in the queue okay there it is you can see I just ran it a few times trying to get the job ID working but it went three times out this is the one that finally we're going to run um these two I don't need but leave
(30:39) them there anyway and so this will take some time to run it's queued up right now and it hasn't told me okay so the weight is going to be about seven hours because right it's a pretty good device and it's got quite a long Q so instead I'm just going to pull up the results for the job that I ran just before this with the exact same settings so we can just take a look at how the results are and then how the postprocessing should be done in step four postprocessing and plotting okay so okay let's first set up
(31:12) and let's get all the values out first let's get the job ID this is the one that I ran before that worked um we have the service set up already so I can just do the job equals service. job and pass in the job ID and and in this case what I'm interested in is the survival probability of the all zero bit string and so I'm going to try to extract that out from from the results here survival probability list and then so for each Trotter step in the max Trotter steps I'm going to try to get the data
(31:52) out job. results for at that particular troter step where there is going to be a different result for each circuit that I passed in get the data out overall and to the survival probability list I'm going to append um the counts for the bit string that has the all zeros in it so it's going to look like this in this case or actually rather 0o times the length of the measured cubits and I'm going to divide that by the total number of shots because that'll then tell me the survival probability list the survival
(32:38) probability and I'm going to have this accept statement because you might find that noise is really really large that we actually get no bit strings that have the all zeros in it and so then if there's some exception that pops up because uh there's no they couldn't get the result that had the all zero bit string then we'll just depend uh zero in that case that means the survival probability is zero okay so let's run that and in the meantime let's get the code ready to do the plotting here
(33:11) oops as plot and let's plot this plot. plot um let's make this the x-axis the depth of the two cubic Gates if you notice that every troter step has the two Cubit depth of four there's two c not Gates of depth in the even layers a c not depth of two in the odd layers so we'll set this to the range of 0 to four times the max Trotter steps in steps of four so this should output um 0 4 8 12 etc for every Trotter step and then we'll plot on the y- axis the survival probability list and give it some
(33:54) markers to visualize on the xaxis we'll call this the 2 cubic gate depth and then on the Y AIS let's call this the survival probability um survival probability of the all zero bit string and then let's also make some X ticks 0444 okay and show it so there we go we we have the results from the sampler you can see we while mapping this problem to the Circuit was quite a few lines to just Build It Up from scratch from the paper it turns out the workflow itself is quite straightforward making the circuits once you have the code to make
(34:40) the circuits optimizing is just a few lines executing is just a few lines with a few simple options you can toggle on and off and finally you've done the post-processing and plotted it and that's the result here you can see as the two cubic gate depth increases all the way up to 40 this is a total number of troter steps 10 which corresponds to a total number of C not Gates of around a thousand on these 100 Cubit circuits you can see that the survival probability starts from one and then drops down close to 0 2 at this level
(35:10) with a little Spike over here and so we're seeing the effects of noise as the circuit increases because remember we know theoretically that this should remain at one if we were to have perfect a perfect quantum computer without any noise but here using very very minimal toggling of the options just turning on some dynamical decoupling uh you can see that the results we get here are pretty high quality already on this utility scale Quantum circuit so the next thing I'm going to do after this is now show
(35:36) you how we can do uh a similar workflow but this time using the estimator to get expectation values out so let's make a new section in this notebook for doing that so here we're going to do the estimator and in this case I want to mimic a result that I saw in the paper that I found pretty interesting it's in one of the later figures here here where they show that as you change the RX angle for this observable this magnetization here this MZ which is I think the sum over all the Zed operators across the circuit or maybe just a
(36:11) single one um you can see that as the RX starts from zero and goes to pi/ 2 that this curve goes from one and then drops over there and I'm curious to see if I can get a similar result out from using the estimator right now on this 1D circuit so to do that first I need to start with step one which is going to be mapping the problem and in this case the estimator has powerful functionality uh and also the sampler they have powerful functionality that allow you to parameterize certain Gates or import parameters and then sweep over them
(36:50) without having to generate a circuit for each one of those and I'm going to show that functionality right here so what we're going to do is use this parameter object here and we're going to say that the RX angle is a parameter that we can vary we're going to call it the RX angle as a string and now we're going to do is generate the 1D transverse field iing model circuit um for some number of Trotter steps and the RX angle from before and then we're going to also now so that's that's the
(37:27) quantum circuit here I'll set the troter steps equals to two just to see what happens to this expectation value after two Trotter steps and um for this circuit that goes out to two Trotter steps we're going to sweep over the RX angle and then measure the magnetization in this case the magnetization uh is going to be not of the average over all the single cubits uh Z operators but let's just look at the single Z expectation value of the middle Cubit so let's map this into operators now from kit. Quantum info let's import spouse
(38:05) sparse P op the middle index is going to be uh the number of cubits back slb2 and then the observable is going to be sparse poly op and we're going to do identities up until the point of this middle index we're going to add the Z operator right there and then we're going to add identity operators for the rest of them okay RX angle um oops yes I need to toine Trotter steps here okay cool so that's taken care of now let's go on to step two step two which is optimize the circuit and I'm going to do the same exact thing
(39:02) as before as in the hello world example so we can just kind of fast forward through this part here I will do from kkit import transpile from Kiss kit IBM runtime import kiss kit runtime service and yet again we're going to set the backend we're going to instantiate the service and we're going to actually get the backend from the service so that we can do the transpilation okay QC transpiled will be the output of the transpile function where we pass on the quantum circuit pass in the backend and set the optimization level
(39:53) in this case just to one now we need to make sure the observables are also in the right format by applying this the layout of the transpiled circuit like that and now that's done too step three let's execute on Quantum hardware and this time to do the execution tion the one thing that's different from before is we need to define the range of values that the parameter can have so after first setting up the estimator and the options or importing them let's um Define the range of RX angles of Interest so let's say that we'll start
(40:50) from zero we want to go up to Pi / 2 and and let's say we want to look at 12 of them in total in this range for Trotter steps equals 2 and the RX angle list oh we don't need this number of TR steps the RX angle list equals mp. Lin space Min RX angle Max RX angle and the total number of angles okay now let's to find the options for the estimator in this case I'm just going to set the resilience level to one just like before this invokes little overhead but takes care of the any sort of um readout measurement uh measurement
(41:41) errors and then we're also going to turn on the dynamical decoupling to help us get rid of Errors during idle times let's instantiate the estimator using these inputs of the backend and the options just to make sure that we pass in that correctly and then finally let's do the run the input here is going to be this Pub format in which we just passed the single circuit that we've transpiled at this point that's only one circuit that's going in but has a parameterized RX value we'll pass in the observables
(42:36) that we want in this case it's just one and then we'll pass in the RX angle list this will be the angles that we sweep over within the parameterized RX angle and all this documentation for the input format for these V2 Primitives is on is on the documentation website and here we're just passing them in as a single tupal as you can see now let's print the job job ID like before just make sure that everything has gone through uh it's not resilience options it's resilience level that's a typo
(43:07) let's try it again and the job's been submitted so here's the job ID again we can go to the IBM Quantum platform make sure that it's gone through yep and there's a job we just submitted it's queed up right now so go to step four now postprocessing and plotting and like before because there's going to be a bit of a time some time to wait for the job to go through the queue I'm just going to pull up a job ID for the exact same settings and everything that I just coded up and I'll paste it
(43:46) here so we have this job ID equals this and let's get the job now in this case getting expectation values is pretty straightforward we get the expectation value list is job. result and print out the expectation values and make a quick plot to show the RX angles and I want to make it look a little bit nicer so I'm going to normalize it by pi on the Y list we're going to have expectation value list and we'll have this particular output format on the X labels we're going to do the uh RX angle angle in units of
(44:39) Pi and in the Y label we will look at the um the expectation value of the single Zed operator in the middle of the chain and then let's set the Y limits to 0.1 to 1.1 for plotting and take a look at the results H okay something about oh this is rx angle list yeah the dimensionality was wrong okay and so you can see here what we have is the plot from 0 to 0 5 pi and remember what I was hoping to get is something that looked like this it starts at one and goes to zero and it looks like we have something like that actually so we start close to
(45:38) one and we go towards zero we as the RX anle equals pi/ 2 of course this is going to be a little bit different because in that experiment they go to a significantly higher depth of five truer steps it's also on a 2d topology whereas we have the 1D but you know intuitively speaking I would expect something close to this and that's exactly what we got starts at one and goes to zero and from this point what we could do is we can increase the Trotter steps we could change the topology to make it more non-trivial from a physics perspective
(46:09) uh there's a lot of room to explore here to explore you know interesting physics of this particular system so I think for a physicist for someone uh looking at materials or chemistry um this is a really exciting time to be in because now we're looking at these 100 cbit circuits and getting results that are um competitive in some cases with classical Hardware so in this video we showed how access to Quantum Hardware is simplified with Primitives a fundamental feuture of kkit one we looked at Samplers and
(46:38) estimators with examples inspired by IBM's recent nature paper showing evidence of the utility of Quant of computing before fault tolerance I encourage you to explore different air suppression and mitigation techniques to see if you can do even more interesting complex calculations on quantum computers with over 100 cubits our next stop will be Pro programming Dynamic circuits a powerful technique in Quantum computation recently enabled in kkit one and available in IBM's quantum computers thanks for watching like And subscribe
(47:07) and see you next time [Music]
관련자료
-
링크
-
이전
-
다음작성일 2024.06.22 23:05
댓글 0개
등록된 댓글이 없습니다.