Learning Notes
Home
Home
  • Guide
    • Shortkeys
    • Commands
  • Cpp
    • Basic
    • Scope, Duration, and Linkage
    • Pointers(1)
    • Pointers(2)
  • Rust Learning
    • 1.Number Types
    • 2.Ownership
    • 3.Struct
    • 4.Enum
    • 5.Package-management
    • 6.Vector
    • 7.Error handle
    • 8.Trait 泛型
    • 9.Life time
    • 10.Test
    • 11.Minigrep
    • 12.Closure 闭包
    • 13.Smart pointer 智能指针
    • 14.Fearless concurrency 无畏并发
  • Quantum Computing
    • Basic computing and quantum computing Theory
    • Teleportation
    • QKD and QFT
    • QFE and Shor's algorithm
    • QAOA
    • Quantum algorithms
    • Week 11
  • Statical Machine Learning
    • Bayesian Linear Regression
    • Linear regression and logistic regresion
    • Bais
    • SVM, Kernel Methods
    • Precepction and Artificial Neural Network
    • Cross validation, experts learning, MAB
    • Bayesian inference
    • GMM-EM
    • final
  • Software Project Management
    • Lecture
    • Revision
  • AI-planning
    • Classical planning
    • MDP and reinforcement learning
    • Game theory and final recap

QFE and Shor's Algorithm

Quantum Phase Estimation

There are some special vectors, called eigenvectors, where applying the XXX gate results in the exact same vector, multiplied by a by a number called an eigenvector. For example, ∣+⟩\ket{+}∣+⟩ is an eigenvector of the XXX gate.

X∣+⟩=(0110)(1212)=(1212)=∣+⟩ X\ket{+} = \begin{pmatrix} 0 & 1 \\1 &0 \end{pmatrix} \begin{pmatrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{pmatrix} = \begin{pmatrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{pmatrix} = \ket{+} X∣+⟩=(01​10​)(2​1​2​1​​)=(2​1​2​1​​)=∣+⟩

The goal of phase estiamtion is:

Given a unitary matrix UUU and an eigenvector ∣ψ⟩\ket{\psi}∣ψ⟩, find ϕ\phiϕ such that U∣ψ⟩=eiϕ∣ψ⟩U\ket{\psi} = e^{i\phi}\ket{\psi}U∣ψ⟩=eiϕ∣ψ⟩

Represnting the phase
From binary number to decimal number:

a12+a24+⋯+an2n=0.a1a2…an \frac{a_1}{2} + \frac{a_2}{4} + \dots + \frac{a_n}{2^n} = 0.a_1a_2\dots a_n 2a1​​+4a2​​+⋯+2nan​​=0.a1​a2​…an​

Shor's algorithm

Period Finding periodic function

f(x)=axmodN f(x) = a^x mod N f(x)=axmodN

where a and N are positve integers, a is less than N, and they have no common factors. The period, or order(rrr), is the Smallest (non zero) integer such that:

armodN=1 a^r mod N = 1 armodN=1

Shor's solution was to use quantum phase estimation on the unitary operator:

U∣y⟩≡∣ay mod N⟩ U|y \rangle \equiv |ay \ mod \ N \rangle U∣y⟩≡∣ay mod N⟩

Shor's Algorithm in quantum circuitalt text

Measurement outcome

  • Upper register m: outputs binary number to find r

  • Lower register: n: outputs outcome of fa,Nf_{a,N}fa,N​

m: outcome M: number of qubits in upper register

kr=m2M \frac{k}{r} = \frac{m}{2^M} rk​=2Mm​

Quantum states during the circuit

∣ψ0⟩=∣0m,0n⟩ |\psi_0 \rangle = |0_m , 0_n \rangle ∣ψ0​⟩=∣0m​,0n​⟩

∣ψ1⟩=∑x∈{0,1}m∣x,0n⟩2m | \psi_1 \rangle = \frac{\sum_{x \in \{0,1\}^m} |x, 0_n \rangle}{\sqrt{2^m}} ∣ψ1​⟩=2m​∑x∈{0,1}m​∣x,0n​⟩​

∣ψ2⟩=∑x∈{0,1}m∣x,axMod N⟩2m |\psi_2 \rangle = \frac{\sum_{x \in \{0,1\}^{m}} | x, a^x \text{Mod N} \rangle}{\sqrt{2^m}} ∣ψ2​⟩=2m​∑x∈{0,1}m​∣x,axMod N⟩​

·

∣ψ3⟩=∑j=02m/r−1∣t0+jr,axˉ Mod N⟩⌊2mr⌋ |\psi_3\rangle = \frac{\sum_{j=0}^{2^m/r - 1} |t_0 + jr, a^{\bar{x}} \, \text{Mod} \, N \rangle}{\left\lfloor \frac{2^m}{r} \right\rfloor} ∣ψ3​⟩=⌊r2m​⌋∑j=02m/r−1​∣t0​+jr,axˉModN⟩​

Example For N = 15, we will have n = 4 and m = 8. For a = 13, the state ∣ψ2⟩|\psi2\rangle∣ψ2⟩ will be

∣0,1⟩+∣1,13⟩+∣2,4⟩+∣3,7⟩+∣4,1⟩+⋯+∣254,4⟩+∣255,7⟩256 \frac{|0, 1\rangle + |1, 13\rangle + |2, 4\rangle + |3, 7\rangle + |4, 1\rangle + \dots + |254, 4\rangle + |255, 7\rangle}{\sqrt{256}} 256​∣0,1⟩+∣1,13⟩+∣2,4⟩+∣3,7⟩+∣4,1⟩+⋯+∣254,4⟩+∣255,7⟩​

After measurement of the bottom qubits, 7 is found

∣3,7⟩+∣7,7⟩+∣11,7⟩+∣15,7⟩+⋯+∣251,7⟩+∣255,7⟩[2564]  \frac{|3, 7\rangle + |7, 7\rangle + |11, 7\rangle + |15, 7\rangle + \dots + |251, 7\rangle + |255, 7\rangle}{\left[ \frac{256}{4} \right]} \ [4256​]∣3,7⟩+∣7,7⟩+∣11,7⟩+∣15,7⟩+⋯+∣251,7⟩+∣255,7⟩​ 

Last Updated:
Contributors: pingzhihe
Prev
QKD and QFT
Next
QAOA