1 / 61

Quantum Computing for Programmers

Quantum Computing for Programmers. Paul E. Black paul.black@nist.gov http://hissa.nist.gov/~black/. An Experience in Torpor. Steps in reading a computer chip design Add gates to “not done” list Process gates from top to bottom Remove gate from “not done” list Big designs were very slow

kenkelly
Download Presentation

Quantum Computing for Programmers

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Quantum Computing for Programmers Paul E. Black paul.black@nist.gov http://hissa.nist.gov/~black/

  2. An Experience in Torpor • Steps in reading a computer chip design • Add gates to “not done” list • Process gates from top to bottom • Remove gate from “not done” list • Big designs were very slow Why??? Note: gates added to head of list Paul Black

  3. Computing the Execution • How long does it take to delete gates? • Total time is about n2/2 n •   n-1 •   n-2 •   n-3 •   •   •   •   •   3 2 1 Paul Black

  4. How Long to Search an Array? • Code for linear search: while (a[++i].key != value …); • Average number of steps for linear search is n/2 n Paul Black

  5. How Long for Random Search? • Code for random search: while (a[rand(0,a.size)].key != value); • Expected number of steps for random search is n Paul Black

  6. How Long for Binary Search? • Expected number of steps for binary search is log2 n Paul Black

  7. Compare Performance • Type #Loops Time for n=1,000,000 Random: n 1,000,000xcR Linear: n/2 500,000xcL Binary: log2 n ~20xcB where c is time for 1 loop • Ignoring constant multiples, we say random search is O(n) linear search is O(n) binary search is O(log n) Paul Black

  8. Definition of O(m) • Informally, saying f(n) = O(g(n)) means f(n) is less than a constant times g(n) • Formally: there exist positive constants c and k such that 0  f(n)  cg(n) for all n  k. • Big-O notation can also express memory use, messages sent, average time, worst case, etc. cg(n) f(n) k Paul Black

  9. Definition of θ(m) • Informally, saying f(n) = θ(g(n)) means f(n) equals, or grows as fast as, g(n) • Formally: there exist positive constants c1, c2,k such that c1g(n)  f(n)  c2g(n) for all n  k. • There are also notations for “greater than”, “less than or equal to”, etc. c2g(n) f(n) c1g(n) k Paul Black

  10. Example: Sort Algorithms • Comparison of some sort algorithms Sort Typical Worst Case Bubble sort Θ(n2) same Quicksort O(n log n) O(n2) Heap sort O(n log n) same • Bubble sort: repeatedly pass through the list swapping items until all are in order • Improvements(?) • Bidirectional bubble sort: go both directions • Don’t go beyond last swap Paul Black

  11. Polynomial vs. Exponential • Traveling Salesman: find shortest route to visit every city on a list and return home. • Best exact algorithm is Θ(n!)≈Θ((n/e)n) where n is the number of cities. • Algorithms tend to fall into two classes: polynomial, Θ(np), and exponential, Θ(bn). • These classes are distinct: • Polynomials of polynomials are polynomials • Any exponential eventually exceeds any polynomial Paul Black

  12. Factoring, orWhat good is a quantum computer? 3 eD(log D)2 • RSA, a good encryption scheme, is secure because factoring large numbers is hard • After centuries of work, the best factoring algorithm is the Number Field Sieve • Factor a D-digit number in steps • A key 8 times longer • Takes 64 times longer to multiply, but • Squares the time to factor Paul Black

  13. Shor’s Quantum Algorithm • Using quantum computing, numbers can be factored in D2 log D log log D steps • Classical factoring is exponential, but quantum factoring is polynomial! Paul Black

  14. Quantum Mechanics DEAD or ALIVE Schrödinger’s cat

  15. What Math Should We Use?  = ? 10 L 5 L 15 ºC 21 ºC Water Alcohol Paul E. Black

  16. Polarization is really a measurement • A filter yields only photons with the same alignment. • A second filter at right angles blocks all photons. • A third filter in between those two allows some photons to pass. Paul Black

  17. What Really Happens? • Polarization is a vector. Paul Black

  18. What Really Happens? Y X • Polarization is a vector. • Measurement projects the vector onto a new basis. Paul Black

  19. What Really Happens? Y X • Polarization is a vector. • Measurement projects the vector onto a new basis. Paul Black

  20. What Really Happens? • Polarization is a vector. • Measurement projects the vector onto a new basis. • Polarizer passes one basis. Paul Black

  21. What Really Happens? Y X • Polarization is a vector. • Measurement projects the vector onto a new basis. • Polarizer passes one basis. • Next polarizer measures “backinto” original basis. Paul Black

  22. What Really Happens? • Polarization is a vector. • Measurement projects the vector onto a new basis. • Polarizer passes one basis. • Next polarizer measures “backinto” original basis. Paul Black

  23. Superposition • Single slit makes a normal distribution Paul Black

  24. Superposition • Single slit makes a normal distribution • Two slits make interference patterns, even with only one photon at a time Paul Black

  25. Superposition • A quantum system’s state may be several potential places, spins, etc. at once. • Quantum algorithms often start with qubits in a superposition of 1s and 0s. Paul Black

  26. Entanglement • Measuring the polarization of A changes the result of measuring B and vice versa. A A Entangle B B Paul Black

  27. Fakey Entanglement Demonstration Heads are “entangled”: there is a 100% correlation between getting one head and getting the other. We don’t know when we will get heads, but we know we will always get them together. We get an even number of heads from any number of coin tosses. How? ? Paul Black

  28. How Do We Represent a State? Classical (binary) Example for 2 variables: a = {00, 01, 10, 11} Use 1 bit per variable Limitation: Can’t represent superposition or entanglement 1 0 Paul Black

  29. Dirac or “ket” notation • Quantum bit or qubit: … a quantum system with two discrete states.1 • States are expressed in ket notation: • Multiple states are combined using a tensor product in some fixed order: • Tensor product may be implicit and is associative, but not commutative: Paul Black

  30. What is a Tensor Product? Paul Black

  31. How do kets represent superposition? • Superpositions are sums of states, each with “amplitude”: a complex number • Probability is norm squared amplitude, e.g. above is found in state |0> with probability 1/2 • Complex numbers needed for interference • A general 2 qubit system is in state Paul Black

  32. Can We Copy an Unknown State? • We might measure exactly by copying an unknown state onto many other particles. • Formally, assume there is U such that • Is there a consistent definition for U? In other words, what is the value of Paul Black

  33. Proof of the No-Cloning Theorem Paul Black

  34. Quantum Gates Paul Black

  35. Basic Gate: Controlled-Not (CNOT) • If control qubit ψ is 1, data qubit φ is flipped. • Here is CNOT in ket notation Paul Black

  36. CNOT if input is in superposition • If control qubit ψ is 1, data qubit φ is flipped. • What happens if input is a superposition? • The output is entangled! Paul Black

  37. CCNOT: A More Useful Gate • Controlled-Controlled Not or Toffolli • If both control qubits ψ1and ψ2 are 1, the data qubit φ is flipped. • This is the quantum computing version of AND gate Paul Black

  38. Basic Gate: Hadamard • Rotate 90° or “square root of not” 1 H 0 Paul Black

  39. Dirac or “ket” Notation • Equivalent to a vector on the surface of a 3-dimensional Bloch sphere You have reached an imaginary number. Rotate your phone 90° and try again. Paul Black

  40. BB84: DetectableEavesdropping Paul Black

  41. Basic BB84 • Alice chooses random bases and polarizations to send photons Alice’s Basis:Alice Sends: • Bob then chooses random bases to measure the photons Bob’s Basis:Bob Receives: • Photons are discarded when Alice and Bob choose a different basis. Key Value: - 0 - 1 1 • Alice and Bob wish to generate a shared secure private key • If Bases differ, Bob measures randomly polarized photon • If Bases match, Bob measures same polarization as Alice sent Paul Black

  42. BB84 With Eavesdropping • An eavesdropper (Eve) measures the photons sent by Alice in her own random basis and then forwards them to Bob: Alice’s Basis: Alice Sends: Eve’s Basis: Eve Sends: = Bob’s Basis: Bob Receives: Key Value: - 0 - 1 Error! • Eve’s measurement creates a 25% error rate in the key generation Paul Black

  43. The Quantum Processor Checklist • Well-defined quantum states for qubits • State preparation or initialization • Scalable • Pure states • High-fidelity operations “on demand” • Entangling operations and quantum gates • Controlled-Not Gate • Phase Gate • Efficient readout • Little “noise” (decoherence) per operation Paul Black

  44. More information • Paul E. Black, D. Richard Kuhn, and Carl J. Williams, “Quantum Computing and Communication”, Advances in Computers, Marvin Zelkowitz, ed., vol 56, pp 189-244. http://hissa.nist.gov/~black/Papers/quantumCom.html • QCSim quantum simulator available at http://hissa.nist.gov/~black/Source/qcsim.tar.gz Paul Black

  45. More resources • Complexity – Big O notation http://en.wikipedia.org/wiki/Big_O_notation • Summary of quantum algorithms http://www.its.caltech.edu/~sjordan/zoo.html • Known quantum algorithms offering speedup over the best known classical algorithms. It has links to pedagogical (noncomprehensive) surveys of quantum algorithms and an overview at a semipopular level. Paul Black

  46. Density Matrix Paul Black

  47. What is a Density Matrix? a2 - - - - b2 - - - - g2 - - - - d2 |abñ ába| = (a*b*g*d*) = abgd • Sum of probability of pure states • Diagonals are probabilities • Off-diagonals are correlations • Operations are “two-sided”: r’ = |yi’ñáyi’|= U|yiñ(U|yiñ)†= U|yiñáyi|U† = UrU† r = Si pi|yiñ áyi| Paul Black

  48. Density Matrix • Equivalent to a Vector within the Body of a 3-dimensional Bloch Sphere Paul Black

  49. QCSIM Paul Black

  50. Simulation Taxonomy Mixed State QCSim Detail Pure State Classical Discrete Continuous Time • Detail • Classical • Dirac ket (pure states) • Density matrix (mixed states) • Time • Discrete • Continuous • State • Discrete (n-level) • Continuous (finite) • Infinite Paul Black

More Related