字幕列表 影片播放 列印英文字幕 We talked a bit about the hardware, you know, people are working on the hardware of quantum computing, yep What about software? where do you start thinking about that? Writing software for a quantum computer In my opinion is actually not very very different from how we write software for just a normal computer and we think about software in terms of being able to write down instructions for the computer and the computer executing these instructions changing some internal state when I write instructions for any type of computer whether it be like a modern MacBook Pro or an old PDP-11 In both cases in the end, we have an assembly code that gets executed that's changing the memory the disk The registers in your CPU and so on and it's not different with a quantum computer It's just like the question is what are we changing? And how do we change them? We can really describe these things in quite simple terms, if we were to do this in with sort of full textbook honesty, we would discuss things like finite dimensional vector spaces and in Hilbert spaces and Linear operators and unitary maps and all that stuff and all that stuff is very very important If if you're actually sitting down writing a program but to get an understanding of it I think we can do away with it. And actually just think about things in terms of simple probabilities. So the idea of a Qubit So Qubit is a Bit in a quantom computer Yep it is. Yeah. It's sort of the fundamental building block. It's like a it's like a bit and a regular computer The way I think of it is it's a resource in the computer. It's a resource that you can use to perform a computation So a qubit to me is anything it's sort of abstract. But anything that has two states of being and Some possibility or probability of those states. So for instance we can think about Photons and their polarization a photon can be sort of polarized left and right or it can be polarized up and down But if we're not looking then maybe it's it's possibly in one or the other. Maybe it's 50% moving and traversing left and right and 50% Moving up and down. This is just for photons Turns out there are lots and lots of different ways to construct qubits the qubits that that we work on in the so called field Of superconducting quantum computation. We use a device called a superconducting charge qubit It doesn't matter all the details, but it suffice to say that the two states there Are is their charge or is there no charge in this circuit? And then of course, we have the same thing. It could we could have a probability like maybe there's a 10% chance there's a charge or maybe there's a 90% chance there's a charge. These are called superconducting charge Qubits again, it sounds complicated, but the essence is the same two states but maybe it's in one or the other the interesting thing though is When we have multiple qubits, and this is really where the power of quantum computation happens We can actually think of it sort of simply Diagrammatically that if qubits if I just represent them sort of as a circle here, maybe we have three the idea Is that these qubits can interact this guy can interact with this guy? this guy can interact with this guy and these can interact with one another and every time we add a qubit if we were to Add a circle here. Let's say we added this fourth qubit right here We noticed that every single one of them can now interact with it. We have to draw lots of these lines It turns out that a quantum computer can deal with these additions of qubits in a very efficient fashion But like I said a qubit is something where it has two states So each of these guys can be in two states with a particular probability let's say the two states and our just 0 and 1, our qubit can be 0 or 1 or Possibly something in between. So if I write down these qubits with the probability, let's say we have three qubits here I'll call it Q0 Q1 and Q2 what we have is That qubit 0 let's say it's this one right here 1 and 2, well qubit 0 could be in 0 or 1 so it has some probability of being in 0 Qubit 1 also has some probability of being in 0 and qubit 0 also has some probability being in 0 maybe that's a 10% chance But now we have to painstakingly go through a write every one qubit 0 has a probability of being in the 0 state Qubit 1 also 0 and qubit 2 and we can write down all these possibilities Etc, etc until we get to the possibility that all of them are one and each of them has a probability. Maybe this is 5% Maybe this is 7%, maybe this is like 35%, maybe there's a very high percentage chance that all of them are one 8% and so on so every time we add a qubit the size of this table doubles the number of probability percentages doubles and it turns out that these probabilities right here are ultimately what a quantum computer is computing with when we do an Instruction on a quantum computer when we instruct it to do something in the end it's always about changing these probabilities to favor some computation that we're trying to do When we start up a quantum computer, when we flick the switch on it'll start as 100% in this state and everything else will be 0% We start off here, and we know that we start off here. It might be that when we apply a certain operation So for example an operation as is the so called superposition Initialization or we call it Hadamard initialization This is if we have any number of qubits, so starting off in zero, and maybe we want every probability to be equal So if we want to start off here We do something called Hadamard initialization where we do a particular instruction called the Hadamard gate and what happens is this 100% now turns into Let's say we just have one qubit It would be 50% chance in the zero State and 50% chance in the one state if we had two qubits Hadamard initialization would cause us to be 25% chance with both qubits being 0 25% chance 0 1 25% chance being 1 0 25% chance being 1 1 the point is is that this particular instructions one instruction on a quantum computer? Allows us to change these probabilities in a way that we'd like and it might be useful for us to do something like this Hadamard Initialization with all the probabilities being equal because then from here we could do some operation that affects all these qubits and affects all these Probabilities sort of in the same way. But like I said, this is just one possible instruction So there can be an infinite number just like a normal computer it's not that they're an infinite number of instructions It's that they're an infinite of possible things you could do with the instructions So one of the greatest discoveries was that we can arrange these probabilities to be in whatever way that we would like Using five instructions total there are sort of five different ways that we can Permute these things and change them and there are this, one is called a measure instruction measure instruction is pretty important because while we're talking about probabilities we can't actually see these probabilities in the quantum computer They're just in there At some point. We do want to see are they zeros or ones? Like we need to answer that question So the measure instruction will take any list of probabilities and turn it into One of them will change to 100% So each of these is 25% chance. It'll pick one Let's say it's this one right here and measure is gonna make this a hundred percent with the other ones being zero percent That's one way of changing and then incidentally we also get to read out from the clunkier that it was a 1 0 That's how we get our answers. That's the only way we get an answer. In fact from the quantum computer The rest of them are just purely ways of changing these probabilities. There are lots of different ways You can have instruction just like norm... Regular computers every single computer that's ever been built or every single CPU that's erver been built always has a different instruction set One possible instruction set is the following we have this Hadamard Is that named after someone? Yes, it's named after I think he was a mathematician He worked on a variety of mathematical subjects and there's a matrix that's actually one divided by square root of 2 1 1 1 negative 1 which is a so-called Hadamard matrix Incidentally this is also used to represent how these probabilities change so Hadamard is one instruction There's another instruction called Phase, again It just has the effect of changing probabilities around in a particular way There's another instruction called the T gate not very Creatively named there's another instruction called the CNOT gate and what's special about the CNOT gate is that all of these right here act on one qubit We say I want to do a measure on qubit 2 or i want to do a T gate on qubit 0 It sort of affects only one qubit. It'll affect a lot of probabilities because even though we're operating on one qubit here it accounts for this entire column so it actually changes all the probabilities CNOT is special because we get to choose two qubits This is how we get this interaction between them so CNOT you can say I want to do this on qubit 0 and qubit 2 For instance and this itself is an instruction in a sort of quantum assembly code Are these instructions a bit like gates? Yea, so they are like gates but there's an interesting reversal and for example a NAND gate is something like this where data is coming Into the gate and data comes out of the gate what's interesting about these gates and quantum computation is sort of the opposite you have data that's sitting there all these probabilities and You like apply the gate to the Machine and all the probabilities change. So you're not sending data into the gate You're not putting this gate on the chip like a NAND gate for instance Is a gate that you would actually etch into a chip Here it's an instruction that you apply to the computer and it changes these probabilities, but nonetheless They're both different operations that you do on data And how does what you do is code get changed into these operations of instructions Yeah, so like with normal computers you can write these instructions out as assembly code. In fact one example is Say I want the following probabilities I have 0 0 0 1 1 0 1 1 I want this I want it to be 50% chance to be 0 0 or 50% chance to be 1 1 this is called a bell state with a bell state. It's interesting because Theoretically let's suppose I have a qubit. Let's say close I could hold a qubit and Let's say I gave you a qubit it's 50% chance 0 0 or 50% chance 1 1 so even if we travelled halfway across the world and I decided to measure my qubit with the measure Instruction and I determine that to 0 Then I know for certain that you must be a 0 because there's a zero percent chance that were different, but somehow we determine this It's a 50% chance. It's not that it is already chosen literally is 50% chance. You don't know which one it is So we can write a program to construct a bell state I won't explain exactly why it works this way But you do a Hadamard on my qubit, qubit 0 we do a CNOT on My qubit and your qubit and we're done. This is a quantum program. You can write this out. Now there are higher levels of quantum programming where we don't want to restrict ourselves these instructions Maybe I want to more directly Express the probabilities and how I want them to change They all have to add up to 1 of course. I mean, we have a certain percentage chance It has to be 100% in the end, but maybe I want to shift the probabilities around in a particular way But not in any of the ways that's in our gate set I can write that down that can use something called a quantum compiler a piece of software that that converts what I want into these native instructions that gives me the next level of abstraction in the code we can go all the way up to using a full-blown library for writing this stuff one library that We've constructed is something called "PyQuil" Which allows us to actually write Python code to express quantum computations in Quil is actually this instruction set here Quil stands for quantum instruction language, which lets you write down this assembly code But hey, who came up with this things? is this a commercial thing or is this like... Yeah, yeah so quil was originally this particular type of instruction set Was a paper that I actually wrote a while ago The idea of gates and everything was very well known for many decades previous to that So this is a particular encoding of gates as instructions PyQuil is a library that's open source, it's free There are no restrictions really on using it to construct these programs, but it does allow you to actually connect up to Rigetti Computing's real quantum computers if you if you so pleased to actually run your programs But if you don't want to connect up to the quantum computers and you just want to simulate on your own laptop this can connect Up to a an open source Simulation tool that we have if you just kind of want to see how these probabilities change and so on Not quite you still have to express a quantum computation so a quantum computer doesn't print things out it's it's manipulating these probabilities so at some point you start to express things as Quantum instructions, so definitely if you wanted to make a bell state writing the bell state program you could do that But could you write "Hello world?" No, and this goes back to the fact that the quantum computer is a coprocessor Just like saying you don't write 'Hello World' on your GPU generally You don't express any particular computation and you also don't compile Python Into code on your GPU You write special code within Python that gets run on your GPU and it's the same thing with quantum computing and i know you said there are certain stabilty issues do you get hard answers outta this? So, yeah, so when an answer comes out when you measure you do get definite answer out, however since there's noise what we have to do is write our program get an answer out and store that and actually Rerun it multiple times We have to gather statistics about the answer and it turns out that the more you do this the more Accurate your answers become and that is to account for noise in the quantum computer currently So when we're talking about setting these probabilities, what you want them to be and i understand kind of running operations and gates to do just sounds like you know the answer Yeah, no, you don't know the answer You just show that If you were to do this series of operations that you'd get the right answer on, the answer might be different depending ofcourse the answer will be diffrent depending on the problem that you have so for instance one of the Main questions the quantum computer can solve is the same question that you can get from something called the Fourier Transform where you can find if you have like a sound wave and you want to find what frequencies it has you know that if you run the Fourier transform Proven using mathematics and so on that the answer will be the set of frequencies that make up that sound Likewise here. There's actually something called a quantum Fourier transform where if you run it you know that probabilities will accumulate on the Answers or the frequencies. Maybe that your that your sound wave has So, you know just by the construction of your program that you'll get the correct answer Not that you know the correct answer itself at the front-end, and that's the same with classical computing in my opinion You rarely do you know what the final answer is You just know the computation or the program that you've written will produce the correct answer You need more than one qubit to make this work You can use a qubit if you have a normal qubit your table is gonna look like this you're gonna have prob and Maybe it's like 50% in your states are just 0 and 1 Except they're just not very many useful things you can do with a single qubit the power really comes from multiple qubits because you get this nice scaling law where if you have n qubits the number of Probabilities that you get to work with is 2 to the power of n so every single additional qubit you're doubling the number of probabilities that you have to work with How do you know how to do that for a regular computer though Well, I suppose with a regular computer if you're if you're adding numbers together Yep something comes out. Mm-hmm. It's the same thing at the quantum computer Your input is a bunch of probabilities which you know at the very start and all these gates change those probabilities in a controlled way You know exactly how Hadamard or Phase or T or CNOT you know exactly how it's gonna change those and you can write down exactly how it'll change those so you can Mechanically do the computation in the same way that we can mechanically do it with adders or ale use or whatever Just turns out that the most basic type of computation is actually a really it's a really large one It's actually equivalent to a big matrix multiply. If you were to write this out your probabilities as a column vector 50% 25% Whatever 7% etc, etc Every operation in a quantum computer is actually specified as a matrix. You have a big set of matrix elements Maybe it's like 1 0 0 0 0 0 0 0 1 1/2 3/4 whatever I'm making it up as I go along of course, but you know with certainty 100% certainty that this operation Maybe this is like Hadamard on qubit 0 and Hadamard on qubit 1 or something like that it's not but you know that this operation is gonna change his probabilities and I could if I wanted to Manually go and compute this matrix multiplication. The thing is like I said this vector right here grows doubles in size every time I add a qubit so it's better for a quantum computer to do it as opposed to me or even a normal computer doing it Yep, this multiplication happens on the order of 50 to 250 nanoseconds on a computer no matter the number of qubits that you have even if you have 250 qubits this vector right here would be 2 to the power of 250 which is some enormously large number I don't even know an order of magnitude estimate of what that is It's so bigger than any computer on earth could store bigger than any computer in the universe could store but nonetheless it will do this Multiplication in 50 nanoseconds, which really starts getting into why quantum computers show promise for very fast or very powerful applications How much does a quantum computer cost then? Oh my gosh All the components it costs a great deal for sure if you want to buy one and have it in your living room Yeah, so one of the big popular ones is a very recent algorithm back in I think 2014 is when I came out
B1 中級 量子指令集 - Computerphile (Quantum Instruction Set - Computerphile) 21 0 林宜悉 發佈於 2021 年 01 月 14 日 更多分享 分享 收藏 回報 影片單字