量子搜索算法基础: Quantum Amplititude Amplification
Posted 元之田
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了量子搜索算法基础: Quantum Amplititude Amplification相关的知识,希望对你有一定的参考价值。
1. Introduction
You have likely heard that one of the many advantages a quantum computer has over a classical computer is its superior speed searching databases. Grover’s algorithm demonstrates this capability. This algorithm can speed up an unstructured search problem quadratically, but its uses extend beyond that; it can serve as a general trick or subroutine to obtain quadratic run time improvements for a variety of other algorithms. This is called the amplitude amplification trick.
两步走:1. 反转目标状态的振幅;2. 根据平均值再翻转。
2. Unstructured Search
Suppose you are given a large list of N items. Among these items there is one item with a unique property that we wish to locate; we will call this one the winner w. Think of each item in the list as a box of a particular color. Say all items in the list are gray except the winner w, which is purple.
To find the purple box – the marked item – using classical computation, one would have to check on average N/2 of these boxes, and in the worst case, all N of them. On a quantum computer, however, we can find the marked item in roughly \\sqrtN steps with Grover’s amplitude amplification trick. A quadratic speedup is indeed a substantial time-saver for finding marked items in long lists. Additionally, the algorithm does not use the list’s internal structure, which makes it generic; this is why it immediately provides a quadratic quantum speed-up for many classical problems.
3. Creating an Oracle
For the examples in this textbook, our ‘database’ is comprised of all the possible computational basis states our qubits can be in. For example, if we have 3 qubits, our list is the states |000\\rangle, |001\\rangle, \\dots |111\\rangle (i.e the states |0\\rangle \\rightarrow |7\\rangle).
Grover’s algorithm solves oracles that add a negative phase to the solution states. I.e. for any state ∣ x ⟩ |x\\rangle ∣x⟩ in the computational basis:
U
ω
∣
x
⟩
=
−
∣
x
⟩
if
x
≠
ω
−
∣
x
⟩
if
x
=
ω
U_\\omega|x\\rangle = \\bigg\\ \\beginaligned \\phantom-|x\\rangle \\quad \\textif \\; x \\neq \\omega \\\\ -|x\\rangle \\quad \\textif \\; x = \\omega \\\\ \\endaligned
Uω∣x⟩=−∣x⟩ifx=ω−∣x⟩ifx=ω
This oracle will be a diagonal matrix, where the entry that correspond to the marked item will have a negative phase. For example, if we have three qubits and \\omega = \\text101, our oracle will have the matrix:
U ω = [ 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 − 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 ] ← ω = 101 U_\\omega = \\beginbmatrix 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\\\ 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\\\ 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\\\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\\\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\\\ 0 & 0 & 0 & 0 & 0 & -1 & 0 & 0 \\\\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\\\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\\\ \\endbmatrix \\beginaligned \\\\ \\\\ \\\\ \\\\ \\\\ \\\\ \\leftarrow \\omega = \\text101\\\\ \\\\ \\\\ \\\\ \\endaligned Uω=⎣⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎡100000000100000000100000000100000000100000000−1000000001000000001⎦⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎤←ω=101
What makes Grover’s algorithm so powerful is how easy it is to convert a problem to an oracle of this form. There are many computational problems in which it’s difficult to find a solution, but relatively easy to verify a solution. For example, we can easily verify a solution to a sudoku by checking all the rules are satisfied. For these problems, we can create a function f that takes a proposed solution x, and returns f(x) = 0 if x is not a solution ( x ≠ ω ) (x \\neq \\omega) (x=ω) and f(x) = 1 for a valid solution ( x = ω ) (x = \\omega) (x=ω). Our oracle can then be described as:
U
ω
∣
x
⟩
=
(
−
1
)
f
(
x
)
∣
x
⟩
U_\\omega|x\\rangle = (-1)^f(x)|x\\rangle
Uω∣x⟩=(−1)f(x)∣x⟩
and the oracle’s matrix will be a diagonal matrix of the form:
U ω = [ ( − 1 ) f ( 0 ) 0 ⋯ 0 0 ( − 1 ) f ( 1 ) ⋯ 0 ⋮ 0 ⋱ ⋮ 0 0 ⋯ ( − 1 ) f ( 2 n − 1 ) ] U_\\omega = \\beginbmatrix (-1)^f(0) & 0 & \\cdots & 0 \\\\ 0 & (-1)^f(1) & \\cdots & 0 \\\\ \\vdots & 0 & \\ddots & \\vdots \\\\ 0 & 0 & \\cdots & (-1)^f(2^n-1) \\\\ \\endbmatrix Uω=⎣⎢⎢⎢⎡(−1)f(0)0⋮00(−1)f(1)00⋯⋯⋱⋯00⋮(−1)f(2n−1)⎦⎥⎥⎥⎤
For the next part of this chapter, we aim to teach the core concepts of the algorithm. We will create example oracles where we know \\omega beforehand, and not worry ourselves with whether these oracles are useful or not. At the end of the chapter, we will cover a short example where we create an oracle to solve a problem (sudoku).
4. Amplitude Amplification
So how does the algorithm work? Before looking at the list of items, we have no idea where the marked item is. Therefore, any guess of its location is as good as any other, which can be expressed in terms of a uniform superposition: ∣ s ⟩ = 1 N ∑ x = 0 N − 1 ∣ x ⟩ |s \\rangle = \\frac1\\sqrtN \\sum_x = 0^N -1 | x \\rangle ∣s⟩=N1∑x=0N−1∣x⟩.
If at this point we were to measure in the standard basis ∣ x ⟩ \\ | x \\rangle \\ ∣x⟩, this superposition would collapse, according to the fifth quantum law, to any one of the basis states with the same probability of 1 N = 1 2 n \\frac1N = \\frac12^n N1=2Quantum(量子)攻击系统 – 美国国家安全局“APT-C-40”黑客组织高端网络攻击武器技术分析报告