We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

QuBit: Introducing Quantum Superpositions

00:00

Formal Metadata

Title
QuBit: Introducing Quantum Superpositions
Title of Series
Number of Parts
97
Author
License
CC Attribution 2.0 Belgium:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
The only talk that can use the phrase 'quantum mechanics' and not sound pretentious! It covers the principles of programming with variables that can hold multiple values at the same time - i.e. quantum superpositions, and how (and why) it's impossible to know which of those values will be returned if you query the variable. It also details the library itself, and how to use it. (uses the C++ Qubit library, based on Damien Conway's Perl module) QuBit is a library to support Quantum Superpositions in C++. This allows each CQuBit variable to hold a number of different values at the same time. Normal mathematical operations can be performed on a QuBit, but they affect every value in the QuBit, at the same time. Binary Operations on two QuBits cause a result based on every possible outcome.
QuantumSuperposition principleQubitQubitBitProjective planeComputer animationXML
MathematicsQubitAuto mechanicQuantumSuperposition principleNumberBasis <Mathematik>Software maintenancePersonal digital assistantMathematicsBitCodeQuicksortQuantum mechanicsOperator (mathematics)QubitComputer-assisted translationEntire functionLibrary (computing)Superposition principleMechanism designCuboidNichtlineares GleichungssystemVariable (mathematics)NumberMultiplication signSoftware bugUncertainty principleState of matterResultantCopenhagen interpretationPhysicalismSchrödinger's catMereologyOrbitComputer animationLecture/Conference
BitDependent and independent variablesCASE <Informatik>Multiplication signComputer animationLecture/Conference
QubitPrime idealCodeTemplate (C++)Module (mathematics)Library (computing)QuantumSuperposition principleMathematicsOperations researchBinary fileVariable (mathematics)Operator (mathematics)1 (number)Series (mathematics)NumberModule (mathematics)Line (geometry)QubitCalculationQuicksortMultiplication signSemiconductor memoryBinary multiplierDifferent (Kate Ryan album)WebsiteSquare numberPrime numberComputer programmingDependent and independent variablesResultantBitPoint (geometry)Binary codeRootPrime idealEmailSuperposition principleLibrary (computing)Structural loadQuantum mechanicsComputer fileCodeTemplate (C++)Slide ruleDataflowModulo (jargon)Universe (mathematics)Set (mathematics)Computer animation
QubitNumberCodePairwise comparisonState of matterSuperposition principleInformationEigenvalues and eigenvectorsFaktorenanalyseQuantumAuto mechanicEncryptionComputer hardwareAlgorithmIntegerQuantum computerFactorizationCalculationResultantSuperposition principleTerm (mathematics)BitInfinitySubsetNumberAlgorithmMultiplicationType theoryQuantum mechanicsQubitSlide ruleProcess (computing)Element (mathematics)Eigenvalues and eigenvectorsLibrary (computing)SpacetimeQuantum stateTime travelEncryptionCartesian coordinate systemPrime idealProjective planeDivisorLine (geometry)Multiplication signState of matterPoint (geometry)Order (biology)Software developerCoefficientSet (mathematics)QuicksortWordQuantum computerOperator (mathematics)CASE <Informatik>MathematicianCombinational logicPhysicalismProper mapCodeSampling (statistics)CubeFactory (trading post)IntegerPrime numberMixed realityPoisson-KlammerMathematicsComputer programmingTesselationKey (cryptography)Computer animationLecture/Conference
Presentation of a groupSoftware developerWordMultiplication signQuantum mechanicsCategory of beingOperator (mathematics)Cartesian coordinate systemSlide ruleQuicksortMereologySemiconductor memorySet (mathematics)AlgorithmRight angleQuantum computerReal numberLecture/ConferenceComputer animation
XML
Transcript: English(auto-generated)
Three minutes, okay. So, this is going to be an introduction to some project called Qubit, which I hope none of you will have ever heard of, because it's a bit weird, which is why I'm going to start with the reason I wrote it, rather than what it actually does.
Step one, coding is simple. It's very, very easy, okay? We still get it wrong, but it's easy. This is what typically you get given to do. Someone comes up and says, this is the way it needs to run, and we'll write a piece of code that does it. Yeah, hardly rocket science, is it? This is very, very simple coding, and that is actually rocket science, by the way.
That equation is how rockets get up into orbit. A Russian guy invented that many, many years ago. So, coding, obviously, a bit simple, getting a bit bored by it. So, let's do something hard for a change. Let's make a library that purposely makes coding more difficult. And it's a lot harder than rocket science. It's actually quantum mechanics.
Qubit uses the quantum superposition principle of the Heisenberg uncertainty principle. Those that have heard stories about cats in boxes will be moderately aware of this. Basically, the quantum superposition says, we'll have a variable, and instead of the variable having a value inside it, this variable will have lots of values inside it
at the same time. If you perform an operation on this variable, you perform that operation on all the values inside the variable at the same time. Anyone completely confused yet? You should be. So, practical example and some code.
This makes things much more real. So, we'll create a qubit. You'll be seeing it's a C++ thing, but don't let that scare you. We'll create a qubit with all the values between 10 and 25 in five increments. That's those values there. Q now contains all of these values at the same time.
So, if I take this variable with all the values at the same time, and I say, is it less than 20? What it's actually saying is, look at any of those values within that, and if they're less than 20, we'll have a result. And just like the Schrodinger's cat experiment,
you don't actually get an answer when you perform the operation. You only get an answer when you look at it. This is the really freaky thing about quantum mechanics. The answers only happen when you look at it, which means you then destroy the quantum superposition.
The state collapses, to use the geek vernacular. So, this performs the less than 20 operation on everything in here at the same time, and then when you say, actually, I want you to copy that into answer, it does. It gives you an answer, if any of those numbers is less than 20, but in doing so, destroys Q, and there's nothing left in Q anymore.
The code kind of makes some sort of sense, but the mechanics on why? Bit weird, and that's why it's quite hard to do anything with this. The uncertainty principle is a very old physics-y thing. Was it 1923 or something, Copenhagen conjecture? Someone will correct me.
But, you know, as I say, quantum mechanics is easy. It's just an equation like any other. Also, coding gets a bit dull. I would probably forego an entire year of pizza if I never had to maintain a piece of old crap buggy code if I had to refactor something else's piece of junk, go hunting for bugs.
If I could just write new code all day, every day, that would be great. Unfortunately, you're not doing that. You're lumbered with junk, and you end up coding edge cases like this. This is the day-to-day bread and butter, the sort of rubbish a lot of us have to put up with. So wouldn't it be great if we could write with an API that's a little bit more interesting
where variables disappear and have lots of values at the same time? Have a guess. Yep, qubit's interesting as well as complex. So, same sort of thing again. We'll create a qubit, as this time it's gonna be integer, base, but who cares? And we're gonna add a whole load of numbers between two and the square root of some other arbitrary number. Floating point inaccuracies are the reason
we add this plus one bit at the end. So, take number 100. We're gonna look at a qubit with the values of two, three, four, all the way up to, say, 10 or 11. It's gonna have all of those values at the same time. We'll then do the module operation on everything and the calculation of everything at the same time.
So that's, and I think I've probably even got a slide, so yes. So effectively, this performs the operation of 10 module two where the remainder is zero, at the same time it does it with three and four and five and so on and so on and so on. And you can see that the remainders are actually the same.
So, before I hit next, can anyone guess what happens now? I've got all my numbers between two and 10. I'm finding out which ones have a zero remainder and which ones have a non-zero remainder, non-zero remainder, which means in the one line of code, I have then asked for every single prime number or within this set, is this number prime with one line?
Anyone else got a library that can do prime numbers with one line that's that interesting that isn't called the prime number library? It's quite interesting. You can do funky things with this. So, now in completely uncommon to other talks, what is it?
Other than doing weird, dull, uninteresting, clever stuff, Cbit is a C++ template, which means there's one header file which you can just include from your C code. It does funky things. It's GPL, of course, otherwise they wouldn't let me in. And Damien Conway, who's a very smart chap, I think he's Australian University,
someone will probably know. Yep, I reckon my memory's getting better in this old age. So, he come up with a Perl module that did this sort of thing and I thought, I don't program Perl well enough to be able to use this, but I can do C++. So, I had a go myself and there's a website which is badly formatted as usual for my slides.
So, the sound bite, the bit that I shall read and pretend it's very intelligent. Qbit is a library to support quantum superpositions in C++. This allows each qubit variable to hold a number of different valuable, variables, values? Values at the same time. Memory's fine, eyesight's going. Normal mathematical operations can be performed on a qubit,
but they affect every value in the qubit at the same time. Binary operations on two qubits cause a result based on every possible outcome. Yes, variables have everything in them at the same time, which means any operation is sort of the multiplier for us. There's a lot of possibilities. So, oops, let's go back, possibly.
Yes, so, if you've got a qubit with all the values between one to five and you then add 12, you then have all the values between 13 and 17. If you multiply it by two, then you have all the values between 26 and 34 in multiple of two, which means if your hotel runs out of rooms and you have a hotel with an infinite number of rooms,
you just move everyone to the double and there's lots of space in between. That's also a weird problem if you get bored. Right, so, is there an easy way of doing all this interesting, clever stuff? Yes, it's just a set really. If you kind of want to break it down, you've got a set of numbers.
So, you perform an operation on a set, you perform it to the whole set. The all operation that we saw, if all of the numbers are less than 20, that's the union. If it's any, then that's an intersection of. We have a state, however, that's what differentiates sets to quantum superposition states. What state is it in?
And we have clever words for those as well to stop the lay people getting involved. So, disjunctive states, that's the any. So, if any of the numbers within a particular set are less than 20, then at least one of these numbers is less than 20. We don't know which one, because by the time we have a look at the answer,
it's disappeared. But we know at least one of them was less than 20 and that might be good enough. Conjunctive, that's our geeky term for all of them. So, all of these numbers will have to be less than 20 in order for the result to be true. The collapsed state is when we actually go to look at the answer.
That's the bit where it gets actually quite interesting. So, as soon as we look at that answer, the state collapses, we can get nothing out of that qubit anymore except was it true or false? Now, obviously, that's not completely useful. If you say, oh yeah, give me what numbers were prime? It goes, yes. I'm sorry? The answer is yes.
Some of those numbers were prime. Well, I'd kind of like to know what numbers were prime because that's why I'm doing a calculation. So, to do that, we have eigenstates. Again, another clever geeky term to stop ordinary people muscling in on our fun that basically says, just before I collapse the state, I'm gonna make a note of everything that returned true in that last operation.
And they're gonna go into the eigenstate of that qubit. So, you can then query it if you want to. So, we've had a look at various qubit things in use. I'm gonna use the same numbers again just because it makes it my copy and paste job on the slides easier. So, any is less than or equal to all.
Looks a bit strange, it's not what you expect. So, what it actually means is, are any of these numbers less than or equal to all of these numbers? That's every combination. And obviously, there's gonna be one case and one case only where this is true. What is the case where any of those numbers
is gonna be less than all of the others? It's gonna be the smallest. And if you use the eigenstates, you can get out which number was the smallest and not just, yes, a number was the smallest. There will always be one number and it will always be the smallest. And that's how you can do min. It's an interesting way of doing min
and not the way I was taught, but as I said, it's more interesting than just normal stuff. Here's another one. This is also in the samples in the tar. All the numbers between two and five, 254 for some reason, I don't remember why I picked that. So now let's divide that larger number, 255, by any of the other numbers.
Anyone wanna start hazarding guesses at what's coming up? We've divided them, they're existing. We'll then do the floor, which is sort of rounding off, knocking off any decimal points afterwards and seeing if it's the same as the number before. So now we've got all these numbers, we've divided it by any of the others that happen to be there,
and said, is it actually a whole number? So those actually return all the factors of 255 without actually any code at all. I mean, two lines to find out multiple factors. Civs are annoying and boring to program anyway. This is slightly interesting. Two lines to do full.
And I've got funny brackets as well, yes. So in practical use, this project has lots of applications and we want lots of developers. There's absolutely no practical use as far as I can see currently for modifying any numbers like this using quantum superpositions. But how else can you talk about quantum superpositions
on a Sunday afternoon and not sound pretentious? So I'm sure you'll come up with some good practical uses at some point for this. I certainly haven't. But it's nice and hard. It's a difficult problem. You can find really funky solutions to finding prime numbers, factorials, other math-y type things,
interesting ways of combining sets, subsets of sets, subsets of subsets of sets, other things like that. It forces you to think a little bit differently about how you'd normally use a library. You just say, pumping data, data comes out. It almost makes you realize why you enjoy programming in the first place. It's that fun problem-solving element.
And because it does it in such a different way, you have to solve problems in a different way. So one practical use of quantum mechanics, as those who are reading ahead will know, is that if you've got all of these things there at the same time, then actually you can't encode anything anymore. You can't encrypt anything because you just say, well, here's a qubit with all of the possible
decode instructions, approaches, keys, algorithms, and just apply them all at the same time. And it will do that. And when we have a proper physical working quantum computer, it will break every single encryption we've ever seen, which is going to be quite interesting for governments. More interesting for those who have said,
ha ha, told you. But it's going to be quite an interesting time. So if anyone has a quantum computer they want to lend to the project so we can start porting it, or a time machine that will go back to when they're possible, that will be great. So it will come sometime, I'm sure. So I did lie about one thing.
It does have a couple of practical uses. There is an algorithm called Shor's algorithm. It does some interfactorization things. So it is practical. It can solve some problems. But we actually have other methods for doing this other than using a quantum state. But it's there and it's possible.
And I'll now like for the mathematicians in the room to get the last reference. Okay, nevermind. Wasn't funny anyway. But if there are actually any questions that I could possibly answer, or questions will be answered with the words yes and no at the same time,
go ahead and ask them now because I think we've still got a minute and a half. Like you, I was on time, that's unusual. I waffle. Did I actually get everything right? I got it right! So yes, careful.
Potentially yes. Yeah, the question is, if you're doing lots of these operations with lots of any's and all's, the question is,
if you're running a query such as these any's and all's, will it actually complete? Will it finish? Could it go on forever? Is the sort of crux of the question. The answer is yes, it could. You know that it won't because you're gonna be having a data set which is finite, limited by your memory. So it will eventually finish.
But whether it's within your lifetime or anybody else's is another matter. You have a question at the front? On the real quantum computer, the other question being.
The first part of the question was, can you work out how long it would take? And the answer is yes, you can work out how long it would take for certain problem domains. Some of them you won't be able to,
but if you're implementing that sort of algorithm, and they're quite complex algorithms, you should be smart enough to know how long they're gonna take when you come to run it. Again, the full discussion is too long for these slides. But it's also, and I was gonna tell you the real practical use for this application. Unfortunately, we can't.
What's on the chart is the thank you. Thank you. The interesting property that once you open it, it's empty.