190 likes | 338 Views
Cove: A Practical Quantum Computer Programming Framework. Matt Purkeypile (DCS3) Winter 2009. Quantum Computing. Quantum computers operate on qubits (quantum bits), which can be 0, 1, or a combination of the two (superposition). Changes to one qubit may impact another through entanglement.
E N D
Cove: A Practical Quantum Computer Programming Framework Matt Purkeypile (DCS3) Winter 2009
Quantum Computing • Quantum computers operate on qubits (quantum bits), which can be 0, 1, or a combination of the two (superposition). • Changes to one qubit may impact another through entanglement. • n qubits can represent 2n numbers at once. • Existing (classical) computers keep getting faster, but still operate on bits. • Simulating a quantum computer leads to an exponential slow down. • Requires 2n complex numbers to simulate n qubits, 2n x 2n complex matrix for an operation. • With quantum computers several things can be done efficiently: simulation of quantum systems, factoring, and unsorted database search to name a few.
What is Cove? • Cove is a software framework that allows for quantum computation to be performed using a classical language. • Two key components: interfaces and implementations. • Interfaces specify what needs to be provided to program quantum computers. • Implementations specify how. • If users code to interfaces, implementations can be swapped out with ideally no change to user code. • A prototype implementation is part of the project. This simulates a quantum computer locally on a PC. • Implemented in C#
What did I do last term? • Completed more work in the local simulation implementation. • Got it to the point where it can carry out simple examples such as entanglement. • Also able to carry out many operations without “slicing”. • Completed a major revision and restructuring of the dissertation. • While still lengthy, I’m much more comfortable with the structure now.
Factoring • Shor’s algorithm (1994) allows for efficient factoring on a quantum computer. • Spurred more interest in quantum computing as it was the first “real world” algorithm. • Quantum computers first thought of in the early 1980’s. • Efficient factoring allows for cracking codes. • Such as the commonly used RSA algorithm. • Why? N=pq is easy to calculate when given pq, but hard if only given N. (Sometimes see the term “one way functions”.)
High Level View of Factoring • Most of steps of the algorithm can be carried out classically. • A probabilistic algorithm: may have to repeat runs until the answer is achieved.
Trivial Example • Goal: Factor 15. Result is 3 and 5. • This has been done on quantum computers in the lab. • A simple example that can easily be worked out by hand. • Step 1, let: • N = 15 (the number we are factoring) • n = number of (qu)bits needed to express N, in this case 4. • m = 8 (a randomly selected number between 1 and N)
Step 2 • Calculate • Need to calculate with enough x’s to find the period. x = 0, 1, 2, …. • In general, go to at least n2 values: 0 – 15 in this case. (It seems like guessing would be faster, but isn’t.) • Given this we can find the period (P). • Essentially where f(x) repeats. • In other words f(x + P) = f(x) for every x. • This is the part of the algorithm where a quantum computer is used and makes it efficient.
Using the result • The period is 4, as it repeats 1, 8, 4, 2,… • This concludes step 2 • Step 3: is the period even? • If not we start over using a different randomly selected m. • Step 4: Utilize the period (P):
Check the result • gcd(65, 15) = 5 and gcd(63, 15) = 3 • This is can be done efficiently on classical computers [1]. • Step 5: we have found the factors 5 and 3. • May only obtain one of the factors for many numbers. • Simple to obtain the second factor if not found, basic algebra: pq=N, we know N and either p or q. • Start over with a different m if the gcd of the results are 1. [1] M. A. Nielsen and I. L. Chuang, Quantum Computation and Quantum Information, 1 ed. Cambridge, UK: Cambridge University Press, 2000.
Why a quantum computer? • A quantum computer speeds things up by doing step 2 (finding the period) efficiently. • Qubits are put in a superposition to represent all possible x’s at once (in the first register). • In the case of factoring 15 we need 12 qubits (2(4) + 4, as we need two registers) [2] • Next f(x) is performed on the qubits in superposition. • One calculation on a quantum computer, many more classically. • The result is put in the second register. • Measure Register2- Collapses the superpositions. • The period is then obtained via the quantum Fourier transform followed by a measurement • The rest of the algorithm is done classically. [2] N. S. Yanofsky and M. A. Mannucci, Quantum Computing for Computer Scientists, 1 ed. New York, NY: Cambridge University Press, 2008.
How does this scale? • 15 is a trivial example, how about a 128 bit number? • We need 384 qubits (128 * 3) to do the quantum part of the algorithm. • The quantum operations that are performed are done once, just on more qubits. Similar to adding two integers: same technique, more bits. • If we do it classically we have to calculate f(x) many times. • It isn’t how easy it is to calculate f(x), it is how many times. • Need to go from 0 to n2 , this is a huge number of calculations for a 128 bit number. This means 2(2*128) or ~1.16 x 1077 • The results have to be stored somewhere (taking up memory) and then we still have find the period! • Or we can just use 384 qubits and run through a set of quantum operations, so the quantum computer scales quite well. • Quantum Fourier Transform also finds the period in one operation.
Goals for Winter 2009 • Get Shor’s algorithm (factoring) working in Cove. • Requires additional work on the local simulation prototype. • Fill in the sections for Shor’s algorithm in the dissertation. • Incorporate feedback from the Fall 2008 draft. • Includes making the message more consistent. • Ideally, all of the major content in the dissertation by the end of the term. • This leaves a few months for editing and cleanup. • Won’t be perfect, but the “meat” will be there. • Goal: Defend in late June 2009.
Questions? (Courtesy of XKCD) https://cove.purkeypile.com/ mpurkeypile@acm.org