400 likes | 665 Views
Lecture 1: Elementary quantum algorithms. Dominic Berry Macquarie University. 1982. Quantum simulator. All classical computers work in fundamentally the same way.
E N D
Lecture 1: Elementary quantum algorithms Dominic Berry Macquarie University
1982 Quantum simulator • All classical computers work in fundamentally the same way. • Quantum systems are fundamentally different. The size of the problem goes up exponentially in the size of the system, making them hard to simulate. • In 1982 this led Feynman to propose quantum computers. A quantum system should be able to efficiently simulate another quantum system. Richard Feynman • Efficiently means that the resources used (time and size of the system) should scale at most polynomially in the size of the system to be simulated. • Polynomially means as , , , etc.
1985 Universal quantum computer • A classical computer uses bits, e.g. • Quantum computers replace this with a quantum state • Each digit is a two-level quantum system – a qubit. David Deutsch • Quantum computers can be in superpositions of these states • Represent the state as a vector:
Universal quantum computer • Operations on the state can be represented as matrices: • The allowed operations on this state are unitary matrices. These satisfy • The indicates the Hermitianconjugate – the transpose and complex conjugate of the matrix. • Any allowed operation is reversible. Using on will restore the state . • A special case is permutation matrices – a permutation matrix only changes one computational basis state to another.
Examples of permutations • The NOT operation, also called an , acts on a single qubit It takes to , and vice versa. • The controlled NOT acts on two qubits. It performs an on the target qubit if the control qubit is in the state . Otherwise it does nothing. • The Toffoli gate is a NOT controlled by two qubits. It performs an only if both controls are in the state .
Turning classical into quantum • The NAND gate is universal for classical circuits and acts as below. • We can perform the same operation using a Toffoli gate. • We can convert any classical algorithm into a quantum algorithm, replacing the NAND gates with Toffolis, and keeping the extra qubits.
Turning classical into quantum • Any function we could calculate on a classical computer we could also compute on a quantum computer, with the addition of some extra “garbage” registers. • This can be turned into a computation that does this: • Method: • Add an ancilla, and perform the program as above to give . • Copy the output of the function into the extra ancilla, to give . • Invert the program above, giving . • For ancillas that are not initially zeroed, we can just perform the XOR.
Part of the story: Superposition • Now what if we start the state in a superposition? • For qubits, we have evaluated an exponential number of different values of the function. • But if we measure it, we only ever find one value of the function!
The other part: Interference • We can’t just calculate many values of a function, we need some way to interfere them to obtain some global property of the function. • We need non-permutation gates: The Hadamard gatehas a matrix representation • Just measuring Schrödinger’s cat would never show it in a superposition. • If we could do a Hadamard on Schrödinger’s cat, we would turn • to , and • to showing we have superposition.
The other part: Interference • We can’t just calculate many values of a function, we need some way to interfere them to obtain some global property of the function. • Universal sets of gates: • The Hadamard gate together with the Toffoli gate is universal for real unitaries. • The or gate together with the Hadamard and CNOT is universal.
1985 The Deutsch algorithm • Problem: Given a function mapping bits to bits, determine if it is one-to-one [i.e. ]. • Classically we need to evaluate both and . • Quantum algorithm: • Start with • Perform a Hadamard on both qubits to give • Apply the gate mapping to give • Apply Hadamard on qubit 2 to give David Deutsch
1985 The Deutsch algorithm • Start with • Perform a Hadamard on both qubits to give • Apply the gate mapping to give • Apply Hadamard on qubit 2 to give • Apply Hadamard on qubit 1 to give • Rearranging gives David Deutsch If then we only get this part qubit 1 is in state . If then we only get this part qubit 1 is in state .
1985 The Deutsch algorithm • Problem: Given a function mapping bit to bit , determine if it is either constant or balanced. • Classically we need to evaluate both and . • Deutsch quantum algorithm gives result with one function evaluation. • Quantum algorithm has two crucial steps: • Calculate the function on both input values simultaneously. • Interfere the result. David Deutsch
1985 The Deutsch algorithm • Problem: Given a function mapping bit to bit , determine if it is either constant or balanced. • Classically we need to evaluate both and . • Deutsch quantum algorithm gives result with one function evaluation. David Deutsch Calculate the function on both input values simultaneously. Interfere the result. measurement
1992 The Deutsch-Jozsa algorithm • Problem: Given a function mapping bits to bit , determine if it is either constant or balanced. There is a promise that it is either. • Classically we need to evaluate values of . • Deutsch-Jozsa quantum algorithm gives result with one function evaluation. David Deutsch measurement Richard Jozsa
Phase oracles • We have previously assumed that the unitary for the function acts as • In both cases we have needed to turn this into a phase in order to make the algorithm work, i.e. • Instead we can just take the oracle to have this form:
1992 The Deutsch-Jozsa algorithm • Deutsch-Jozsa algorithm: start with • The function evaluation yields • Hadamards give • The probability of measuring is • Deutsch algorithm: start with • The function evaluation yields • A Hadamard gives • The probability of measuring is
1993 Bernstein, Vazirani Fourier sampling • Problem: Given a function mapping bit to bit such that , determine . • The function evaluation yields • Hadamards give • The probability of measuring is
1996 Grover’s search algorithm • Problem: Given a function mapping bits to bit , determine the value of such that . We have a promise that the value is unique. • Classically we need to evaluate values, . Lov Grover • Grover’s algorithm enables a search with queries. • Quantum algorithm has two crucial steps: • Calculate the function on all values simultaneously. • Reflect about the equal superposition state. • These steps are repeated times.
1996 Grover’s search algorithm • We start in the state • We repeat the following times: • Apply the function calculation . • Apply the reflection operation . • The system will be in the state such that . • But how do we perform ? Lov Grover
1996 Grover’s search algorithm • But how do we perform ? • First, invert the operation that prepares - just Hadamards on all qubits. • Then, reflect about ; i.e. apply . • Lastly, repeat the operation that prepares . Lov Grover
1996 Grover’s search algorithm • What does do? • Each coefficient is reflected about the mean Lov Grover
1996 Grover’s search algorithm • Example: Take , with solution . • We start in the state • Apply the function calculation , giving • The mean is Lov Grover
1996 Grover’s search algorithm • Example: Take , with solution . • We start in the state • Apply the function calculation , giving • The mean is • Therefore, when we apply the reflection operation , we get Lov Grover
1996 Grover’s search algorithm • Example: Take , with solution . • Reflecting target… • The mean is . Lov Grover
1996 Grover’s search algorithm • Example: Take , with solution . • Reflecting target… • The mean is . • Reflecting about mean… • Reflecting target… • The mean is . Lov Grover
1996 Grover’s search algorithm • Example: Take , with solution . • Reflecting target… • The mean is . • Reflecting about mean… • Reflecting target… • The mean is . • Reflecting about mean… Lov Grover Solution with high probability.
1996 Grover’s search algorithm • Another way of looking at it: Rotations • Define the ket perpendicular to . • Then with . • The operation reflects and leaves all orthogonal states unchanged. • The action of on is Lov Grover
1996 Grover’s search algorithm • Another way of looking at it: Rotations • The action of on is • The action of on is • Now use • This gives Lov Grover
1996 Grover’s search algorithm • Another way of looking at it: Rotations • The action of on is • The action of on is • The action of on is • Now use • This gives Lov Grover
1996 Grover’s search algorithm • Another way of looking at it: Rotations • Consider a state written as • The action of on is • Then applying gives Lov Grover
1996 Grover’s search algorithm • Another way of looking at it: Rotations • The Grover iteration gives Lov Grover
1996 Grover’s search algorithm • Another way of looking at it: Rotations • The Grover iteration gives Lov Grover
1996 Grover’s search algorithm • Another way of looking at it: Rotations • The Grover iteration gives Lov Grover
1996 Grover’s search algorithm • Another way of looking at it: Rotations • The Grover iteration gives Lov Grover
1996 Grover’s search algorithm • Another way of looking at it: Rotations • The Grover iteration gives Lov Grover
1996 Grover’s search algorithm • Another way of looking at it: Rotations • The Grover iteration gives Lov Grover
1996 Grover’s search algorithm • Another way of looking at it: Rotations • In general • For solution we want Lov Grover For
1996 Grover’s search algorithm • What about multiple targets? • In general we have values of such that . • Let us define where are the values of such that . • Define a modified • Then with . • The analysis is the same, except with the modified value of . Lov Grover Define projector and reflector