Presentation is loading. Please wait.

Presentation is loading. Please wait.

National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Quantum Computing for Programmers Paul E. Black

Similar presentations


Presentation on theme: "National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Quantum Computing for Programmers Paul E. Black"— Presentation transcript:

1 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Quantum Computing for Programmers Paul E. Black paul.black@nist.gov http://hissa.nist.gov/~black/

2 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul 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

3 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce How long does it take to delete gates? Total time is about n 2 / 2 Computing the Execution Paul Black3  n n-1  n-2  n-3 321 

4 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce 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 Paul Black 4 n

5 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce 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

6 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 6 Expected number of steps for binary search is log 2 n How Long for Binary Search?

7 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 7 Compare Performance Type#LoopsTime for n=1,000,000 Random: n 1,000,000 x c R Linear: n/2 500,000 x c L Binary: log 2 n ~20 x c B 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)

8 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce 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. f(n) cg(n) k

9 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce 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 c 1, c 2, k such that c 1 g(n)  f(n)  c 2 g(n) for all n  k. There are also notations for “greater than”, “less than or equal to”, etc. f(n) c 2 g(n) k c 1 g(n)

10 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 10 Example: Sort Algorithms Comparison of some sort algorithms Sort TypicalWorst Case Bubble sort Θ(n 2 ) same QuicksortO(n log n) O(n 2 ) Heap sortO(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

11 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce 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, Θ(n p ), and exponential, Θ(b n ). These classes are distinct: –Polynomials of polynomials are polynomials –Any exponential eventually exceeds any polynomial

12 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 12 Factoring, or What good is a quantum computer? 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 e  D(log D) 2 3

13 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 13 Shor’s Quantum Algorithm Using quantum computing, numbers can be factored in D 2 log D log log D steps Classical factoring is exponential, but quantum factoring is polynomial!

14 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce DEAD or ALIVE Schrödinger’s cat

15 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul E. Black 15 What Math Should We Use?  = ? 15 ºC 21 ºC 10 L5 L Water Alcohol

16 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul 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.

17 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 17 Polarization is a vector. What Really Happens?

18 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 18 X Y Polarization is a vector. What Really Happens? Measurement projects the vector onto a new basis.

19 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 19 Polarization is a vector. What Really Happens? Measurement projects the vector onto a new basis. X Y

20 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 20 Polarization is a vector. What Really Happens? Measurement projects the vector onto a new basis. Polarizer passes one basis.

21 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 21 X Y Polarization is a vector. What Really Happens? Measurement projects the vector onto a new basis. Polarizer passes one basis. Next polarizer measures “back into” original basis.

22 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 22 Polarization is a vector. What Really Happens? Measurement projects the vector onto a new basis. Polarizer passes one basis. Next polarizer measures “back into” original basis.

23 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 23 Superposition Single slit makes a normal distribution

24 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 24 Superposition Single slit makes a normal distribution Two slits make interference patterns, even with only one photon at a time

25 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce 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.

26 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 26 Entanglement Measuring the polarization of A changes the result of measuring B and vice versa. A B A B Entangle

27 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 27 ? 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. Fakey Entanglement Demonstration We get an even number of heads from any number of coin tosses. How?

28 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce 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

29 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce 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 Black29

30 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce What is a Tensor Product? Paul Black30

31 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce 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 Black31

32 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce 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 Black32

33 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Proof of the No-Cloning Theorem Paul Black33

34 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 34 Quantum Gates

35 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Basic Gate: Controlled-Not (CNOT) If control qubit ψ is 1, data qubit φ is flipped. Here is CNOT in ket notation Paul Black35

36 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce 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 Black36

37 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce CCNOT: A More Useful Gate Controlled-Controlled Not or Toffolli If both control qubits ψ 1 and ψ 2 are 1, the data qubit φ is flipped. This is the quantum computing version of AND gate Paul Black37

38 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Basic Gate: Hadamard Rotate 90° or “square root of not” Paul Black38 1 0 H

39 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce 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.

40 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 40 BB84: Detectable Eavesdropping

41 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 41 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: Key Value: - 0 - 1 1 Photons are discarded when Alice and Bob choose a different basis. 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 Basic BB84

42 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 42 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: Eve’s measurement creates a 25% error rate in the key generation Error! Key Value: - 0 - 1 Error! = BB84 With Eavesdropping

43 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce 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

44 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce 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 Black44

45 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce 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 Black45

46 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce 3 June 2016 Paul Black 46 Density Matrix

47 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 47 What is a Density Matrix? Sum of probability of pure states Diagonals are probabilities Off-diagonals are correlations Operations are “two-sided”:  ’  i ’  i ’   U  i  U  i  †  U  i  i  U †  U  U †   i p i  i  i    ab  ba              2 - - - -  2 - - - -  2 - - - -  2

48 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 48 Density Matrix Equivalent to a Vector within the Body of a 3-dimensional Bloch Sphere

49 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce 3 June 2016 Paul Black 49 QCSIM

50 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 50 Simulation Taxonomy Detail –Classical –Dirac ket (pure states) –Density matrix (mixed states) Time –Discrete –Continuous State –Discrete (n-level) –Continuous (finite) –Infinite Time DiscreteContinuous Mixed State Pure State Classical QCSim Detail

51 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 51 Simulation Taxonomy (cont.) Values –Concrete (e.g., ) –Symbolic (e.g., ) Simulation –Randomized (Monte Carlo or quantum trajectories) –Branching (one run; explore all choices) –Complete state (one run)

52 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 52 How Should We Represent States? Direct Simulator –Concrete input state; noise operator Must compute error model operators XeXe.707  00 .707  10 .62 - - - -.2 - - - -.15 - - - -.03

53 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 53 QCSim 4481 lines of C++, plus 205k of tests & demos State is density matrix Simulates up to 13 qubits Operations –Hadamard, X (bit flip), CNOT, Toffoli (CCNOT) –Controlled Z (Phase), H –Measure (collapse to classical binary) –Trace Over (remove from state) –Initialize and print density matrix –Probabilistic XYZ –Generalized Amplitude Damping –BSW Depolarizing CPhase

54 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 54 Input: subset of QHDL Reference qubits by name Initialize state –ket notation –normalized Gates and commands Example variable qubit0, anc: qubit; =.25|00> +.75i|11>; cnot(qubit0, anc); hadamard(anc); print_state();

55 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 55 Computation is via Superoperators Typically written as two-sided operations QCSim uses the equivalent superoperator Zeroes and identities are optimized out

56 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 56 CNOT Standard QCSim code // swap appropriate rows for (int row = 0; row size(); row++) { if ((mask & row) == mask) { int otherrow = row ^ target; for (int col = 0; col size(); col++) { temp = mat->get_state(row, col); mat->set_state(row, col, mat->get_state(otherrow, col)); mat->set_state(otherrow, col, temp); } // swap appropriate columns...  2 - - - -  2 - - - -  2 - - - -  2 1 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0

57 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 57 QCSim Results (BB84 NoEve) current state: EqBases, Error 0.5 0 0 0 0 0 0 0 0 0 0.5 0 0 0 0 0 Alice and Bob select different bases 50% of the time. The other half of the time, Alice and Bob select the same basis. An error never occurs because Bob’s info qubit is always copied directly from Alice.

58 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 58 QCSim Results for BB84 current state: BasesEq, Error 0.5 0 0 0 0 0 0 0 0 0 0.375 0 0 0 0 0.125 Alice and Bob choose a different basis 50% of the time, so it is ignored When they choose the same basis, Eve’s measurement creates an error on 1 of every 4 photons (.125/.5 = ¼) QCSim validates the 25% error rate We simulate the circuit and display the “Equal Bases” qubit and the “Error” qubit. BasesEq=0, Error=0 BasesEq=1, Error=0 BasesEq=1, Error=1

59 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 59 Teleportation

60 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Two More “Gates” Measure – convert to a classical bit Pauli Z or phase change gate Paul Black60 Z

61 National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Paul Black 61 Copy a state to another particle Input is a state and zeros Z H H


Download ppt "National Institute of Standards and Technology Technology Administration, U.S. Department of Commerce Quantum Computing for Programmers Paul E. Black"

Similar presentations


Ads by Google