ludovic noirie 2019 09 25 http ludovic noirie fr sciences
play

Ludovic Noirie 2019/09/25 - PowerPoint PPT Presentation

Ludovic Noirie 2019/09/25 http://ludovic-noirie.fr/sciences/quantum-computing 1 . 1 1. Outline, Sources, Python libraries, Web sites 2. Quantum Mechanics 3. Quantum Computers and Qubits 4. Quantum Logic Gates 5. Quantum Algorithms 6.


  1. Relational Quantum Mechanics Relational Quantum Mechanics Rov1996 Rov1996 See also https://en.wikipedia.org/wiki/Relational_quantum_mechanics . Quantum mechanics is a theory about the physical description of physical systems relative to other systems, and this is a complete description of the world. This means that the state of a system is relative to the observer. A quantum state encodes the information an observer has about the observed system. Rov1996 is also a tentative of Quantum Mechanics reconstruction Postulate 1: There is a maximum amount of relevant information that may be obtained from a quantum system. Postulate 2: It is always possible to obtain new information from a system. This means that probabilities are natural. Observation is information retrieving for the observer, and information means probabilities (see Shannon's theory of information). 5 . 13

  2. Relational Quantum Mechanics (RQM) "solves" quantum paradoxes: Schrödinger's cat Relational Quantum Mechanics (RQM) "solves" quantum paradoxes: Schrödinger's cat Sch1935 E. Schrödinger: Die gegenwärtige Situation in der Quantenmechanik (The present situation in quantum mechanics). Naturwissenschaften, 23(48):807–812, 1935. https://doi.org/10.1007%2FBF01491891 . Is the cat dead or alive? With RQM, it depends on the observer: An observer who is outside the box does not know and encodes his/her knowledge in a superposition (dead + alive) state. An observer who is inside the box makes the measurement so he/she knows and encodes his/her knowledge in a separable (dead or alive, depending on the measurement result) state. 5 . 14

  3. Relational Quantum Mechanics (RQM) "solves" quantum paradoxes: Einstein- Relational Quantum Mechanics (RQM) "solves" quantum paradoxes: Einstein- Podolsky-Rosen paradox Podolsky-Rosen paradox EPR1935 A. Einstein, B. Podolsky and N. Rosen, "Can Quantum-Mechanical Description of Physical Reality Be Considered Complete?" Phys. Rev., 47(10):777-780, 1935. https://doi.org/10.1103/PhysRev.47.777 . Absolute realism, locality of interactions and completeness of Quantum Mechanics are incompatible. EPR conclusion: Quantum Mechanics is incomplete, because absolute realism and locality (Special Relativity theory) must hold. Mainstream current conclusion: Locality does not holds, because of Bell's inequality violation (Alain Aspect's experiments). RQM conclusion: Absolute realism does not hold, because quantum states are relative to the observer. SR2007 M. Smerlak and C. Rovelli: Relational: EPR. Found. Phys., 37(3):427-445, 2007. https://arxiv.org/abs/quant-ph/0604064 . 5 . 15

  4. Statistical distance Statistical distance Woo1981 Woo1981 i) Statistical distance between probability vectors ii) Statistical distance between quantum states 5 . 16

  5. Statistical distance between probability vectors Statistical distance between probability vectors Woo1981 Woo1981 We consider the probability space . We consider two probability vectors and , and the set of curves on starting at and ending at . We fix . We note the minimal number of probability vectors "statistically distinguishable" in trials that covers the curve . Question : When can we say that two probability vectors are "statistically distinguishable" in trials? 5 . 17

  6. Distinguishability angular diameter around a probability vector : If the expected frequencies are and the measured frequencies are with , the probability distribution to observe is the multinomial distribution . When , follows a distribution with degrees of liberty. The angle between the unitary vectors and verifies . When , and , thus . Finally and . We can define the distinguishable diameter around the probability vector after trials by: 5 . 18

  7. Definition : The statistical distance between two probability vectors and measure the distinguishability between these two probability vectors: Theorem : The statistical distance between two probability vectors and is equal to the angle between the unitary vectors and : 5 . 19

  8. Statistical distance between quantum states Statistical distance between quantum states Woo1981 Woo1981 We consider the finite Hilbert space of dimension . We consider two quantum states and represented by the two unitary vectors and . We note the orthonormal basis representing the possible quantum states after a given complete measurement and the set of all possible complete measurements. Any orthonormal basis represents at least one possible complete measurement . We note a complete measurement such as and a complete measurement such as . 5 . 20

  9. Definitions : The statistical distance between quantum states and relatively to the measurement is the statistical distance of between the corresponding probability vectors: The absolute statistical distance between quantum states and is the maximal value of the relative statistical distances: Theorem : The absolute statistical distance between quantum states and is reached when or and is equal to the angle between the two rays representing the two quantum states and : 5 . 21

  10. 6 . 1

  11. 1. Generic Quantum Computer system 2. Qubits 3. Quantum registers 7 . 1

  12. A quantum computer is simply a quantum system obeying the laws of Quantum Mechanics Like a classical computer, the usage of a quantum computer can be divided in 4 steps: (1) Initial register value = Input quantum system state (2) Quantum processing = Interactions inside the quantum system (3) Final register value = Output quantum system state (4) Measurement of the final register value = Observable outcomes 8 . 1

  13. (1) Initial register value = Input quantum system state (complex vector) Hilbert spaces (complex vector spaces) and Tensor product of Hilbert spaces with Note: but Separable input state (tensor product of complex vectors) with for Generic (separable or entangled) input state: Hermitian product 9 . 1

  14. (2) Quantum processing = Interactions inside the quantum system = Unitary evolution according to Schrödinger equation Unitary operator (unitary square matrix with complex numbers) = Quantum logic gate : with , Linearity: Quantum serial processing = Matrix multiplication: Quantum parallel processing = Matrix tensor product on : 10 . 1

  15. (3) Final register value = Output quantum system state: Hilbert spaces (complex vector spaces) and Tensor product of Hilbert spaces with Generic (for almost all cases entangled) output state: 11 . 1

  16. (4) Measurement of the final register value = Observable outcomes Hermitian observable operator (hermitian matrix ) Measurement on output register only: Quantum computer: observable output register states = classical bits on output register: Observable = sum of projectors on classical register values with eigenvalues Register measurement ( ): Final register after measurement is an eigenvector of the measurement operator/matrix such as with probability ( ) Qubit parallel measurement ( ): 12 . 1

  17. Qubit definition Qubit definition The smallest non-degenerated Hilbert space is . The elements of are qubits . The two qubits and form an orthonormal basis of . The qubits (= quantum bits) are all the possible superpositions (normalized to 1). The subset of classical bits is simply : the potential measurement outcome of the (z-axis direction) spin observable observable . For any unitary operator , i.e., such as , and form another orthonormal basis of (unitary operators = transformations between orthonormal bases). 13 . 1

  18. Qubit physical realization Qubit physical realization Any physical system with spin is a qubit, with possible measured values and . Spin is a kind of intrinsic angular momentum of a "very small" quantum system. A system with spin has the possible measurement outcomes , , ..., , , and . Bosons have spins Fermions have spins Any fundamental fermion has spin : quarks (up , down , charm , strange , top and bottom ), leptons (electron , muon , tauon and neutrinos ), and their anti-particles . The usual choice of a basis of states is (z-axis of Bloch sphere). Other bases are for example (y-axis of Bloch sphere) and (x-axis of Bloch sphere). 14 . 1

  19. Photons have spin 1, with potential values , and . But because of relativistic effects (speed of light), value is forbidden. Thus a photon is also a qubit with possible values and , corresponding to left and right circular polarization of light. Another basis is the one with vertical vs. horizontal polarizations. For polarization of photons, with and , we have the following relationships: . 14 . 2

  20. Bloch sphere representation of Qubit Bloch sphere representation of Qubit Any qubit can be represented by the general form of a unitary vector in : with and . Bloch sphere physical interpretation of any qubit: Directed axis of rotation of the 1/2-spin in our physical 3D euclidian (real) space Orthogonal states being antipodal points (= same line with opposite rotations) ⇒ Physical meaning: Elementary fermions = qubits Our 3D physical space comes from qubits... See https://en.wikipedia.org/wiki/Bloch_sphere 15 . 1

  21. The usual choice of basis corresponds to the z-axis of Bloch sphere: Any other pair of antipodal points in the Bloch sphere form an orthonormal basis of . Basis of y-axis of Bloch sphere: Basis of x-axis of Bloch sphere: https://www.st-andrews.ac.uk/physics/quvis/simulations_html5/sims/blochsphere/blochsphere.html . 16 . 1

  22. A quantum register is the association of qubits that are processed together. A state of a quantum register is an element of the tensor product of : . States with , i.e., with , form an orthonormal basis of . Mesuring the state of the register in this basis corresponds to get the value , by measuring the values or for each qubit . Complexity: qubits gives values . qubits number of atoms in the observable universe... 17 . 1

  23. 18 . 1

  24. 1. Quantum logic gates for qubits 2. Quantum logic gates for quantum registers 3. Quantum registers 19 . 1

  25. A quantum logic gate on a qubit is any unitary operator acting on a qubit. The set of unitary operators on qubits is . The generic form is with , , and (we also have , ). So another generic form is with and modulo . Look at sub-slides for the detailed description of quantum logic gates on qubits 20 . 1

  26. Generic python functions used in this notebook to test quantum gates on qubits In [2]: def qubitExperiment(nbExp,gate,thProbaUnchanged): res="Input qubit => Output qubit for "+str(nbExp)+" experiments \n " for inputQubit in range(0,2): # Test first with |0> then with |1> res+=str(inputQubit)+" => " s = 0; for i in range(0,nbExp): # Test 'nbExp' times r = gate(inputQubit) s+=r res+=str(r)+" " res+=": "+" {:>5.0%} ".format(s/nbExp)+" \n " if theoreticalProbaUnchanged>-1: # If not -1, print the theoretical values res+="Expected probabilities: "+" {:.2%} ".format(1-thProbaUnchanged) res+=" & "+" {:.2%} ".format(thProbaUnchanged) print(res) # Print the results of all experiments def createQubit(bit): qubit = QC.allocate_qubit() # Create a qubit with value |0> if bit == 1: # Change it to |1> if bit = 1 QG.X | qubit # by using the NOT gate (X) return qubit # Return the qubit initialized to |bit> def measureQubit(qubit): QG.Measure | qubit # Measure the qubit QC.flush() # Flush the Quantum Computer return int(qubit) # Return the result of measurement 20 . 2

  27. Quantum NOT Quantum NOT The quantum NOT inverts the qubits and . 20 . 3

  28. In [3]: def NOTgate(bit): # Create a qubit with value = bit (0 or 1) qubit = createQubit(bit) # Apply the gate NOT (=X) QG.X | qubit # Measure the qubit result = measureQubit(qubit) return result theoreticalProbaUnchanged = 0 qubitExperiment(32,NOTgate,theoreticalProbaUnchanged) Input qubit => Output qubit for 32 experiments 0 => 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 : 100% 1 => 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 : 0% Expected probabilities: 100.00% & 0.00% 20 . 4

  29. Hadamard gate Hadamard gate The Hadamard gate produces uniform random qubits, which allows parallelization of operations. is hermitian and unitary, so it is a square root of the identity: . 20 . 5

  30. In [4]: def HadamardGate(bit): # Create a qubit with value = bit (0 or 1) qubit = createQubit(bit) # Apply the Hadamard gate H QG.H | qubit # Measure the qubit result = measureQubit(qubit) return result theoreticalProbaUnchanged = 0.5 qubitExperiment(32,HadamardGate,theoreticalProbaUnchanged) Input qubit => Output qubit for 32 experiments 0 => 0 1 0 0 0 0 1 1 1 0 1 0 0 1 1 1 1 1 0 1 1 0 0 0 0 0 0 0 0 1 0 0 : 41% 1 => 0 0 1 1 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 1 0 0 1 1 0 0 1 0 0 1 1 0 : 34% Expected probabilities: 50.00% & 50.00% 20 . 6

  31. Phase gates Phase gates The phase gate of phase rotates the phases of the qubits and by . 20 . 7

  32. In [5]: def PhasePi8gate(bit): # Create a qubit with value = bit (0 or 1) qubit = createQubit(bit) # Apply a phase of pi/8 to all: qubits QG.Ph(np.pi/8) | qubit # Measure the qubit result = measureQubit(qubit) return result theoreticalProbaUnchanged = 1 qubitExperiment(32,PhasePi8gate,theoreticalProbaUnchanged) Input qubit => Output qubit for 32 experiments 0 => 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 : 0% 1 => 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 : 100% Expected probabilities: 0.00% & 100.00% 20 . 8

  33. Phase-shift gates Phase-shift gates The phase-shift gate of phase lets the qubit unchanged and rotate the phase of the qubit by . Phase-shift on qubit : . The phase-shift gates form the subgroup of : , and . 20 . 9

  34. In [6]: def PhaseShiftPi8gate(bit): # Create a qubit with value = bit (0 or 1) qubit = createQubit(bit) # Apply a phase shift of pi/8 QG.R(np.pi/8) | qubit # Measure the qubit result = measureQubit(qubit) return result theoreticalProbaUnchanged = 1 qubitExperiment(32,PhaseShiftPi8gate,theoreticalProbaUnchanged) Input qubit => Output qubit for 32 experiments 0 => 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 : 0% 1 => 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 : 100% Expected probabilities: 0.00% & 100.00% 20 . 10

  35. Pauli gates Pauli gates With , or , , the Pauli matrix represents the rotation around the -axis of the Bloch sphere by . is hermitian and unitary, so they are suare root of the identity: . The three Pauli matrices with the identity form a basis for the vector space of 2 × 2 Hermitian matrices (and also the natural basis of the quaternions by multiplying the Pauli matrices by ). 20 . 11

  36. In [7]: def Ygate(bit): # Create a qubit with value = bit (0 or 1) qubit = createQubit(bit) # Apply the Pauli gate Y QG.Y | qubit # Measure the qubit result = measureQubit(qubit) return result theoreticalProbaUnchanged = 0 qubitExperiment(32,Ygate,theoreticalProbaUnchanged) Input qubit => Output qubit for 32 experiments 0 => 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 : 100% 1 => 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 : 0% Expected probabilities: 100.00% & 0.00% 20 . 12

  37. Rotation gates Rotation gates With , or , the rotation matrix represents the rotation around the -axis of the Bloch sphere by . They are defined by the exponential of the Pauli matrices : . We thus have for , or , and . 20 . 13

  38. In [8]: def RxPi3Gate(bit): # Create a qubit with value = bit (0 or 1) qubit = createQubit(bit) # Apply the rotation gate R with angle pi/3 QG.Rx(np.pi/3) | qubit # Measure the qubit result = measureQubit(qubit) return result theoreticalProbaUnchanged = np.cos(np.pi/6)*np.cos(np.pi/6) qubitExperiment(32,RxPi3Gate,theoreticalProbaUnchanged) Input qubit => Output qubit for 32 experiments 0 => 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 1 0 0 1 0 0 1 : 25% 1 => 0 1 1 0 0 1 1 1 1 0 0 1 1 0 0 1 1 1 0 1 1 0 1 0 1 0 1 1 1 0 1 1 : 62% Expected probabilities: 25.00% & 75.00% 20 . 14

  39. Roots of gates Roots of gates A square root of is any quantum gate such as . For example, the square root of NOT is because . A -root of is any quantum gate such as . 20 . 15

  40. In [9]: def SQRTNOT(bit): # Create a qubit with value = bit (0 or 1) qubit = createQubit(bit) # Apply the square root NOT gate QG.SqrtX | qubit # Measure the qubit result = measureQubit(qubit) return result theoreticalProbaUnchanged = 0.5 qubitExperiment(32,SQRTNOT,theoreticalProbaUnchanged) Input qubit => Output qubit for 32 experiments 0 => 1 0 1 0 1 1 0 0 0 0 1 1 0 1 0 1 1 1 0 0 0 0 1 1 1 0 0 0 1 1 1 0 : 50% 1 => 1 1 1 0 0 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 1 1 0 1 0 1 1 1 1 : 56% Expected probabilities: 50.00% & 50.00% 20 . 16

  41. Clifford gates Clifford gates The Clifford Gates are: (1) The Hadamard gate: . (2) The and gates: , . (3) The and gates: , . 20 . 17

  42. In [10]: def Sgate(bit): # Create a qubit with value = bit (0 or 1) qubit = createQubit(bit) # Apply the S gate QG.S | qubit # Measure the qubit result = measureQubit(qubit) return result theoreticalProbaUnchanged = 1 qubitExperiment(32,Sgate,theoreticalProbaUnchanged) Input qubit => Output qubit for 32 experiments 0 => 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 : 0% 1 => 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 : 100% Expected probabilities: 0.00% & 100.00% In [11]: def TdaggerGate(bit): # Create a qubit with value = bit (0 or 1) qubit = createQubit(bit) # Apply the T-dagger gate QG.Tdag | qubit # Measure the qubit result = measureQubit(qubit) return result theoreticalProbaUnchanged = 1 qubitExperiment(32,TdaggerGate,theoreticalProbaUnchanged) Input qubit => Output qubit for 32 experiments 0 => 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 : 0% 1 => 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 : 100% Expected probabilities: 0.00% & 100.00% 20 . 18

  43. Generic quantum logic gates for qubits Generic quantum logic gates for qubits A generic form is: with and modulo . This can be also written: , i.e., , with , and . Each term can be expressed with quantum gates , and : for any ; 20 . 19

  44. can also be expressed with quantum gates and : Thus any quantum gate on qubits can be expressed as a product of Hadamard gates and phase-shift gates: they are generated by the sub-group of phase-shift gates and the Hadamard gate. 20 . 20

  45. In [12]: def CosSinPi8Gate(bit): # Create a qubit with value = bit (0 or 1) qubit = createQubit(bit) # Apply the Hadamard gate H QG.H | qubit # Apply a phase shift of pi/8 QG.R(np.pi/8) | qubit # Apply the NOT gate QG.X | qubit # Apply a phase shift of -pi/8 QG.R(-np.pi/8) | qubit # Apply the NOT gate QG.X | qubit # Apply the Hadamard gate H QG.H | qubit # Measure the qubit result = measureQubit(qubit) return result theoreticalProbaUnchanged = np.cos(np.pi/8)*np.cos(np.pi/8) qubitExperiment(32,CosSinPi8Gate,theoreticalProbaUnchanged) Input qubit => Output qubit for 32 experiments 0 => 1 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 : 16% 1 => 1 1 1 0 1 1 1 1 1 0 1 0 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 : 84% Expected probabilities: 14.64% & 85.36% 20 . 21

  46. Diagrams of 1-qubit gates Diagrams of 1-qubit gates Explore quantum gates on qubits with: http://ludovic-noirie.fr/sciences/quantum-computing/link/Quirk.qubitGate.htm 21 . 1

  47. A quantum gate on a quantum register is any unitary operator acting on a quantum register. The set of unitary operators on quantum registers of qubits is . with , , , and . Look at sub-slides for the detailed description of quantum logic gates on quantum register 22 . 1

  48. Generic python functions used in this notebook to test quantum gates on quantum registers In [13]: def quregisterExperiment(nbExp,logNbIn,gate,param=[],formatIn="",formatOut=""): res="Input quregister => Output quregister for "+str(nbExp)+" experiments \n " for x in range(0,2**logNbIn): # Test with |x> , x = 0 to nbIn-1 res+=("{"+formatIn+"} => ").format(x) for i in range(0,nbExp): # Test 'nbExp' times r = gate(x,param) res+=("{"+formatOut+"} ").format(r) res+=" \n " print(res) # Print the results of all experiments def createQuregister(n,x): qureg = QC.allocate_qureg(n) # Create a quregister of n qubits |0> QM.AddConstant(x) | qureg # Change value to |x> return qureg # Return the quregister |x> def measureQuregister(qureg): QG.All(QG.Measure) | qureg # Measure the quregister QC.flush() # Flush the Quantum Computer n = len(qureg) # Size of the quregister y = 0 # Transform quregister into integer for i in range(0,n): # with this for loop y = 2*y + int(qureg[n-i-1]) return y # Return the result of measurement 22 . 2

  49. Kronecker product quantum gates Kronecker product quantum gates Each qubit , , of the register is processed independently with the single-qubit quantum gate . The resulting unitary operator is the Kronecker product of the quantum gates : More generally, the Kronecker product of the quantum gates such as acting on quantum sub-registers is: 22 . 3

  50. Diagrams of Kronecker product gates 23 . 1

  51. Quantum Hadamard transform gate, parallelization and random generator Quantum Hadamard transform gate, parallelization and random generator The quantum Hadamard transform gate on a quantum register of qubits is the Kronecker product of Hadamard gates on each qubit. with . This gate is used to process in parallel all the register values for , unitary operators being linear. A random generator can be made by applying the quantum Hadamard transform gate to the register value : After measurement, the probability to get the state for is . This is a perfect random generator. 23 . 2

  52. Diagram of an Hadamard transform gate 24 . 1

  53. In [14]: def randomGenerator(x,param): n = param[0] # number of qubits in the quregister # Create a quregister with n qubits, value x qureg = createQuregister(n,x) # Apply the Hadamard gate H to all qubits QG.All(QG.H) | qureg # Measure the quregister result = measureQuregister(qureg) return result quregisterExperiment(32,3,randomGenerator,[3]) Input quregister => Output quregister for 32 experiments 0 => 1 7 3 4 6 1 2 6 1 0 3 2 4 1 4 6 5 3 7 5 4 2 5 4 1 0 6 0 7 5 4 5 1 => 5 3 6 0 7 4 1 2 3 7 0 5 0 0 7 1 4 4 0 6 3 1 5 3 2 1 6 5 1 7 4 4 2 => 5 0 1 2 3 7 4 0 3 3 6 5 5 0 2 7 4 2 2 5 7 7 1 0 1 6 6 6 6 7 2 6 3 => 1 0 5 2 7 1 7 5 2 2 1 4 6 4 0 0 3 2 7 5 2 1 5 1 7 5 7 7 0 1 3 6 4 => 3 3 7 2 2 4 4 1 7 1 2 0 0 4 3 2 0 6 5 4 4 1 1 2 2 2 5 5 6 3 5 3 5 => 2 1 5 4 2 5 7 1 6 2 0 5 6 1 1 5 4 2 6 7 2 1 1 0 5 7 5 5 1 2 1 1 6 => 0 7 7 4 4 6 7 5 2 1 0 0 2 5 3 5 5 2 5 5 2 5 3 5 1 6 1 0 3 0 0 2 7 => 7 0 5 1 6 5 1 6 3 1 5 3 2 5 1 3 2 1 1 7 1 3 0 5 7 5 7 0 4 1 5 4 24 . 2

  54. Action on a sub-register of a quantum register Action on a sub-register of a quantum register A quantum register can be split into two sub-registers, for example, if , then for , , with and . An operator which acts only on the sub-register , with sub-operator can be written: 24 . 3

  55. Diagram of a sub-register gate 25 . 1

  56. In [15]: def singleQubitHadamard(x,param): n = param[0] # number of qubits in the quregister # Create a quregister with n qubits, value x qureg = createQuregister(n,x) # Apply the Hadamard gate H to last qubit QG.H | qureg[0] # Measure the quregister result = measureQuregister(qureg) return result quregisterExperiment(32,3,singleQubitHadamard,[3]) Input quregister => Output quregister for 32 experiments 0 => 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 1 1 0 1 1 1 1 1 1 1 1 => 0 1 0 0 0 0 1 0 1 0 1 0 1 1 1 0 0 0 0 0 0 1 0 0 0 1 1 1 0 1 1 0 2 => 2 3 2 3 3 3 3 3 2 2 3 2 2 2 2 2 3 3 3 3 3 3 2 2 3 2 3 3 3 3 3 3 3 => 3 2 2 3 3 3 2 2 2 3 3 2 2 2 2 3 3 2 2 2 2 3 2 3 2 2 2 2 2 3 3 3 4 => 5 4 4 4 4 5 4 5 4 5 5 4 4 5 4 4 4 4 4 4 4 5 5 4 5 4 5 4 5 5 5 5 5 => 5 5 5 5 5 4 5 5 5 5 4 4 4 5 4 4 4 4 5 5 4 4 4 4 4 5 4 4 4 4 4 5 6 => 7 7 7 7 7 6 6 6 7 6 6 6 7 7 7 6 6 6 6 7 7 6 6 7 7 7 6 7 6 6 7 7 7 => 7 7 7 6 7 7 7 7 6 6 7 7 7 6 7 7 7 7 6 7 7 6 6 6 6 7 7 6 6 7 6 7 25 . 2

  57. Quantum SWAP gate Quantum SWAP gate The quantum SWAP gate swaps the qubits of the 2-qubit register: . Diagram of a SWAP gate 26 . 1

  58. In [16]: def SWAPgate(x,param): # Create a quregister with 2 qubits, value x = 0 qureg = createQuregister(2,x) # Apply the Swap gate SWAP # which is equivalent to: # QG.MatrixGate([ # [1, 0, 0, 0] , # [0, 0, 1, 0] , # [0, 1, 0, 0] , # [0, 0, 0, 1] ]) | qureg QG.Swap | (qureg[0],qureg[1]) # Measure the quregister result = measureQuregister(qureg) return result quregisterExperiment(16,2,SWAPgate,formatIn=":02b",formatOut=":02b") Input quregister => Output quregister for 16 experiments 00 => 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 => 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 => 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 11 => 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 26 . 2

  59. Quantum square-root of SWAP gate Quantum square-root of SWAP gate The square root of the SWAP gate verifies . Any quantum gate on quantum registers can be expressed as the combination of Hadamar gates , phase-shift gates and square root of SWAP gates . Diagram of a square root of SWAP gate 26 . 3

  60. In [17]: def rootSWAPgate(x,param): # Create a quregister with 2 qubits, value x qureg = createQuregister(2,x) # Apply the root of the SWAP gate # which is equivalent to: # rootswap = QG.MatrixGate([ # [1, 0 , 0 , 0] , # [0, (1+1j)/2, (1-1j)/2, 0] , # [0, (1-1j)/2, (1+1j)/2, 0] , # [0, 0 , 0 , 1] ]) | qureg QG.SqrtSwap | (qureg[0],qureg[1]) # Measure the quregister result = measureQuregister(qureg) return result quregisterExperiment(32,2,rootSWAPgate) Input quregister => Output quregister for 32 experiments 0 => 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 => 1 2 2 2 2 1 1 1 1 1 1 2 2 2 1 2 2 1 1 2 1 1 2 1 1 1 1 1 2 1 2 1 2 => 2 1 2 1 2 2 2 2 1 1 2 1 2 1 2 2 1 2 2 1 2 1 1 2 1 2 1 1 2 2 2 1 3 => 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 26 . 4

  61. Generic controlled gates Generic controlled gates The quantum controlled gate of any generic quantum gate acts on a -qubit register such as, for any : , . 27 . 1

  62. Diagram of a generic controlled gate 28 . 1

  63. Controlled NOT gate Controlled NOT gate The controlled NOT gate (CNOT, or cX) is the control gate for the NOT gate: , . It realises a XOR operation: . Diagram of a controlled NOT gate 29 . 1

  64. In [18]: def CNOTgate(x,param): # Create a quregister with 2 qubits, value x qureg = createQuregister(2,x) # Apply the controlled NOT gate CNOT # which is equivament to: # QG.MatrixGate([ # [1, 0, 0, 0] , # [0, 1, 0, 0] , # [0, 0, 0, 1] , # [0, 0, 1, 0] ]) | qureg QG.CNOT | (qureg[1],qureg[0]) # Measure the quregister result = measureQuregister(qureg) return result quregisterExperiment(16,2,CNOTgate,formatIn=":02b",formatOut=":02b") Input quregister => Output quregister for 16 experiments 00 => 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 => 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 10 => 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 => 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 29 . 2

  65. No cloning theorem No cloning theorem CNOT gate can "duplicate" or qubits: , . But it cannot duplicate other qubits: . No cloning theorem , , . WZ1982 W. K. Wootters & W. H. Zurek: A single quantum cannot be cloned. Nature, 299:802-803, 1982. http://copilot.caltech.edu/documents/525-299802a0.pdf Proof: which implies , i.e., or . 30 . 1

  66. Toffoli (CCNOT) gate Toffoli (CCNOT) gate The Toffoli (or CCNOT for controlled-controlled NOT) gate acts on a -qubit register: . It realizes the NAND operation: . 30 . 2

  67. Diagram of a Toffoli gate 31 . 1

  68. In [19]: def CCNOTgate(x,param): # Create a quregister with 3 qubits, value x qureg = createQuregister(3,x) # Apply the Toffoli gate CCNOT # which is equivament to: # QG.C(QG.NOT,2) | (qureg[2],qureg[1],qureg[0]) QG.Toffoli | ([qureg[2],qureg[1]],qureg[0]) # Measure the quregister result = measureQuregister(qureg) return result quregisterExperiment(16,3,CCNOTgate,formatIn=":03b",formatOut=":03b") Input quregister => Output quregister for 16 experiments 000 => 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 001 => 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 010 => 010 010 010 010 010 010 010 010 010 010 010 010 010 010 010 010 011 => 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 100 => 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 101 => 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 110 => 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 => 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 31 . 2

  69. Classical boolean gate Classical boolean gate OR and AND cannot be realized with a 2-qubit gate. . . 31 . 3

  70. The NAND gate being a universal gate for classical logic, any classical boolean function can be implemented using Toffoli gates (and SWAP gates for reordering of qubits if required). NOT is : AND is : Simpler AND using the NOT gate: Still another simpler AND: 31 . 4

  71. In [20]: def ANDgate(x,param): # Create an input quregister with 2 qubits, value x quregin = createQuregister(2,x) # Create an output quregister with 1 qubits, value 1 quregout = createQuregister(1,1) # Apply the Toffoli gate CCNOT QG.Toffoli | ([quregin[1],quregin[0]],quregout[0]) # Apply the NOT gates to the last bit QG.NOT | quregout # Measure the quregister result = measureQuregister(quregout) return result quregisterExperiment(32,2,ANDgate,formatIn=":02b") Input quregister => Output quregister for 32 experiments 00 => 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 01 => 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 => 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 11 => 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 31 . 5

  72. OR is : Simpler OR using the NOT gate: 31 . 6

  73. In [21]: def ORgate(x,param): # Create an input quregister with 2 qubits, value x quregin = createQuregister(2,x) # Create an output quregister with 1 qubits, value 1 quregout = createQuregister(1,1) # Apply the NOT gates to each qubit of input quregister QG.All(QG.NOT) | quregin # Apply the Toffoli gate CCNOT QG.Toffoli | ([quregin[1],quregin[0]],quregout[0]) # Measure the quregister result = measureQuregister(quregout) return result quregisterExperiment(32,2,ORgate,formatIn=":02b") Input quregister => Output quregister for 32 experiments 00 => 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 01 => 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 10 => 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 => 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 31 . 7

  74. Diagrams of boolean gates 32 . 1

  75. Fredkin (CSWAP) gate Fredkin (CSWAP) gate The Fredkin gate is the controlled gate of the SWAP gate. , . If then . 32 . 2 Like the Toffoli gate, it is also universal for classical computation.

  76. Diagram of Fredkin gates 32 . 3

  77. In [22]: def CSWAPgate(x,param): # Create a quregister with 3 qubits, value x qureg = createQuregister(3,x) # Apply the Fredkin gate CSWAP QG.C(QG.Swap) | (qureg[2], qureg[1], qureg[0]) # Measure the quregister result = measureQuregister(qureg) return result quregisterExperiment(16,3,CSWAPgate,formatIn=":03b",formatOut=":03b") Input quregister => Output quregister for 16 experiments 000 => 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 001 => 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 010 => 010 010 010 010 010 010 010 010 010 010 010 010 010 010 010 010 011 => 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 100 => 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 101 => 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 => 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 111 => 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 32 . 4

  78. Ising coupling gates Ising coupling gates Ising coupling gates can be implemented natively in some trapped-ion quantum computers. They all have a continuous angular parameter. Ising (XX) coupling gate Ising (XX) coupling gate Ising (YY) coupling gate Ising (YY) coupling gate 32 . 5

  79. Ising (ZZ) coupling gate Ising (ZZ) coupling gate Diagrams of Ising coupling gates 32 . 6

  80. In [23]: def matrixIsing(axis,phi): if axis=="XX": a = np.sqrt(1/2) b = -1j*np.sqrt(1/2) c = -1j*np.exp(1j*phi)*np.sqrt(1/2) d = -1j*np.exp(-1j*phi)*np.sqrt(1/2) m = [[a,0,0,c], [0,a,b,0], [0,b,a,0], [d,0,0,a]] elif axis=="YY": c = np.cos(phi) s = np.sin(phi) m = [[c,0,0,1j*s], [0,c,-1j*s,0], [0,-1j*s,c,0], [1j*s,0,0,c]] else : # case axis == "ZZ" a = np.exp(1j*phi/2) b = np.exp(-1j*phi/2) m = [[a,0,0,0], [0,b,0,0], [0,0,b,0], [0,0,0,a]] return m def IsingGate(x,param): # Create a quregister with 2 qubits, value x qureg = createQuregister(2,x) # Apply the Ising matrix of type axis and angle theta QG.MatrixGate(matrixIsing(axis=param[0],phi=param[1])) | qureg # Measure the quregister result = measureQuregister(qureg) return result param = ["XX",np.pi/4] quregisterExperiment(16,2,IsingGate,param,formatIn=":02b",formatOut=":02b") Input quregister => Output quregister for 16 experiments 00 => 11 11 00 11 00 11 11 00 11 11 00 11 00 11 11 00 01 => 10 10 01 10 10 10 01 01 10 10 10 10 01 01 10 01 10 => 01 10 01 01 10 10 10 01 01 01 10 10 01 01 10 10 11 => 11 00 11 00 11 00 11 11 11 00 11 00 00 11 11 11 32 . 7

Recommend


More recommend