Quantum Computation (Lecture QC-3: Quantum Algorithms) Lu´ ıs Soares Barbosa MFES - Arquitectura e C´ alculo May 2019
Quantum Algorithms The Deutsch-Jozsa Algorithm Quantum Search: Grover A quantum machine Structure of a quantum algorithm 1. State preparation (fix initial setting): typically the qubits in the initial classical state are put into a superposition of many states; 2. Transform, through unitary operators applied to the superposed state; 3. Measure, i.e. projection onto a basis vector associated with a measurement tool.
Quantum Algorithms The Deutsch-Jozsa Algorithm Quantum Search: Grover My first quantum program Is f : 2 − → 2 constant, with a unique evaluation? Oracle | x ⟩ | x ⟩ U f | y ⟩ | y ⊕ f ( x ) ⟩ where ⊕ stands for exclusive disjunction. • The oracle takes input | x , y � to | x , y ⊕ f ( x ) � • for y = 0 the output is | x , f ( x ) �
Quantum Algorithms The Deutsch-Jozsa Algorithm Quantum Search: Grover My first quantum program Is f : 2 − → 2 constant, with a unique evaluation? Oracle • The oracle is a unitary, i.e. reversible gate | x ⟩ | x ⟩ | x ⟩ U f U f | y ⟩ | y ⊕ f ( x ) ⟩ | y ⟩ | x , ( y ⊕ f ( x )) ⊕ f ( x ) � = | x , y ⊕ ( f ( x ) ⊕ f ( x )) � = | x , y ⊕ 0 � = | x , y �
Quantum Algorithms The Deutsch-Jozsa Algorithm Quantum Search: Grover My first quantum program Idea: Avoid double evaluation by superposition | x ⟩ U f | 1 ⟩ �� H � � � The circuit computes: output = | x � | 0 ⊕ f ( x ) � − | 1 ⊕ f ( x ) � √ 2 � | x � | 0 � − | 1 � ⇐ f ( x ) = 0 √ 2 = | x � | 1 � − | 2 � ⇐ f ( x ) = 1 √ 2 = (− 1 ) f ( x ) | x � | 0 � − | 1 � √ 2
Quantum Algorithms The Deutsch-Jozsa Algorithm Quantum Search: Grover My first quantum program Idea: Avoid double evaluation by superposition | 0 ⟩ �� H H � � � U f | 1 ⟩ H ( H ⊗ I ) U f ( H ⊗ H )( | 01 � ) Input in superposition | σ 1 � = | 0 � + | 1 � | 0 � − | 1 � = | 00 � − | 01 � + | 10 � − | 11 � √ √ 2 2 2
Quantum Algorithms The Deutsch-Jozsa Algorithm Quantum Search: Grover My first quantum program � (− 1 ) f ( 0 ) | 0 � + (− 1 ) f ( 1 ) | 1 � � � | 0 � + | 1 � � √ √ | σ 2 � = 2 2 � � � � | 0 � + | 1 � | 0 � − | 1 � (+ 1 ) ⇐ f constant √ √ 2 2 = � � � � | 0 � − | 1 � | 0 � − | 1 � (+ 1 ) ⇐ f not constant √ √ 2 2 | σ 3 � = H | σ 2 � � � | 0 � − | 1 � (+ 1 ) | 0 � ⇐ f constant √ 2 = � � | 0 � − | 1 � (+ 1 ) | 1 � ⇐ f not constant √ 2 To answer the original problem is now enough to measure the first qubit: if it is in state | 0 � , then f is constant.
Quantum Algorithms The Deutsch-Jozsa Algorithm Quantum Search: Grover The Deutsch-Jozsa Algorithm Generalizing Deutsch’s algorithm to functions whose domain is an initial segment n of N , encoded into a binary string (i.e. the set of natural numbers from 0 to 2 n − 1. Assuming f : 2 n − → 2 is either balanced or constant, determine which is the case with a unique evaluation Oracle | x ⟩ | x ⟩ / n / n U f | y ⟩ | f ( x ) ⊕ y ⟩
Quantum Algorithms The Deutsch-Jozsa Algorithm Quantum Search: Grover Using H ⊗ n to put n qubits superposed Computing H ⊗ n � (− 1 ) 0 ∧ 0 (− 1 ) 0 ∧ 1 � 1 H = √ (− 1 ) 1 ∧ 0 (− 1 ) 1 ∧ 1 2 � (− 1 ) 0 ∧ 0 (− 1 ) 0 ∧ 1 � (− 1 ) 0 ∧ 0 (− 1 ) 0 ∧ 1 1 � ⊗ 1 � H ⊗ 2 = √ √ (− 1 ) 1 ∧ 0 (− 1 ) 1 ∧ 1 (− 1 ) 1 ∧ 0 (− 1 ) 1 ∧ 1 2 2
Quantum Algorithms The Deutsch-Jozsa Algorithm Quantum Search: Grover Using H ⊗ n to put n qubits superposed Computing H ⊗ n (− 1 ) 0 ∧ 0 (− 1 ) 0 ∧ 1 (− 1 ) 0 ∧ 0 (− 1 ) 0 ∧ 1 1 � � ⊗ 1 � � H ⊗ 2 = √ √ (− 1 ) 1 ∧ 0 (− 1 ) 1 ∧ 1 (− 1 ) 1 ∧ 0 (− 1 ) 1 ∧ 1 2 2 (− 1 ) � 00 , 00 � (− 1 ) � 00 , 01 � (− 1 ) � 01 , 00 � (− 1 ) � 01 , 01 � (− 1 ) � 00 , 10 � (− 1 ) � 00 , 11 � (− 1 ) � 01 , 10 � (− 1 ) � 01 , 11 � 1 = (− 1 ) � 10 , 00 � (− 1 ) � 10 , 01 � (− 1 ) � 11 , 00 � (− 1 ) � 11 , 01 � 2 (− 1 ) � 10 , 10 � (− 1 ) � 10 , 11 � (− 1 ) � 11 , 10 � (− 1 ) � 11 , 11 � where � x , y � = ( x 0 ∧ y 0 ) ⊕ ( x 1 ∧ y 1 ) ⊕ · · · ⊕ ( x n ∧ y n ) Note that (− 1 ) a ∧ b ⊗ (− 1 ) a ′ ∧ b ′ = (− 1 ) a ∧ a ′ ⊕ b ∧ b ′ = (− 1 ) � aa ′ , bb ′ �
Quantum Algorithms The Deutsch-Jozsa Algorithm Quantum Search: Grover Using H ⊗ n to put n qubits superposed Computing H ⊗ n In general, the value of H ⊗ n at coordinates i , j (row and column numbers as binary strings) is given by 1 H ⊗ n 2 n (− 1 ) � i , j � √ = i , j Applying H ⊗ n to an arbitrary basic state | i � (which is a column vector with 1 in line i and 0 everywhere else), extracts the i -column of H ⊗ n : � 1 H ⊗ n | i � = (− 1 ) � x , i � | x � √ 2 n x ∈ { 0 , 1 } n e.g. 1 1 1 1 1 1 � H ⊗ 2 | 0 � = 1 = 1 = 1 1 − 1 1 − 1 0 1 | x � 1 1 − 1 − 1 0 1 2 2 2 x ∈ { 0 , 1 } n 1 − 1 − 1 1 0 1
Quantum Algorithms The Deutsch-Jozsa Algorithm Quantum Search: Grover First move: U f ( I ⊗ H ) | x , 1 � | x ⟩ �� / n / n � � � U f | 1 ⟩ H ⇑ ⇑ ⇑ | ϕ 0 ⟩ | ϕ 1 ⟩ | ϕ 2 ⟩ (6.65) | ϕ 1 � = | x � | 0 � − | 1 � = | x , 0 � − | x 1 � √ √ 2 2 | ϕ 2 � = | x � | f ( x ) ⊕ 0 � − | f ( x ) ⊕ 1 � = (− 1 ) f ( x ) | x � | 0 � − | 1 � √ √ 2 2
Quantum Algorithms The Deutsch-Jozsa Algorithm Quantum Search: Grover Second move: ( H ⊗ n ⊗ I ) U f ( H ⊗ n ⊗ H ) | 0 , 1 � Put input | x � into a superposition in which all 2 n possible strings have equal probability: H ⊗ n | 0 � . | 0 ⟩ / n / n / n / n H ⊗ n H ⊗ n U f | 1 ⟩ H ⇑ ⇑ ⇑ ⇑ | ϕ 0 ⟩ | ϕ 1 ⟩ | ϕ 2 ⟩ | ϕ 3 ⟩ � x ∈ { 0 , 1 } n | x � | 0 � − | 1 � √ √ | ϕ 1 � = 2 n 2 � x ∈ { 0 , 1 } n (− 1 ) f ( x ) | x � | 0 � − | 1 � | ϕ 2 � = √ √ 2 n 2
Quantum Algorithms The Deutsch-Jozsa Algorithm Quantum Search: Grover Second move: ( H ⊗ n ⊗ I ) U f ( H ⊗ n ⊗ H ) | 0 , 1 � | 0 ⟩ / n / n / n / n H ⊗ n H ⊗ n U f | 1 ⟩ H ⇑ ⇑ ⇑ ⇑ | ϕ 0 ⟩ | ϕ 1 ⟩ | ϕ 2 ⟩ | ϕ 3 ⟩ � x ∈ { 0 , 1 } n (− 1 ) f ( x ) � z ∈ { 0 , 1 } n (− 1 ) � z , x � | z � | 0 � − | 1 � √ √ | ϕ 3 � = 2 n 2 � x , z ∈ { 0 , 1 } n (− 1 ) f ( x ) (− 1 ) � z , x � | z � | 0 � − | 1 � = √ √ 2 n 2 � x , z ∈ { 0 , 1 } n (− 1 ) f ( x ) ⊕� z , x � | z � | 0 � − | 1 � = √ √ 2 n 2
Quantum Algorithms The Deutsch-Jozsa Algorithm Quantum Search: Grover Finally: observe! When do the top qubits of | ϕ 3 � collapse to | 0 � ? Making | z � = | 0 � (and thus � z , x � = 0 for all x ) leads to � x ∈ { 0 , 1 } n (− 1 ) f ( x ) | 0 � | 0 � − | 1 � | ϕ 3 � = √ √ 2 n 2 i.e. the probability of collapsing to | 0 � depends only on f ( x )
Quantum Algorithms The Deutsch-Jozsa Algorithm Quantum Search: Grover Finally: observe! Analyse the top qubits � x ∈ { 0 , 1 } n (− 1 ) | 0 � −( 2 n ) | 0 � f is constant at 1 � = = − | 0 � √ 2 n 2 n � x ∈ { 0 , 1 } n 1 | 0 � ( 2 n ) | 0 � f is constant at 0 � = = | 0 � √ 2 n 2 n x ∈ { 0 , 1 } n (− 1 ) f ( x ) | 0 � � 0 | 0 � f is balanced = = 0 | 0 � � √ 2 n 2 n because half of the x will cancel the other half The top qubits collapse to | 0 � only if f is constant Exponential speed up: f was evaluated once rather than 2 n − 1 times
Quantum Algorithms The Deutsch-Jozsa Algorithm Quantum Search: Grover Search problems
Quantum Algorithms The Deutsch-Jozsa Algorithm Quantum Search: Grover Search problems A more precise formulation Given a function f : 2 n − → 2 such that there exsits a unique binary string x ∗ st � ⇐ x = x ∗ 1 f ( x ) = ⇐ x � = x ∗ 0 determine e . A quadratic speed up • Worst case for a classic algorithm: 2 n evaluations of f √ 2 n evaluations of f • Worst case for Grover’s algorithm:
Quantum Algorithms The Deutsch-Jozsa Algorithm Quantum Search: Grover Grover’s algorithm Oracle U f inverts the phase at | x ∗ � Recall from Deutsch-Josza: | x ⟩ �� / n / n � � � U f | 1 ⟩ H ⇑ ⇑ ⇑ | ϕ 0 ⟩ | ϕ 1 ⟩ | ϕ 2 ⟩ (6.65) � − | x � | 0 � − | 1 � ⇐ x = x ∗ | ϕ 2 � = (− 1 ) f ( x ) | x � | 0 � − | 1 � √ √ 2 = + | x � | 0 � − | 1 � ⇐ x � = x ∗ 2 √ 2
Quantum Algorithms The Deutsch-Jozsa Algorithm Quantum Search: Grover Grover’s algorithm Oracle U f inverts the phase at | x ∗ � Thus, providing as input a balanced superposition of all possible states, via H ⊗ n | 0 � , the oracle is able to detect the solution and shift its phase: � However, the probability of collapsing to | x ∗ � is equal to the one of collapsing to any other basic state becase 1 1 2 n | 2 = | − 2 n | 2 | − √ √
Recommend
More recommend