Placeholder Image

字幕列表 影片播放

  • what is going on?

  • Everybody and welcome to the future.

  • Welcome to part three of the quantum computer programming tutorials.

  • In this tutorial, we're gonna be getting into our very first algorithm, which is the Deutsche Gyoza algorithm.

  • Now.

  • This algorithm is relatively pointless in what its actual outcome is, but instead what it what?

  • It's good for his 22 things.

  • Really.

  • One is it really is an algorithm that is provably faster than a quantum computer in terms of how many like, say, cycles through the circuit are required to get the answer, but also the reason it's more so.

  • It's not just the speed, it's why is it faster?

  • So this is the first time you should get a riel, uh, idea and feeling for how is this working?

  • And then and why is this working?

  • Because the reason why it works is the circuit is able to consider all of the possible inputs that could have come into the circuit, and it can immediately respond with the with the output.

  • So in the output is not output based on input, its output based on the nature of the circuit.

  • And so that's what's cool about this algorithm.

  • It's not the it's not the actual result of the outer rhythm.

  • And I think that point gets lost on a lot of people.

  • Least when I'm looking around at explanations and stuff of the Deutsche shows algorithm as well as some of the others, like the Bernstein boss Ronnie, and even shores out rhythm.

  • Although we I think most people will understand Oh, it breaks encryption.

  • Cool.

  • Okay, but the Deutsche Rosa out rhythm is the inspiration behind Bernstein vase Ronnie Shores out rhythm, and I'm sure many others because it shows.

  • And this was kind of the 1st 1 that shows Ah, you could do this.

  • Stuff like this is these are things that you just can't do with the regular a classical circuit.

  • So let me just formulate really quickly.

  • I don't want to spend too much time explaining some problem, but it would probably be useful to explain the problem.

  • So with the Deutsche Cosa algorithm, you've got a function right.

  • So the function is your black box, and let's say you're gonna passed a two bit string to this box.

  • And the question that we want to answer is is this black box going thio output a constant output, or will the output be a balanced outputs?

  • So will this box always output all zeroes or all ones?

  • Or will it output zeros and ones in a balanced manner?

  • So uneven number of zeros and ones.

  • So with a classical circuit, the only way that you could find this out is it is that minimum to you would need to outputs from the machine.

  • So if we got a two bit string, um, it's going to take it leased to queries, because on the second query, you could find that there's, ah, let's say, on the first query.

  • The result is a 00 The second query.

  • You got a 01 right, and when I say query, I mean, like, passed through the circuit.

  • So to find out if a circuit is balanced or constant on a two bit string, it's going to take it least two passes.

  • As we increase the number of bits in the string that we want to pass through this function, it's going to take longer and longer and longer for a classical circuit to be able to make this determination a quantum circuit.

  • On the other hand, can make this determination regardless of how long that bit string is in one pass.

  • And this is what shows the power of quantum circuits.

  • And again, the problem itself is not useful.

  • It's just this is the most basic representation that we can come up with that shows the attributes that quantum circuits have that classic circuits do not have.

  • So don't get hung up on the problem.

  • Um, get hung up on why this solves this problem.

  • So with that out of the way, let's go ahead and get into it.

  • So to begin, uh, this all rests on a term that I'm gonna coin as had a mard sandwiches.

  • So again, like I said in part one, I'm not a quantum physics expert, okay?

  • I'm not even a physics expert.

  • I'm really not an expert of anything.

  • So But remember, you're just watching the dude on YouTube.

  • So?

  • So I'm gonna use words here that I feel describe what's going on, but they're probably the wrong word.

  • So, um, so, yeah, just just bear with me there.

  • If you're like an actual you know, PhD person, um, feel free to correct me and tell me that the word is correct.

  • And if I've somehow stolen had a mard sandwiches, I apologize.

  • I'm pretty confident.

  • Never seen that anywhere.

  • But that's what it looks like.

  • It's just had words on another on all the sides.

  • So you're just squishing something between Hatem Arts.

  • It's You had a marked sandwich.

  • So anyway, if there's an official term for it, let me know.

  • Uh, so to begin.

  • Well, we're probably need some some of our initial imports, huh?

  • Um, I don't really want to take this out.

  • Everyone should have these.

  • So I'm not gonna do that again.

  • It's a waste of time.

  • So we will have kiss kit.

  • We'll have her.

  • I did check this, by the way.

  • I'm sure by the time this video's coming out after a part too, but I'm sure people will correct me, but I don't know which one is that the new one?

  • But this happens all the time in libraries.

  • I'm gonna go with the shorter one.

  • Uh, but you can import both of these from the shorter one.

  • So cool.

  • So, um yeah, All this stuff is stuff.

  • You seem so the first thing I want to do is show you um, this Hatem art sandwich on, um, What I'm also going to call uncertain cubits.

  • And when I say an uncertain Cuba, this is a cubit that will collapse.

  • Not always to the same, um, to the same answer.

  • So to begin, let's say we've got a circuit and that's going to be a quantum circuit, and we'll give it will make it a 22 and two so two cubits to classical bits.

  • Uh, and then we'll say rotation on the why, and we'll go with math, not pi divided by four on Cuba zero.

  • And then we're just going to do the same thing to Cuba at Index one.

  • So that's our two cubits are done.

  • And then what we're gonna say is I'm gonna call this a Ridge state back, and that's going to be equal to q dot Exe cute.

  • And we're gonna execute the circuit on the back end of this state vex simulator.

  • So just remember, you need if you want to get the state vector's have to do it before you actually take the measurement.

  • Otherwise the circuit will have collapsed and you state vector won't work.

  • I mean, work.

  • It just won't give you what you hoped.

  • So ST Maxim, uh and then we're going to say, die result don't get state vector.

  • So now we have the actual state beck.

  • Uh, and then we will see dot measure.

  • And then we're just gonna measure both cubits to both classical bits and then we'll do a c dot draw.

  • Um oh, que dot Quantum circuit.

  • I see q quantum circuit that I screwed over and and get anything else up.

  • Uh, get state vector.

  • Why not results?

  • Oh, we didn't call results.

  • It's early in the morning.

  • Coffee's still setting in.

  • Cool.

  • Okay, so we have our rotation or measurements.

  • Great.

  • So the first thing I would want to do is let's plot block multi vector, And then we will do the original state Vek.

  • Cool run that.

  • All right, so that's how the original state vector appears.

  • Uh, tow us before we've done anything for any Hatem ARDS or anything.

  • So it's just a quantum circuit.

  • We do a couple rotations on the why, that's what it looks like.

  • Okay, so now let's do Ridge counts equals Q dot execute and we will execute that circuit were going to say back end back and equals the chasm.

  • Underscore Sim shots will be 10.

  • 24.

  • I'm gonna make this, Pepe, and then we will do dot results dot Get underscore counts.

  • And then we will plot hist o gram or Ridge, uh, Ridge under scorer accounts.

  • And then legend equals I don't even need a legend here.

  • Honestly, But I'll put it in.

  • So this is our distribution.

  • So it's going to be important, because first, we're going to, um, trying thio getting above here first.

  • What we want to dio is, um, uncertain cubits.

  • Let's say so.

  • This is for uncertain cubits, just naturally.

  • This is what they look like now.

  • What we're going to do is we're gonna do Unser Ting cubits.

  • Hatem ARDS at front.

  • Okay, um So what we're gonna do is we're gonna take this copy paste, and now we're just gonna add to Hatem our gates to the to the beginning.

  • So how to murder on zero?

  • Had a mark on one.

  • That's our circuit.

  • Cool.

  • Um, we don't actually want to say a Ridge state vector that should be reserved for the original, uh, and then we're gonna do the counts as well.

  • So we've got ST Vek Draw, huh?

  • I guess we'll first Will do Will do everything in the same order.

  • I don't wantto make it confusing as I'm scrolling through here a Ridge State back urn.

  • Actually, state, do we not run?

  • No, we didn't run this.

  • I think I just bring it before I made the change.

  • So, as you can see, the single Hatem aren't actually made kind of a significant difference.

  • Right?

  • So there's that.

  • And then let's go ahead and plot.

  • So, like, Okay, that's how impacted thing.

  • Actual block, multi vector.

  • But, um, how does it impact the actual distribution?

  • So let's do this.

  • So, like, how do these actually collapse?

  • What would it actually end up looking like, so accounts, and then I'll just paste counts.

  • So if we look at this and in fact, let me just just to make it easy, I'll get rid of this after we're done.

  • But so this was the original.

  • It looks as though probably 01 and 10 are unchanged.

  • Um, but really what happened is everything just flipped, right?

  • So now 00 is is frequent as 11 waas.

  • These air stayed the same because they flipped and then 11 it, you know, flip basically, with 00 from the original, So applying the Hatter marred Did something kind of funky here because instead of, um, you know, they were already uncertain.

  • So then you applied the Hatem art, and then it flips them around right?

  • And also change that multi vector pretty significantly.

  • But that's a handy mart in front.

  • Now, what about the, um let's say I had a MARD sandwich on uncertain cubits.

  • Um, all we're gonna do is take this paste.

  • And now we're going Just gonna wrap Hatem ARDS on the other side.

  • So now you can see how Damar had a mark had a mark had emerged.

  • So it's just squishing in these cubits around Hatem our gates.

  • Hence the head of Marc Sandwich s o.

  • Now let's take this.

  • Let's look at the state vector that this produces.

  • And, um, let's go back up to the original just because I think scrolling around it's kind of confusing.

  • In fact, I'm going to just gonna delete this because I don't want to look at it.

  • Um, come down here.

  • I didn't want that to be confusing.

  • Now, when we look at these.

  • Isn't that interesting?

  • So this is the had a morte sandwich.

  • This is your original know Hatem arts.

  • Now this is on again uncertain cubits That starts to look like Wow, it's almost the same.

  • It's just kind of flipped, right?

  • But doesn't it look like if you were to guess where these were gonna collapse?

  • Would you not guess that, like, if I was to guess, I would have guessed that this whole, like flipped output would be what happens?

  • Actually, at this point, right?

  • Like, because they're these air, they look like they're opposite.

  • All right, so I would expect that kind of flip there, but instead, spoiler, spoiler alert.

  • Uh, here's the had a MARD sandwich distribution, right counts regular counts, Just the circuit.

  • We just ran.

  • That's what that looks like.

  • Now let's go up to our original distribution.

  • I'm just gonna copy it.

  • Scroll down here, Hatem Art sandwich on top.

  • Original on bottom, it turns out 1/3 of the same.

  • They give us the exact same output on the distribution.

  • But so what happened though?

  • What happened for us is, even though the output is the same so the circuit outputs the same.

  • What?

  • What we got was the possibility to look at this point.

  • With these cubits here, we could have done something interesting at this stage in the circuit.

  • We could have had another cube, it that does something else that works off of this state here before we get to the final Hatem ARDS and then take our measurements.

  • So So if we had one more cubit, we could do some something based on this superposition state that is basically querying all of the possibilities of input into the circuit without impacting the actual output, which is very interesting.

  • So so that's with an uncertain, uh, uncertain cubits.

  • The next question is, how does this look in front of certain cubits?

  • So imagine, um, let's go with Ah, I guess we'll just do the same thing and then we'll do maybe a knot or something.

  • So that was uncertain cubits.

  • So that's just come down here and let's say certain cubits.

  • And just for the record, all of this that I'm showing is completely act applicability to the Deutsche shows algorithm as well as all of the other fancy ones that everyone's ever heard of.

  • it's it's This is the concept that is important.

  • So not just wasting your time, I promise.

  • So now let's look att Had Amar, Let's look at certain cubits again.

  • I don't know if that's the right word.

  • I just That's that's what I'm thinking of.

  • When I look at these, I'm like, Okay, this is always going to collapse in such such a way.

  • So rotation on why is uncertain.

  • But we could either do nothing or just to do something.

  • Let's just do a not gate, OK, so we'll just a c x and then see x here.

  • So that's our what we've got now, uh, and then we'll just do it.

  • We'll just take this multi air the state vector here.

  • So now what we do is let's apply ahead a mard on so had a mard in front of certain cubits rips and then I'm gonna make some space.

  • We're not constantly dealing on the bottom.

  • Here s so now what we're gonna say, si dot h zero and then we will do the one draw.

  • We don't want to call this original state back anymore.

  • Um oh, I kind of want to do the, uh I'd like to do the original counts as well.

  • Let's go ahead.

  • Let's get that done as well.

  • So I mean, let me just pop that in here, so just be for bottom.

  • Well, give us that.

  • So there's there because we'll be the vector, and then we'll do this.

  • I should give it to us.

  • Let me just make sure.

  • Haven't made some sort of silly error here.

  • We should just get one, though, right?

  • So So we always get a 11 Okay, so then we throw a, uh, Hatem art in front of everything and then change this to be state vector.

  • So?

  • So we'll run this circuit.

  • Cool.

  • So now there's had a margin front, and now we've got this sort of situation where it's, like, just fully pointing towards that ax.

  • Then what we're gonna do is let's look at the count's now.

  • I mean, you should you should kind of know what to expect.

  • So again, like I've tried, I've tried to kind of do this every time, but applying a had a mard to let's say not gate.

  • What do you what should be the distribution output here.

  • So let's see, uh, a Ridge counts.

  • Just count slips.

  • So it's what you hopefully expected, right?

  • It's just a perfect distribution of all the possibilities here.

  • So again, don't forget, this is a point where I want to stress that in order to get that distribution, we had to take many shots, right?

  • We had in order to know that this circuit, like if we couldn't look into this circuit in order to know what the distribution the circuit had, like in order to know that characteristic, we had to take a lot of shots.

  • So if I just said one shot here we get 11 type of result.

  • This is not informative to us as to the, um, characteristic of the circuit.

  • Okay, so it just happens to be the case that when we take many shots because of the superposition state here, we get a distribution.

  • But what we're building up to here is the ability to know a little bit about what the output should be based on this Hatem art sandwich.

  • So Okay, back to we're doing so.

  • We've got had a Mars in front right now.

  • Let's do a Hatem art.

  • See, Mitch.

  • So had a Mord Hanna Marin sandwich.

  • See which certain cubits eso we paste that in and then had a mark 0101 draw The circuit looks correct.

  • Nice little sandwich going on there.

  • Uh, and then we will do our multi vector.

  • Okay, now, that is the opposite of this.

  • And recall that is also exactly what happened here.

  • It was the opposite.

  • And if I'm being honest, I still don't totally understand how we're going to collapse.

  • Um, to me, this should have collapsed mostly to 11 but it doesn't.

  • But coming down here, this should collapse.

  • Right?

  • Um, it's flipped.

  • So this should collapse 200 every time.

  • Right.

  • Look, if this doesn't I quit because I have to work in some.

  • I have to work, at least with some rules.

  • Okay, I understand some of these things are kind of funky, but come on, without rules.

  • When are we so savages?

  • So already plotted the multi vector.

  • What I want is the accounts.

  • So we come down here, we do.

  • The count's Now, this is our had a mord sandwich on certain cubits, and what we do get in this case is actually flipped values.

  • Okay, which is still pretty interesting behaviour.

  • And it's important to take note that a certain Cuba will respond in this way in an uncertain Cuba will respond this way.

  • So what does that tell you?

  • So getting back to our Deutsche Koza algorithm, This tells me we can do something interesting here.

  • We can take probably any end number of bits use a paddleboard sandwich to determine is our our is our little box here going to return to us?

  • Um, variable output.

  • We're not.

  • Now if we just have what we have here without understanding the inputs coming in, um, way might still see things getting flipped.

  • But this is the very This is the basis right away, 00 for a constant 11 for balance.

  • So keep that in mind.

  • You've just been showing something amazing.

  • So now, um, now that we've done that, what I want to do is propose to you, uh, the rest of the deutsche Eos algorithm because I think a lot of this gets lost when people just go straight to the deutsche shows algorithm.

  • Now, everything I've shown is still apple bubble, and it's part of the deutsche goes after them.

  • But usually just get it coded all the way through.

  • And that's not the point where people focus on the black box.

  • That's not the point.

  • That's not what's cool like that has nothing to do with it.

  • So, um okay, so now let's go ahead and define or black box.

  • Um, we're actually, let's say, balanced black box.

  • It's going to take in a circuit and it's going to output a circuit.

  • So we're gonna make her a little black box function for balanced and constant.

  • So, um, so let's go.

  • So for Constant, what I'm going to do is make this for, um in the way that everybody else has presented the Doi chose algorithm.

  • So were the black boxes this balanced either balanced or constant, and the way everyone does is with the controlled nine, so I'm going to use it with a controlled nine.

  • But understand, there's so many other things that we can do here.

  • Uh, besides just the one way that the Deutsche Joe's algorithm is formulated and again, this is why the Deutsche shows algorithm is is the basis for all these other algorithms.

  • It's not like people actually care to determine whether a quantum circuit is balanced or constant.

  • It's that we can determine that all in one pass because that one past can consider all of the possibilities.

  • So anyway, we are going to use what everyone uses this way, if you are confused.

  • I thought about not doing the typical formulation.

  • But I feel like with a topic like this, at least for me, I've been I've just been scouring the web for just all the resource Is I confined?

  • And then I'm looking to compare things and just see, like see how one person explains something, How another person explains something like in the learning process.

  • It's useful if everyone is at least using sort of the same things.

  • So I'm going to use the same things.

  • But just know that the possibilities here really, truly are endless.

  • You don't you're not constrained to this this formulation.

  • So anyway, we're gonna do a controlled not from the zero with to the, uh, at index to which you'll see in a moment we're gonna add another Cuba here.

  • So we're gonna do this entanglement between Cuba zero Q bit one, and they're just going to entangle with this Cuban at Index to.

  • Then we're gonna say a constant quotes.

  • Doot black box.

  • It's going to take a circuit.

  • Oh, and this needs to return a circuit, so we'll just we'll just define our circuit in them.

  • Or when we're ready for this black box, we'll just see equals c.

  • Basically, our C equals black box seat.

  • Anyway, you'll see pun intended of Okay, so, uh, the constant black box, the easiest, constant black box is to just return.

  • See?

  • But we don't gotta do anything.

  • So expert tutorials.

  • Uh, okay.

  • So now what we're going to dio is we can define our circuit now, so we're gonna say C equals quantum circuit.

  • And again, we're gonna have three cubits to classical bits because we don't actually care about Cuban number.

  • Well, Cuba index to That's not It's not relevant to us.

  • Because instead what we were actually curious about its whatever the outputs to Cuba.

  • Uh um one and two s o.

  • Anyway, um, so we're gonna say now C equals balanced, balanced black box.

  • Uh, see, So now if we didn't see that draw si dot draw quantum.

  • Oh, I keep forgetting this stupid cute look.

  • A britisher I spelled that right?

  • Okay, so as you can see, we started it.

  • We can apply this black box.

  • However, uh, however we feel so now we're gonna dio is in case this in the Hatem art sandwich.

  • So we're going to say, uh, basically this copy paste and then we're going to apply had a mard gates to basically everything.

  • So it was a si dot h zero 12 and then, um, you you can do this.

  • And in fact, I've seen people do this.

  • Um, it's kind of funny, but you don't actually need the Hatem our gate here.

  • Right?

  • Um, which will make more sense later on.

  • You can put it there for for cemetery if you really want, but it's unnecessary.

  • So now what we have is, uh, following circuit, So things are starting to get kind of jumbled up.

  • So one option you have when this is happening, especially if you're just trying to make things clear, as you can use this barrier.

  • So, for example, you could say si dot barrier and it will create this little line for us.

  • So just a quick example.

  • Here, run that.

  • And so now you can see it's a little easier to read.

  • Write.

  • It looks a little more linear as far as what's happening at this point.

  • You could have a mart over here like it's really possible.

  • It's fine, but it looks It's hard for us to read it if everything's not in line.

  • So, um, as far as I can tell from looking around, the barrier is used to stop the kiss kit optimizer like in the back end that optimizes your actual input circuit before it goes to the quantum machine that will optimize your circuit.

  • So if you're doing something stupid and wasteful, it appears to me that they can fix that with this optimizer.

  • But, um, so you can use the barrier to stop that from happening.

  • So now the optimizer will optimize this section, this section in this section again.

  • This is my understanding I could be wrong, but in terms of how I see barrier actually being used, it's just purely for aesthetics.

  • It's purely for making these easier to read.

  • Um, maybe as I get deeper, I'll find a scenario where I really need to stop the optimizer from doing something, but I haven't seen it yet.

  • So anyway, like I say, I'm a newbie, so maybe I'm missing it.

  • Um Okay, so So there's our nice, beautiful header mart sandwich.

  • Um, and I think probably I think what I'd like to show before.

  • So one of the things that gets added again to to make this uncertain is, uh, you can add what you'll typically see is a C X for gate, too.

  • So I'm not gate on Quantum Gate two, But before we just throw that in there, um, I want to talk about what that does, right?

  • Because again, it gets kind of mist and in fact, before, uh, exactly why we want to use this gate.

  • So again, here's our little black box.

  • If you want to be abundantly clear, you can put like, two barriers or something, but, um, I think this is fine.

  • So what happens when you have a not gate and then a had a mark gate?

  • What goes on there so really quickly again?

  • I'm just trying not to gloss over anything at all here because I think I think that from what I've seen, at least when I was going through tutorials, I'm like, trying to figure out okay, But why is every single gate Why are they here?

  • What are they doing?

  • And, um, there's really not explanations for this and this.

  • It just It reminds me so much of why I started doing YouTube tutorials and in general, like on Justin Python, because I was like, No, you have to explain everything.

  • You can't just skip things.

  • So anyway, what happens?

  • Let's see what happens.

  • We have Ah, not gate followed by a had a mark gate.

  • Whoops.

  • So let me just, uh I just want to steal our state that code.

  • Stay back here.

  • Come down here.

  • Not that.

  • But you don't have to follow along on this step.

  • If you don't want, you can just look at it.

  • I'm just trying to show you this is all in the text based version too.

  • So don't worry about it.

  • So So what was the original Hatem?

  • Our gate, right?

  • It's this positive x value, right?

  • But if we do it, not then a had a mard.

  • It's a negative x value.

  • What if What if we start with a hat, a mard and then we not the Hatem art?

  • What happens?

  • Not what we expected.

  • Really So now what we're going to dio is I'm gonna ask a question that I'm hopefully going to remember.

  • You answer by the end.

  • And that is, is there another way to achieve going from here to here?

  • That does not involve what appears to be the requirement that you first have a knot than a Hatem art.

  • Is there another way that we could do this right here?

  • Think about that because again, the Deutsche Eos algorithm is not specific to doing things in some perfectly exact way.

  • Instead, it's there to show you that this this characteristic is their unlike all of these quantum algorithms, when you use this notion of superposition, so think about it feel for deposit and think about or whatever.

  • But at the end, I'll show you the answer to that question.

  • Will you go away?

  • There you go.

  • I could get it to go away like you press d by the way, to get things to go away.

  • If you want cells to the bottom, be atop a look above.

  • Okay, so now that you understand what is happening when we add that not let's go.

  • So we've already got it.

  • They're actually so we'll add that not gate.

  • Um, I'm trying to think I think we're actually completed here in terms of everything we need, The only thing that we need, actually, well, our circuit is basically done, but we're not doing anything with a circuit.

  • Right, So let's go ahead and we'll take our measurement again.

  • This Hatem aren't you can add there.

  • I have even seen people throw another X here for the purposes of what we're doing.

  • No.

  • Now, if you were gonna maybe work with Cuba to at Index to, you know, who knows what you might have here, but for the purposes of actually showing the circuit at work?

  • No, it doesn't have to be symmetrical, even though it's very is very attempting to make this a nice, perfect Hatem art sandwich.

  • Just I'm just saying so now market is see that measure?

  • And again, we're gonna measure cubit 01 and we're gonna map that 23 classical bits of zero in one.

  • So here's our circuit, and now, uh, we can actually measure these.

  • Um, so let's go to counts.

  • Mmm.

  • Pasta.

  • So what we get as a response here is 11 So it's not.

  • So what?

  • This is basically what this is informing us is it's not really like the output to the circuit.

  • Instead, this 11 corresponds to the nature of the internals of the circuit or something.

  • It's responding to us that nature of like, the probabilities in the circuit.

  • So in this case, this is our balanced output we're getting once.

  • Now, if you had, you can continue adding, as many cubits is you want.

  • So we've got two cubits here.

  • You could have had 30 cubits if you had a machine that could do it.

  • Um, it's infinite.

  • You have as many as you wanted.

  • You could answer this question of what?

  • What's the characteristic of this circuit in terms of is their balanced or constant output.

  • So continuing this what if we went with rather than the balance box?

  • What if we did the constant box?

  • So I think we just called it constant Black box Constant.

  • Yes.

  • Okay, so now we do the counts, Run that again and what we get a 00 And again, it's important for me, I think to stress this is 11 for every single shot.

  • So we took 100 or 1000 24 shots.

  • But we could have gotten this answer with one shot, right?

  • It's 100% 11 always.

  • So given a perfect quantum machine, we would have always gotten this response.

  • Of course, quantum machines again have noise, so we have to.

  • We can't quite get away with that yet.

  • Um, there's no reason to believe that I know of.

  • We can't reach perfect quantum machines, right?

  • Um, but again, fundamentally weaken, weaken, Query these quantum circuits one time and understand What is the variability of this output?

  • That's incredible.

  • It's just one shot through.

  • But it's because of this superposition and had a mart sandwich.

  • Uh, that this can happen, right?

  • So that's incredible, right?

  • So, again, what does this all mean and like, Where do we go from here?

  • It's not really answering.

  • The question of what basically is that relevant is two things like the toy shows algorithm is really the first algorithm that provably like mathematically Consol ve this question.

  • Even though it's a relatively useless question, it can solve this question faster than a classical computer a classical appear will ruin require at least two passes through the circuit to answer this question.

  • The next thing and as you increased cubits, it would get even more complicated than that.

  • So So it's faster than a clause provably faster than a classical computer in terms of like house the cycle through the circuit.

  • But then also, what's more impressive?

  • It's like that's not impressive, that it's faster.

  • It's like, Why is it faster, though?

  • And we're like, Oh, because we can Actually, Queary Wow, we're in superposition The attributes of this thing circuit an output that instead So then so then what we can do is clearly there's more information here, right?

  • It's not just a simple zero in one.

  • There's so much more to this story and we can work with that interest circuit.

  • That's what That's the rial amazing part of all of this.

  • It's not Oh, we did it one shot.

  • It's why did we do it in one try?

  • So with that, we're almost done here.

  • The last thing I want to show you is what I asked earlier, which was Can we?

  • I don't know if I saved it up here.

  • I was hoping to just copy paste, but I don't think I did can we mimic?

  • Um, let me just take a circuit real quick.

  • Can we mimic little deuce 11 The deutsche shows this stuff is basically over.

  • Um, well, I guess it's not going to make a point, but anyway, now we're just kind of screwing around again.

  • You don't have to follow along.

  • You could just watch.

  • Um, So we have a quantum circuit.

  • We have a C x zero s o n not.

  • Ah had a mard on zero.

  • Uh, way don't really have to draw, but I'll just do it, uh, si dot Draw.

  • Um And then we want a state vector.

  • Where is a state victor cud?

  • You're not really like it would be awesome.

  • Kiss get Debs like, si dot draw multi.

  • That's what I want in my life.

  • Um, because like doing this every time you want to make the drawing six.

  • Um, Victor state facts.

  • Okay, so that was that way.

  • And then if we were to flip the Hatem art and the not so what if we did had a mard then a night?

  • Because don't forget as well.

  • Um, if we just have a Hatem art What?

  • What did that look like it's fully in the X.

  • And then if we have C x hatem aren't so This is the order of a not Hatem are that we have in our, um, doit shows algorithm we can see.

  • Okay, it flips it around.

  • Right.

  • So again, if we do and I'm gonna stop drawing it's that way we could do all this in one run.

  • I'm just gonna say Boop boop So again, had a mard all the way.

  • And then if we if we put the not gate after the Hatem art what happens?

  • Nothing happens.

  • But what is actually happening when we go from X to this like Negative X?

  • Um, What's going on?

  • How How else could we get there?

  • Could we get there some other way?

  • Um so, like from here, could we get there?

  • Of course we can get there.

  • Remember, all the gates are superposition entanglement in a rotation.

  • So what if we say circuit dot rotate on the why and we're gonna rotate by math dot pie on Cuba?

  • Zero.

  • Can we get there?

  • It turns out we can We can get there after the Hatem art.

  • We could also get there before the Hatem art.

  • So we could we can throw this rotation on the why anywhere the heck we want.

  • The next question is, does this collapse in the same way as we would hope and expect Now could we could do it with just the circuit.

  • But instead, what I'm gonna do is let's take well, everything we've been doing up to this point.

  • So when a group take this now, in theory, right, this not This is what we're trying to wonder.

  • Hey, could we change this?

  • So this not as you've already seen.

  • If we put it after the Hatem art, it doesn't work, at least in our simple example.

  • Now I can prove to you it also isn't gonna work here.

  • So, for example, I'm gonna comment that out, and then we're gonna move it.

  • Um, here.

  • So move it after the Hatem art, and then we'll do, Uh, let's just take, uh, counts here.

  • Copy.

  • Come down here.

  • Um, I don't think we need to draw it.

  • So again, I'm just gonna run everything immediately.

  • So we get a 00 on the balance box.

  • Then you might be thinking, Well, maybe the constant is a 11 constant black bucks.

  • It's not.

  • We get 00 across the board.

  • So we've lost our, um, attributes.

  • That was so cool.

  • And we know we can understand.

  • Maybe not the quantum mechanics in the background.

  • Maybe we don't understand that, but because we actually graft the, uh, multi vector, I don't know where my option my example went.

  • But when we did, you saw it.

  • Didn't do anything right.

  • You had a marred.

  • It was full X.

  • You didn't know it was still full X.

  • So it's no surprise this is not working.

  • But what about?

  • I'm gonna comment that out again.

  • We're going to say a rotation now, so we're gonna We're going to replace the original formulation where there's a knot before the Hatem art with the rotation on the why instead, So we're gonna say, matt dot pie cubit number two or index to rather run it.

  • Okay, Constant is a 00 Uh, I don't want to rewrite the whole thing.

  • I could have done it by now, though.

  • Balance Black box is a 11 So now we're back to the behavior, right?

  • That we expected before, but again, rotation on why we're doing the same thing with the multi vectors as before.

  • But as we've also seen, we can get that exact same behavior.

  • Right?

  • And as long as we're getting it, before we take this measurement, we should be fine.

  • Right?

  • So the question is Okay.

  • Can we take this rotation?

  • Why?

  • Remove it from there and apply it here.

  • Where the controlled X or a controlled?

  • Not rather, um, we're not out of control now.

  • The not gate did not work.

  • So we run this on the balance box, we get a 11 again.

  • Good.

  • That's what we hoped.

  • Now, can we do the same thing?

  • Get it on the constant black box and get it?

  • Hopefully a 00 We can.

  • So I'm gonna leave it here and just leave you with this.

  • That again?

  • You you don't.

  • The math might elude you, is too and eludes me.

  • Why the not didn't flip the Hatem art back the other way.

  • Right?

  • Um but then I like I said, as I'm just kind of playing with this doi chose algorithm, I'm like, That's interesting, you know, because in theory you just need to make sure everything is the same either have a balanced or a constant, you know, thing that happens at this point.

  • So as long as we do our operation before we get to the sea Not in theory, we should be fine.

  • And then as long as nothing else changes here before the measurements again, you should be fine.

  • Or as long as before the measurements.

  • You either have a constant or a balance.

  • So anyway, I was playing with it.

  • I was like, Well, is there another way that we get this like, I was curious.

  • Do we actually have to have this Not gate here?

  • Like, why can't it be here?

  • And then I plotted the multi vector, and I was, like, up it just can't be there.

  • And then I was like, But that's weird.

  • Why doesn't it move the multi vector?

  • And I'm like, Well, what if we do a rotation?

  • Like, surely that will move it right?

  • Um and it does.

  • And it works, at least on the SIM.

  • So anyway, very interesting.

  • So that's it for now, If you know the proper term analogy for Hatem Art sandwich, feel free to let me know if I've said anything else.

  • Stupid feel free to let me know.

  • Ah, but yeah, that's so cool.

  • Um, so hopefully you guys air as intrigued by all this quantum computer programming is I am having a really, really good time playing around with all this stuff.

  • This is just super interesting, and it's really cool to see all it's like that.

  • It's just a complete it's just wholly different.

  • You have all these possibilities, and what we're gonna be able to do with that is very interesting to me, um, as we move forward.

  • So again, while this might not be as an algorithm, all that interesting, it's very simple.

  • So it's easy to understand.

  • But this concept, this is the inspiration behind Bernstein vase Ronnie, which is basically a way that you can encode a bit string into your circuit.

  • Um, And then there's the's shores algorithm, which is the one that you know can factor large prime numbers.

  • So factor four large prime numbers.

  • So anyway, and in effect, breakout break encryption.

  • So Okay, I think that's all.

  • So you thought you were rid of me, but actually, I wanted to stress 11 final thing.

  • Uh, and that's in relation to why did the not not work, and then the rotation on the wide did work.

  • Um, I don't think I didn't make that totally clear.

  • Like it might be like, ho, Why did that happen?

  • Um, there's a reason it happens.

  • So, uh, so what I'm gonna do is I'm gonna take this here and real quickly answer that question.

  • So what is a rotation or what's a not gate?

  • Right.

  • So So with our Hatem ard, we've lost it.

  • Okay, I'll just do it down here.

  • Come.

  • So where had Ammar goes to hear?

  • Or even better yet, let's say let's do let's just do nothing and then we'll add it, not gate.

  • So So this is our start.

  • We initialize 20 Let's say we apply a not gate.

  • Now it points to down toe one.

  • The question, though, is how do we get Tau one right?

  • There's two ways we could have applied a rotation to Cuba.

  • Zero to make our way to one.

  • One of the ways is to rotate along the list.

  • One of the ways was we could have rotated along the Y axes to get Tau one.

  • The other way is we could have rotated along the X axes to get tau one the dot x should give you an idea of what happened, right?

  • But what if we said What if we say si dot y zero we get the same result.

  • And you might think, Oh, I don't even know this existed, right?

  • You also have a control z, right?

  • Cause here's here's that access right here.

  • So and when we do it a c z on what otherwise is already pointing.

  • You know, if you're trying to rotate along the axes that you're like perfectly along, um, nothing happens, Right?

  • So that's why if you have a hat a march 1st, you're on the X axis.

  • So when you try to go and do a c x on the X axis, you just kind of like nothing really happened, right?

  • But that's why nothing happened.

  • Ah, not gay is.

  • Actually you're just rotating along the X, that's that's it.

  • So not gate is a rotate on the x math dot pie.

  • So, like, for example, on and then we'll say, uh, zero.

  • And then we'll just comment this out.

  • Right?

  • Boom.

  • Um, and then boom.

  • Right there's your not gate.

  • Okay, So that is, I just want to make a point that that's why the not gate doesn't work after the had a mark, right?

  • Because the Hatter marred runs us along the X axes.

  • So So there's really when we rotate, there's nothing to rotate on.

  • But that leaves us the opportunity to rotate along the Y axes to get back to where we wanted.

  • Hopefully, that's a little more clear.

  • I just don't want to leave you guys with this like notion that there's some sort of magical reason that not Kate just doesn't work after the hammer.

  • No, it it's just we're not.

  • We're rotating along the axes that were perfectly along, so there's nothing to rotate.

  • So anyway, that's all.

  • And thank you to my most recent awesome Human slash channel members Stefan Bowman, Ryan Howl, It's Moonan US Years, a newsy Dhruv Gupta, Rabelais Gaming and Kumar's Greer Igloo.

  • Thank you all very much for your support and, of course, for all of the channel members.

  • If you want to join, you can click that beautiful blue joined.

what is going on?

字幕與單字

單字即點即查 點擊單字可以查詢單字解釋

B1 中級

德國的約薩算法--量子計算機編程與Qiskit第3頁。 (Deutsch Jozsa Algorithm - Quantum Computer Programming w/ Qiskit p.3)

  • 2 0
    林宜悉 發佈於 2021 年 01 月 14 日
影片單字