Quantum Fourier Transformation and Phase Estimation

Let's use Yao first

using Yao

Quantum Fourier Transformation

The Quantum Fourier Transformation (QFT) circuit is to repeat two kinds of blocks repeatly:

qft-circuit

The basic building block control phase shift gate is defined as

\[R(k)=\begin{bmatrix} 1 & 0\\ 0 & \exp\left(\frac{2\pi i}{2^k}\right) \end{bmatrix}\]

Let's define block A and block B, block A is actually a control block.

A(i, j) = control(i, j=>shift(2π/(1<<(i-j+1))))
A (generic function with 1 method)

Once you construct the blockl you can inspect its matrix using mat function. Let's construct the circuit in dash box A, and see the matrix of $R_4$ gate.

R4 = A(4, 1)
(n -> control(n, 4, 1 => shift(0.39269908169872414)))

If you have read about preparing GHZ state, you probably know that in Yao, we could just leave the number of qubits, and it will be evaluated when possible.

R4(5)
nqubits: 5
control(4)
└─ (1,) shift(0.39269908169872414)

its matrix will be

mat(R4(5))
32×32 Diagonal{ComplexF64, Vector{ComplexF64}}:
 1.0+0.0im      ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅      1.0+0.0im      ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅      1.0+0.0im      ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅      1.0+0.0im      ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅      1.0+0.0im      ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅      1.0+0.0im      ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅      1.0+0.0im      ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅      1.0+0.0im      ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅      1.0+0.0im          ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅      0.92388+0.382683im      ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅           1.0+0.0im          ⋅               ⋅              ⋅               ⋅              ⋅               ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅      0.92388+0.382683im      ⋅              ⋅               ⋅              ⋅               ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅           1.0+0.0im          ⋅               ⋅              ⋅               ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅      0.92388+0.382683im      ⋅              ⋅               ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅           1.0+0.0im          ⋅               ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅      0.92388+0.382683im      ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅           1.0+0.0im      ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅      1.0+0.0im      ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅          ⋅      1.0+0.0im      ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅          ⋅          ⋅      1.0+0.0im      ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅          ⋅          ⋅          ⋅      1.0+0.0im      ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅          ⋅          ⋅          ⋅          ⋅      1.0+0.0im      ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅          ⋅          ⋅          ⋅          ⋅          ⋅      1.0+0.0im      ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅      1.0+0.0im      ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅      1.0+0.0im          ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅      0.92388+0.382683im      ⋅              ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅           1.0+0.0im          ⋅               ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅      0.92388+0.382683im      ⋅              ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅           1.0+0.0im          ⋅               ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅      0.92388+0.382683im      ⋅              ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅           1.0+0.0im          ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅          ⋅              ⋅               ⋅              ⋅               ⋅              ⋅               ⋅      0.92388+0.382683im

Then we repeat this control block over and over on different qubits, and put a Hadamard gate to ith qubit to construct i-th B block.

B(n, k) = chain(n, j==k ? put(k=>H) : A(j, k) for j in k:n)
B (generic function with 1 method)

We need to input the total number of qubits n here because we have to iterate through from k-th location to the last.

Now, let's construct the circuit by chaining all the B blocks together

qft(n) = chain(B(n, k) for k in 1:n)
qft(4)
nqubits: 4
chain
├─ chain
│  ├─ put on (1)
│  │  └─ H
│  ├─ control(2)
│  │  └─ (1,) shift(1.5707963267948966)
│  ├─ control(3)
│  │  └─ (1,) shift(0.7853981633974483)
│  └─ control(4)
│     └─ (1,) shift(0.39269908169872414)
├─ chain
│  ├─ put on (2)
│  │  └─ H
│  ├─ control(3)
│  │  └─ (2,) shift(1.5707963267948966)
│  └─ control(4)
│     └─ (2,) shift(0.7853981633974483)
├─ chain
│  ├─ put on (3)
│  │  └─ H
│  └─ control(4)
│     └─ (3,) shift(1.5707963267948966)
└─ chain
   └─ put on (4)
      └─ H

Wrap QFT to an external block

In most cases, functions are enough to wrap quantum circuits, like A and B we defined above, but sometimes, we need to dispatch specialized methods on certain kinds of quantum circuit, or we want to define an external block to export, thus, it's useful to be able to wrap circuit to custom blocks.

First, we define a new type as subtype of PrimitiveBlock since we are not going to use the subblocks of QFT, if you need to use its subblocks, it'd be better to define it under CompositeBlock.

struct QFT <: PrimitiveBlock{2}
    n::Int
end

YaoBlocks.nqudits(q::QFT) = q.n

Now, let's define its circuit

circuit(q::QFT) = qft(q.n)
circuit (generic function with 1 method)

And forward mat to its circuit's matrix

YaoBlocks.mat(::Type{T}, x::QFT) where T = mat(T, circuit(x))

You may notice, it is a little ugly to print QFT at the moment, this is because we print the type summary by default, you can define your own printing by overloading print_block

YaoBlocks.print_block(io::IO, x::QFT) = print(io, "QFT($(x.n))")

Since it is possible to use FFT to simulate the results of QFT (like cheating), we could define our custom apply! method:

using FFTW, LinearAlgebra

function YaoBlocks.apply!(r::ArrayReg, x::QFT)
    α = sqrt(length(statevec(r)))
    invorder!(r)
    lmul!(α, ifft!(statevec(r)))
    return r
end

Now let's check if our apply! method is correct:

r = rand_state(5)
r1 = r |> copy |> QFT(5)
r2 = r |> copy |> circuit(QFT(5))
r1 ≈ r2
true

We can get iQFT (inverse QFT) directly by calling adjoint

QFT(5)'
 [†]QFT(5)

QFT and iQFT are different from FFT and IFFT in three ways,

  1. they are different by a factor of $\sqrt{2^n}$ with $n$ the number of qubits.
  2. the bit numbering will exchange after applying QFT or iQFT.
  3. due to the convention, QFT is more related to IFFT rather than FFT.

Phase Estimation

Since we have QFT and iQFT blocks we can then use them to realize phase estimation circuit, what we want to realize is the following circuit:

phase estimation

First we call Hadamard gates repeatly on first n qubits.

Hadamards(n) = repeat(H, 1:n)
Hadamards (generic function with 1 method)

Then in dashed box B, we have controlled unitaries:

ControlU(n, m, U) = chain(n+m, control(k, n+1:n+m=>matblock(U^(2^(k-1)))) for k in 1:n)
ControlU (generic function with 1 method)

each of them is a U of power $2^{(k-1)}$.

Since we will only apply the qft and Hadamard on first n qubits, we could use Subroutine, which creates a context of a sub-scope of the qubits.

PE(n, m, U) =
    chain(n+m, # total number of the qubits
        subroutine(Hadamards(n), 1:n), # apply H in local scope
        ControlU(n, m, U),
        subroutine(QFT(n)', 1:n))
PE (generic function with 1 method)

we use the first n qubits as the output space to store phase $ϕ$, and the other m qubits as the input state which corresponds to an eigenvector of oracle matrix U.

The subroutine here uses focus! and relax! to manage a local scope of quantum circuit, and only activate the first n qubits while applying the block inside the subroutine context, and the scope will be relax!ed back, after the context. This is equivalent to manually focus! then relax!

fullly activated

r = rand_state(5)
ArrayReg{2, ComplexF64, Array...}
    active qubits: 5/5
    nlevel: 2

first 3 qubits activated

focus!(r, 1:3)
ArrayReg{2, ComplexF64, Array...}
    active qubits: 3/5
    nlevel: 2

relax back to the original

relax!(r, 1:3)
ArrayReg{2, ComplexF64, Array...}
    active qubits: 5/5
    nlevel: 2

In this way, we will be able to apply small operator directly on the subset of the qubits.

Details about the algorithm can be found here: Quantum Phase Estimation Algorithm

Now let's check the results of our phase estimation.

First we need to set up a unitary with known phase, we set the phase to be 0.75, which is 0.75 * 2^3 == 6 == 0b110 .

N, M = 3, 5
P = eigen(rand_unitary(1<<M)).vectors
θ = Int(0b110) / 1<<N
phases = rand(1<<M)
phases[0b010+1] = θ
U = P * Diagonal(exp.(2π * im * phases)) * P'
32×32 Matrix{ComplexF64}:
  0.0903318-0.14714im       0.0631262+0.164658im    -0.00568542+0.0464062im     0.114847+0.0936372im      0.181865+0.127168im    -0.0190904-0.0245234im    -0.121137+0.148396im      0.0554998-0.0216036im   -0.0833635+0.195684im      -0.307166-0.0500334im      0.0609948-0.00852595im    0.103225-0.0217896im     0.0129843+0.0243604im    -0.0420545+0.173586im     -0.125507-0.0338585im    -0.0175508+0.00439699im   -0.0192283+0.141985im     -0.348563+0.120335im     0.0328553+0.0920726im   0.0126801+0.138228im    -0.0653585+0.044492im      -0.040737-0.0411012im     -0.214259+0.0202193im   -0.0832835-0.10323im       0.0704349-0.0915027im    0.0937669+0.056519im     -0.304423+0.0841963im      0.0977283-0.000603698im   0.0671895-0.068602im     -0.0583959+0.0348021im      0.325113-0.119773im      0.0339379-0.298456im
 -0.0402245+0.182482im       0.110946-0.171886im     -0.0271052-0.127273im     0.0936144-0.113927im     -0.0161897-0.0198719im     0.301457+0.0298464im  -0.00765368+0.057847im    -0.00860476-0.0530888im   -0.0332807+0.220423im       0.311914+0.0808082im      -0.147554+0.0909586im    -0.086355+0.178146im     -0.0153499+0.136526im      -0.266653+0.00959066im   0.0501668+0.055408im      0.0146683-0.230863im       0.025605+0.0312583im     0.156888-0.11456im      0.0871291-0.025627im   -0.0271242-0.056752im     0.0663682-0.127047im      -0.175847-0.11966im       -0.200174+0.0981227im     0.182026-0.133776im      0.0599426-0.226221im     -0.010323-0.0925362im    -0.184148+0.0283339im     -0.0444845+0.0842409im    -0.0654568-0.0919709im     0.0539714+0.132098im       0.174597+0.0303746im     -0.116795-0.102165im
  -0.108758-0.0720099im    -0.0720893-0.0397086im      0.217068-0.108481im      0.112785+0.0249264im    -0.0702258-0.0150883im   -0.0154049+0.129204im    -0.0347007-0.229393im      -0.118923+0.087343im      0.143033-0.151399im      0.0632417-0.0393831im      0.0968883-0.0306578im    0.0328472+0.00518633im    -0.109924+0.300497im       0.119088+0.0299438im     0.151254-0.0638659im     -0.104696-0.270514im       0.032138+0.0298264im   -0.0508265+0.00247777im   -0.100086+0.118097im     0.153287+0.0992929im    -0.167609+0.154776im       0.026432-0.119973im    -0.00357037+0.0551292im      0.15564+0.10087im       -0.132655-0.129003im    -0.0669887-0.150939im     -0.112503+0.146895im        0.129988-0.283877im      0.0328038+0.342656im      -0.018786+0.0181459im     0.0460089+0.0636926im      0.144656-0.107038im
 -0.0824601+0.0501899im     -0.182635+0.1053im       -0.0668787+0.0312879im      0.24004-0.218726im    -0.00763711+0.0839413im    -0.314983-0.0579807im   -0.0633195-0.116094im      0.0352403-0.110169im    -0.0615891-0.104409im      0.0827268+0.119485im      -0.0246323+0.17663im      0.0453519-0.080668im      -0.080697+0.215101im      0.0345084+0.184743im     -0.146841-0.121077im       0.103063-0.0807234im     0.0381689+0.165709im    -0.0664619-0.090109im     0.0759245-0.137231im    0.0366314+0.127604im    -0.0954276-0.213644im      0.0859885+0.0125375im     0.0545977+0.0375941im     0.111522+0.138317im     -0.0739294+0.110987im     0.0336794-0.146037im     -0.202587+0.0194632im      -0.283825+0.135263im       0.177938-0.21746im       0.0141909-0.0680168im     -0.135662-0.00264063im   -0.0976622+0.0543102im
 -0.0772569-0.0686212im     0.0277281+0.26561im       0.0299697+0.120294im    -0.0732107+0.072075im       0.143771-0.0774201im    0.0613364-0.0297103im    -0.170021-0.0488378im    0.00770181-0.0454631im   -0.0452087+0.0550583im     0.0295473-0.0391645im      0.0272535-0.153605im      0.167925-0.263832im     -0.0475581-0.235767im      0.0179954+0.086188im      0.178893+0.120096im      0.0107091-0.16197im        0.167257-0.119808im     -0.025068-0.0683054im    -0.132774-0.18824im     -0.336653-0.0876658im    0.0816739+0.0582533im    -0.0328872+0.0397349im      0.145499+0.108179im     0.0938385+0.115568im    -0.00598919-0.183305im     -0.125326-0.154154im    -0.0601683-0.00777924im     -0.238919-0.0172855im      0.120544+0.00163803im     0.196138+0.272852im      0.0334955+0.0153807im     0.0816704-0.0154925im
 -0.0981458+0.0495582im     -0.139297-0.146275im    -0.00152236+0.0524644im   -0.0562673+0.0176349im      0.121111-0.246174im      0.144503-0.101131im    0.00353019+0.0177174im    -0.0905456-0.256225im    -0.0202375-0.0465914im     0.0384497+0.177744im      -0.0632471+0.252357im       0.12085-0.103811im      0.0837706-0.177453im       0.203097-0.197443im     0.0376221-0.0230994im   0.000402811+0.0136153im    -0.0303168+0.0797758im   -0.0678917-0.0390656im     0.166287-0.0779149im  -0.0429053-0.196657im    -0.0670213-0.18059im        0.156123-0.185966im       0.135918-0.245103im     -0.109904-0.0715023im     -0.131519+0.0435169im   -0.0595261-0.0907433im   -0.0861141+0.151503im        0.196125-0.0125613im      0.141797+0.0187338im     0.0219769-0.108288im       0.172172+0.115737im       0.105036-0.211134im
  -0.153068-0.113638im      0.0806181-0.0100107im      -0.08677+0.0541853im    0.0618039+0.0282796im      0.170166-0.0914637im   -0.0749545+0.0398712im     0.271024-0.176651im     -0.0761475+0.250119im     -0.135386-0.0359637im     0.0685184-0.0553162im       0.187247+0.0613842im     0.016193-0.0277697im      0.203407-0.157613im    -0.00571226+0.183108im     0.0527488-0.194065im       0.104558-0.156625im      -0.212179+0.0117316im    0.0530639+0.112189im      0.068513+0.0857127im  -0.0460266-0.0539747im    0.0130974+0.0482153im    -0.0547911+0.00462986im     0.106287-0.234661im      0.222072-0.114103im      -0.161896+0.115381im     0.0124168-0.105782im    -0.0172629-0.208066im      -0.0709312+0.154319im      -0.214613+0.0859073im    -0.0767195+0.0689533im      0.141772-0.168792im      -0.155785-0.0969996im
  0.0630609-0.299539im     -0.0344977+0.0895399im     0.0939954+0.177354im    -0.0875763-0.261043im      -0.113666-0.0181586im     0.195194+0.0611124im   -0.0187584-0.133202im     -0.0737907-0.206565im   -0.00620298-0.103198im     -0.0853313-0.0894133im      0.0039964+0.124756im    -0.0714833+0.198708im     -0.0377335+0.0312651im      -0.15789+0.106779im      0.382851+0.138106im     -0.0925665+0.038498im     -0.0851183+0.018596im      0.176563+0.130966im     0.0740411+0.104687im    0.0369967+0.123964im    0.00338627+0.0427905im     0.0625446+0.201473im      0.0574218-0.23066im     -0.0809296+0.0245381im      0.166918+0.115204im     -0.143472-0.0176309im    -0.112254+0.0616212im     -0.0207836+0.00875113im     0.180842-0.136632im     -0.0456291+0.0996378im   0.000204191-0.0628048im     -0.106327-0.0496527im
 -0.0992678-0.115794im      -0.118439-0.0277526im      0.105714+0.189038im    -0.0540571+0.183668im       0.179859+0.078489im      0.232055+0.127898im     -0.151849-0.0200814im     0.0957255+0.0540031im     0.223789-0.34784im      -0.0200356-0.0334148im    -0.00631449+0.156109im      0.098804-0.106505im      -0.033627+0.00758219im    -0.105685-0.0705187im    -0.182246+0.0716051im     -0.114691-0.187587im      0.0295539-0.189857im      0.112829+0.0491173im    -0.089046+0.0385952im  -0.0197332-0.0100872im   -0.0549754-0.171532im      0.0671025+0.0515632im      -0.28686-0.0111303im    0.0479849-0.00395203im     0.035801+0.0625386im     0.243717+0.0305268im     0.136915+0.0905665im      -0.166415+0.183064im     -0.0121264+0.0330569im     0.0177705-0.180096im       0.137282-0.0752682im     -0.108132+0.0425619im
  0.0879301-0.114258im       0.134021+0.0808892im      0.024341-0.00573132im     0.10121-0.220726im      -0.122183+0.0618038im     0.183676-0.0743293im     0.133381+0.0146664im     -0.180695-0.013827im    -0.0321723-0.104204im      0.0939912-0.251676im     -0.00591517-0.0450413im    0.0385926-0.00424807im    0.0210565-0.154077im       0.273102-0.186136im     -0.120003-0.0147251im      0.111192-0.0905204im     -0.225018-0.144475im     -0.289854-0.00406956im    0.105716+0.163407im   -0.0241547-0.0834976im     0.134583-0.0477535im    -0.0122942+0.0700362im     -0.308102+0.100886im     0.0168889+0.234545im      -0.105801-0.0313604im    0.0587106-0.10599im     -0.0553222+0.0175706im      0.0917848+0.0662175im     0.0984758-0.0453538im     0.0716993+0.0781251im     -0.166297+0.157772im       -0.15576+0.0192102im
  0.0656991+0.224015im     0.00719764-0.135973im       0.173529+0.257056im     0.0674869-0.0472243im     0.0680278+0.143746im     0.0434898-0.265079im      0.104978+0.0543462im     0.0893488+0.0320827im   -0.0506441+0.0639337im      0.105114-0.0597604im      -0.069038-0.0704528im    -0.021519-0.163085im       0.161124-0.0180072im     -0.196861-0.00147078im     0.04585-0.0897727im    -0.0439949-0.0116599im      0.254271+0.0623143im   -0.0357415+0.0390728im   0.00215422+0.0293968im   0.0455237-0.052858im     0.0541298+0.275523im      0.0837448+0.209354im      0.0201125-0.218626im      0.279053+0.161066im        0.11052+0.0736684im     0.255992-0.125344im    -0.0560592+0.0969769im       0.211288-0.0594538im     0.0802259-0.0285976im      0.117771-0.138846im     -0.0758828-0.0296828im     0.0527614-0.00148746im
   0.032673+0.14109im       -0.140184-0.0493751im     0.0422708-0.125326im      -0.12957-0.199311im     -0.0580321-0.18438im     0.00789328-0.0338668im    -0.133189+0.0839969im     -0.126817+0.167976im      0.181775+0.0388288im     -0.351917+0.0670904im      0.0433611+0.145577im     0.0958028-0.245068im      -0.104011-0.00349529im   -0.0292825-0.0148041im   -0.0776451+0.103207im       0.109609+0.00124663im    0.0707516-0.183397im      0.157005-0.186945im     0.0816207+0.139279im     0.158176+0.0122136im     0.052692+0.264639im      -0.138613+0.08757im       0.0185506-0.0495594im   -0.0198606+0.0710796im     -0.137305+0.034167im      0.031746-0.0853262im    -0.253971-0.22149im        0.0222264+0.0503393im    -0.0595786-0.093362im     -0.0355759+0.0239189im       0.16607+0.124441im      -0.109318+0.0896169im
  0.0146157-0.257966im     -0.0165229+0.0368357im      -0.21412-0.169365im     0.0414261+0.0286922im     -0.055765+0.155076im      0.141265-0.199328im    -0.0464712-0.095671im    0.000584604-0.0482757im   -0.0476235-0.0277383im     0.0579867+0.110775im      -0.0161288+0.00583592im  -0.0824342+0.0504375im      0.129254-0.0869459im       0.15041-0.15018im      0.0410767+0.134454im       0.136322+0.116665im       0.337086+0.0455158im    0.0738016+0.106243im     -0.132768+0.0791078im   -0.093773+0.140716im    -0.0490556+0.0823656im     0.0633995-0.0849226im     -0.152231-0.0957179im     0.155171-0.0810838im     -0.214703-0.144752im     -0.102427-0.00631112im   -0.208946-0.115232im      0.00742218+0.0506547im     0.0361209+0.0330428im    -0.0561326-0.229181im      0.0596818-0.191846im      0.0431643+0.313972im
  -0.129125-0.229519im      0.0597098-0.136201im     -0.0532738-0.0560055im   -0.0411417+0.0288494im     0.0699371-0.122297im     -0.152448+0.119098im    -0.0466764+0.131132im     -0.0850019-0.284247im     0.0135939+0.245509im     -0.0338607-0.179505im        0.178629+0.0336835im   -0.0618699-0.214063im       0.134482+0.204376im      -0.175593-0.0292499im      0.12763+0.0255978im    -0.0153592-0.000424047im   0.0592003+0.0667677im    -0.142509-0.116951im      0.105131-0.0531515im    0.021865+0.0764403im      0.26012-0.0876285im    -0.0809928-0.120027im      -0.085827-0.0843888im    0.0388227+0.0736052im   -0.00867109+0.0886685im     0.115336-0.0108642im     0.150378-0.0275137im      0.0200995+0.059986im       0.180744+0.294544im     -0.0119834-0.00658261im    0.0321624+0.0391985im     -0.126773+0.288558im
  0.0532462-0.10912im        0.156834+0.0102113im    -0.0851495-0.0247697im     0.100066+0.0155579im    -0.0223126+0.113217im      0.147812-0.154312im    -0.0449881-0.0396391im     -0.181326+0.0191385im    0.0805479-0.0685237im     -0.135396+0.0756607im      -0.244589-0.0471617im    0.0396501-0.222074im        0.18091+0.213388im     -0.0250222+0.0377323im   -0.0588964-0.0361048im    -0.0126212-0.102765im      0.0117726+0.0954708im     0.126491-0.085574im     -0.293038-0.301022im   -0.0973928+0.0657467im     0.168676-0.0477294im     0.0511808+0.0670298im    -0.0750666+0.00289445im  -0.0871208-0.0815094im    -0.0400838+0.264211im     -0.122855-0.115701im     0.0486305-0.0593869im        0.20987+0.0126984im    -0.0999955+0.0163253im     -0.284742+0.128089im      -0.120149+0.0925116im    -0.0488225-0.1973im
  -0.132567+0.0880353im      -0.11508+0.0439654im     0.0934741-0.0989529im    -0.214085-0.162988im        0.16053+0.133837im       0.02502+0.0698101im     0.168883+0.0883567im      0.129485+0.131158im   0.000882476+0.0507184im      0.213995+0.0359841im     0.00763779-0.0905709im   -0.0639548-0.0743392im    -0.0483664-0.0619425im     0.0758758-0.0775561im     0.143459-0.0965844im     0.0362877-0.109312im      0.0498844-0.0366836im   -0.0647417-0.00465859im   0.0442301-0.190784im    0.0048529+0.232048im   -0.00106125+0.0277475im      0.170424+0.242095im      0.0368976+0.104535im     -0.157165-0.00463005im  -0.00406556-0.191863im    -0.0223165+0.149632im    0.00572278-0.138875im       0.0593482+0.100809im       0.252464+0.105516im      -0.357249-0.13245im         0.13377+0.0829202im     -0.212646-0.109419im
    0.15872+0.0747236im    -0.0652943+0.0431007im    -0.0408725+0.0971156im    0.0311413-0.094635im       0.115663-0.163735im     0.0476251-0.165684im     -0.145281+0.251694im     -0.0886224-0.177447im     -0.165088-0.0831483im    -0.0365503+0.175512im        0.184371-0.184699im     0.0180385+0.199034im    -0.00311949+0.135394im      0.0353097-0.0325838im   -0.0042835-0.213069im     -0.0928961-0.225903im      0.0242841-0.151693im     0.0220976+0.311558im    -0.0112056-0.0701969im   -0.072257+0.0413312im   -0.0261718-0.108508im      0.0110237+0.135268im      -0.012605-0.0912912im   -0.0336244-0.105577im     -0.0545896+0.0230971im     0.125183+0.0645812im    -0.116363-0.161139im      -0.0974136-0.231722im      -0.166145+0.147949im      0.0179098+0.0247782im    -0.0282087+0.22734im      -0.0782198+0.168612im
     0.1174-0.013157im      -0.208638+0.0550226im    0.00146868+0.142184im     0.0331229-0.0198441im     0.0582095+0.23129im     -0.0206299+0.199285im    0.00627371+0.100826im      -0.141864-0.267695im     0.0137663+0.10137im      -0.0745997+0.0219356im       0.185871-0.0573625im   -0.0637688-0.00323354im    0.0963406-0.122933im    -0.00322231-0.246648im     -0.108853-0.111131im      -0.110711-0.132508im      -0.107804+0.073348im      0.263823-0.223665im    -0.0220801+0.0330532im   0.0802884+0.0734984im     0.102437-0.0174705im      0.143854-0.0151415im     0.0637687+0.209925im      0.130642+0.0899345im    -0.0564418-0.0219028im    -0.139809+0.0267511im    -0.018144-0.224848im        0.116206-0.101042im      -0.066791-0.0337883im      0.202225-0.0784466im   -0.00819201-0.287103im     -0.0400419-0.175306im
  0.0640551-0.0237968im      0.190933+0.123102im      -0.138029-0.181904im     -0.204923+0.182187im     -0.0177615-0.109426im      0.117921-0.0689988im    0.0597608+0.0637087im     0.0792656-0.0484091im    0.0877002+0.252429im       -0.13108+0.0147731im       0.106014+0.176681im    -0.0918288+0.0903398im     0.0329007+0.010796im       0.128643-0.0220199im   -0.0512436-0.0749029im      0.138207-0.166556im      0.0556922-0.012749im      0.109049-0.17367im      0.0492033+0.171063im    -0.143956+0.0472901im    -0.359987-0.0178072im      0.071451+0.196683im      0.0231718+0.0800216im     0.213209-0.0226498im      0.125398+0.216921im      0.118766-0.102994im     0.0680726+0.0751027im      -0.102664-0.113895im       0.190133+0.0657907im    -0.0558955-0.0269494im      -0.18297+0.0334337im    -0.0446875-0.138706im
  -0.182446-0.0392069im      0.152928+0.147913im      0.0767508+0.0314595im     0.126699-0.139415im      -0.109191+0.0660877im   7.79386e-5-0.239791im    -0.0977937-0.219321im       0.133436-0.327771im      0.107749+0.129582im     -0.0331926+0.0104686im     -0.0480169-0.176385im      -0.12195-0.080371im      0.0223932-0.0867651im    -0.0561463-0.00182373im    -0.10422-0.03675im        0.116663-0.0222289im     -0.159039-0.141735im     -0.034098-0.109943im    -0.0836843-0.05108im      0.288997-0.252108im      -0.20458-0.0653429im    -0.0994763+0.181525im      0.0581369-0.060605im     0.0265147+0.0240568im     0.0366204-0.0464071im    -0.100092+0.0774354im     0.103529+0.0134557im      -0.064009-0.0751953im     -0.122509+0.111047im      -0.104333-0.127954im       0.293869-0.00210213im   -0.0439235+0.0575105im
  0.0489362+0.16015im        0.016888+0.315238im       0.115006+0.170673im      0.144362+0.0113102im     0.0115954-0.164906im    -0.0625203+0.0326343im     0.101345-0.135811im     -0.0215413-0.0659557im     0.185862+0.00646529im   -0.0225432+0.0854491im      -0.185171+0.172205im       0.12713+0.0515823im     0.0902646+0.0334833im      0.215524-0.181258im      0.226398-0.164993im       -0.14254+0.0812675im      0.045177+0.174469im    -0.0259166-0.057436im     0.0653238+0.137449im    -0.177994+0.0383754im     0.184176+0.0338172im      -0.15188+0.0383617im     -0.046629+0.220209im      0.171332-0.0441268im      0.144899+0.0695607im    0.0715374+0.154698im     0.0190403-0.01482im       -0.0128289+0.00478163im    -0.113324-0.0192163im     -0.205032-0.0136365im      0.197478+0.0184459im     0.0209578+0.196984im
  0.0454719+0.177856im    -0.00355743+0.145142im       0.228127-0.0250235im    0.0128861-0.226339im     -0.0182158+0.132876im     0.0903521-0.169553im      0.190136+0.175591im       0.180246+0.0261941im     0.180292+0.0336719im     -0.136531+0.098098im        0.056249+0.0296745im     0.201441+0.126184im     0.00702447-0.0513808im    0.00687049-0.0144763im    0.0665145+0.194546im       0.132365-0.106624im      -0.033707+0.0379867im   -0.0922249+0.0163364im   -0.0407234-0.0989354im    0.142928+0.195339im   -0.00965451-0.0622434im     0.0793513-0.291111im     -0.0867781-0.167379im      0.131176-0.098438im     -0.0990113+0.168896im    -0.0706912+0.0560011im     0.245547-0.0920982im     -0.0980773+0.0528236im     0.0763558+0.144941im       0.118613+0.243045im    -0.00096286-0.0984779im      0.111156+0.0320385im
 -0.0362008+0.178199im      0.0418107+0.0464844im    -0.0631871-0.176024im      0.187513+0.149079im    -0.00632852+0.157326im   -0.00466224+0.019254im      0.302989+0.101825im       -0.17564-0.0755238im    -0.204228-0.0776965im     -0.128415-0.137471im        0.070278+0.0567189im     0.202283-0.0697237im     -0.214177-0.0166377im     0.0461334+0.0439884im    -0.113164+0.119391im     -0.0160247-0.260935im        0.20976+0.0555915im     0.132999+0.014692im     -0.039634+0.204844im    0.0756004-0.0877976im     0.176339-0.178325im     -0.0248208+0.195714im       0.135987-0.170306im     -0.071816-0.0413408im      0.153136-0.0798366im    -0.192786+0.0711701im    0.0452004+0.165302im       0.0138537-0.0203223im     0.0681114+0.00349214im   -0.0959709-0.0100103im     0.0805541-0.0238779im     0.0148669+0.150563im
   -0.14121+0.00822991im    0.0367843+0.111138im     -0.0385234+0.065204im    -0.0824099-0.1362im       -0.0878853+0.168295im    -0.0536436+0.0543643im     0.179313-0.116482im     -0.0725389-0.0962451im    -0.177061-0.18313im       -0.173384+0.0292653im     -0.0502636-0.0335377im    -0.219443+0.0741181im    -0.0245915-0.0188607im      0.112828+0.0754228im   -0.0619802+0.0662045im     0.0371766-0.0475675im    0.00765983-0.0596843im      0.11614-0.226659im    -0.0386677-0.136771im     -0.16903+0.129292im     0.0317661+0.126733im      -0.150393-0.132145im      0.0843117-0.0271664im   -0.0685601-0.258662im     -0.0961639-0.0622859im     0.473104+0.00791244im   0.0656886+0.154695im        0.123665-0.138744im      0.0869383-0.0251223im      0.177721+0.0239161im        0.1533+0.075275im     -0.0911526+0.0229143im
  0.0424412+0.135586im     -0.0912554+0.123916im      -0.454595-0.00610018im   -0.140024-0.164835im      -0.042962-0.129381im      0.030186-0.140981im     -0.183212-0.0216637im    -0.0979208+0.0560577im    0.0638218-0.0446063im   -0.00376093-0.0548751im     -0.0809508-0.0755608im    0.0609835-0.108248im     -0.0284195-0.117535im      0.0421038+0.0475223im    0.0316622+0.0497192im    -0.0222142-0.049716im      -0.205755+0.0819652im    0.0380343+0.0861567im   -0.0469977+0.0496778im    0.161452+0.237549im      0.139559-0.0872442im   -0.00733442-0.162237im      0.0688137-0.0980949im     0.158453+0.0878938im       0.31719-0.261235im      0.173474-0.0874745im     0.107057+0.0928756im      -0.001326-0.00249982im   -0.0544836+0.14442im      -0.0973684-0.143228im     -0.0735611-0.0984737im     0.0216942-0.113139im
 -0.0614341-0.00281297im   -0.0641926+0.0888035im    -0.0775254-0.0307765im    0.0461082+0.00261436im     0.440062+0.0834084im   -0.0562896-0.0930839im   0.00431977+0.0755374im    -0.0704647+0.0492883im      0.23227-0.0870349im      0.161852-0.107519im        0.076633-0.129368im    -0.0471488+0.0376466im     -0.172036+0.264233im       0.130987-0.177296im     -0.078497+0.00683061im     0.157673+0.371966im      -0.124365+0.00638961im    0.153008-0.0414223im    0.0371697-0.0238447im   -0.056718+0.0298409im   -0.0583394-0.0342767im     -0.129964+0.164616im     -0.0260771-0.160108im     0.0825775-0.114136im       0.159917+0.00345151im   -0.104478-0.169463im    -0.0116278+0.0218922im       0.131915-0.0178489im     0.0684899+0.0164611im      0.163841+0.19468im        0.107004-0.00136372im  -0.00139129+0.021406im
  -0.343504-0.0665425im     -0.165207+0.287092im      -0.142119-0.0586176im    -0.180081-0.0292091im     -0.115661-0.0012125im   0.00998538+0.0160701im     0.139158+0.0385562im      0.038855-0.142021im    0.00709916+0.00886366im    0.0827065-0.000660385im     -0.29833+0.0775517im   -0.0152876-0.044628im     -0.0687049+0.0903056im     -0.140496+0.0106094im    -0.184514-0.0502767im     -0.198474-0.0230145im      0.215798-0.0345897im    -0.185543+0.081731im      0.236532+0.149462im   -0.0432496+0.0657353im   -0.0444421+0.0739644im     0.0616358+0.0974839im     -0.086211-0.0785017im   -0.0849444-0.0186574im     -0.015741+0.0127504im   -0.0746243-0.134525im      0.116561-0.221147im       0.0910388-0.0380255im     -0.263332+0.0663811im      0.157413+0.119985im     -0.0602615-0.0277846im     0.0692425-0.0869704im
 -0.0170058-0.0289708im      0.208529-0.177288im     -0.0990548+0.20455im        -0.1401-0.161649im     -0.0241188-0.0577914im     0.212426+0.103469im     0.0449217+0.0788858im     0.0832894-0.10328im     -0.0170667-0.0691653im      0.256969+0.00497896im      0.108966-0.043089im      0.171095-0.220094im       -0.20076+0.0653087im      0.104755+0.31221im      -0.157672+0.0118852im     0.0524831+0.10743im      -0.0464056+0.0706975im   -0.0131665-0.0629031im   -0.0072431+0.122689im   -0.0622731+0.096963im     0.0463351+0.0400103im     0.0525597-0.0497946im    -0.0477862+0.0805058im     0.117376-0.0543868im    -0.0535538+0.142441im    -0.0791504+0.0910307im    0.0845015-0.149357im    -0.000932889-0.375696im      0.0378193-0.186521im      -0.111739-0.0885952im      0.149826-0.0322964im      0.133048+0.0764523im
 -0.0365718-0.0613238im      0.154338+0.195455im      0.0411968-0.157445im      0.209357+0.029714im     -0.0402064+0.107828im    -0.0919228+0.0254662im    -0.204704+0.218913im      0.0704004+0.189597im      0.209495+0.0368448im      0.188898-0.237821im      -0.0379563+0.0306573im   -0.0499286-0.0947966im      0.117925-0.101652im       0.117467+0.0203764im     0.205448+0.133801im      -0.101437-0.197286im     -0.0422306+0.111986im      0.152503-6.73314e-5im    0.202553-0.0590338im   0.0418548-0.0585026im   -0.0603467-0.105548im       0.107908-0.0543989im      0.061665-0.125347im     -0.219268-0.0623742im    0.00223672+0.067951im       0.18916-0.0724495im   -0.0487904-0.162407im       0.0444738-0.258109im     -0.0749542-0.209206im      0.0582337-0.115833im       0.040115+0.0115175im     0.0319746+0.0968635im
 -0.0839452-0.206354im       0.096575+0.0869756im     0.0326622+0.0768158im   -0.0187764-0.14173im      0.00449744-0.207055im    -0.0123621-0.261304im   -0.00285809-0.00493803im     0.066056+0.166266im     0.0666258+0.0332599im     0.0203449-0.0471595im       0.209754+0.0926406im    -0.140573+0.328804im      -0.107986+0.177966im       0.114271+0.0172514im     -0.23561+0.0343252im     -0.116493-0.129829im       0.196243+0.0305585im    0.0553652-0.0273805im   -0.0749723-0.0708576im  -0.0235226-0.193545im      0.303295+0.00072483im   -0.0354061-0.0592228im       0.12448+0.0213626im    -0.049935+0.188967im      0.0564886-0.0198992im    0.0313434+0.0561589im    0.0745184-0.173594im       0.0785797+0.14527im        0.126374-0.0335624im     0.0109194-0.143633im      0.0986595-0.0495364im      0.185918-0.179335im
  0.0472427-0.0423752im    0.00551406+0.00130039im    0.0296538+0.162853im    -0.0304133-0.091968im     -0.0628273+0.135535im     0.0579353+0.0285541im    0.0172178+0.0654902im     0.0496508+0.122855im    -0.0199043+0.0829338im    -0.0957443-0.0118234im       -0.18837+0.0137034im    0.0922634-0.0581578im    -0.0256975+0.242632im       0.016698-0.0446376im    0.0145313-0.262561im       0.169892-0.111352im      -0.027315-0.310677im    -0.0355607+0.0645903im    0.0290565+0.069435im    -0.176896-0.176348im    -0.0969436-0.00650733im   0.00526032-0.361173im       0.212449+0.0318im       -0.132933-0.0578381im      0.282198-0.0129274im    -0.128843-0.137392im    -0.0517654-0.062234im        0.120244-0.0105844im       0.11909+0.0561507im   -0.00338752-0.115698im     -0.0164063-0.252261im      -0.160788+0.19858im
  0.0384635+0.231595im      0.0858834+0.0990099im     0.0309623+0.0521145im    -0.123661-0.0379083im     0.0318125+0.116805im     0.0199949-0.0824998im  -0.00787545-0.128295im      0.0251151-0.0747898im     0.215159-0.0717315im   -0.00618858+0.015938im         0.21241-0.271473im     -0.154561-0.0440268im      0.136842+0.028966im      -0.173067+0.081426im    -0.0110985-0.0724309im      0.117677+0.0074502im     0.0982503+0.19262im       0.118617+0.0485348im    0.0852872+0.4209im       -0.22279+0.0355275im    0.0572973-0.117191im      0.0783072-0.193071im      0.0231933+0.0402474im    -0.304079+0.105713im      -0.146295+0.0118163im   -0.0614031-0.148725im     0.0131262+0.107438im      -0.0609467+0.138799im     -0.0500314+0.02093im      -0.0363911-0.0421818im     0.0670903+0.177716im     -0.0077448-0.0430376im

and then generate the state $ψ$

psi = P[:, 3]
32-element Vector{ComplexF64}:
  -0.03297873270240273 + 0.09821074640285075im
 0.0003005052371768402 - 0.16336221984513727im
   0.05812722203131894 + 0.01597536113147197im
  0.017805728702801137 + 0.10658056755508558im
   0.10590693255860985 - 0.133489963867813im
  -0.12138386597386475 - 0.06837453690933111im
   0.15323050985234915 - 0.0073307503160286586im
   0.03886678823285514 - 0.0015640861109663153im
   0.10112322900501251 + 0.07207841056439974im
  0.059056305319520754 + 0.1269536851582478im
  -0.06250252674899204 - 0.13318487341624852im
   0.33820890639871753 + 0.0im
  -0.15346002346036458 + 0.02613949309622879im
   0.05470896808632705 + 0.020527214074950034im
  0.009828602148671392 - 0.05518927917801373im
  -0.13702492777490513 + 0.0421959215836im
   0.16906158405111565 - 0.015271410228808527im
  -0.18482238718791816 - 0.09672983297029598im
   0.04021109149057022 - 0.17101050966345782im
   0.09851844032210089 - 0.1683964208159822im
 -9.510297338566343e-5 + 0.16140059471183568im
   -0.2141410105134735 + 0.24287899664193588im
   -0.0828000145174348 + 0.1507758548394305im
  -0.13579430832841832 + 0.0032026866424000044im
   -0.1439438461001357 + 0.004356709784525889im
   0.13231421381303432 - 0.0795948774406159im
   0.14168101480139683 + 0.24790727376317764im
  0.023530865112579707 + 0.21669434074905425im
   -0.0369821420620306 + 0.27579190261020814im
    -0.219112323234328 - 0.003324079285184217im
  -0.16942899403331535 + 0.02132088666556356im
  -0.01928496891263345 - 0.05077004087109588im

In the phase estimation process, we will feed the state to circuit and measure the first n qubits processed by iQFT.

r = join(ArrayReg(psi), zero_state(N))
r |> PE(N, M, U)
ArrayReg{2, ComplexF64, Array...}
    active qubits: 8/8
    nlevel: 2

Since our phase can be represented by 3 qubits precisely, we only need to measure once

results = measure(r, 1:N; nshots=1)
1-element Vector{DitStr{2, 3, Int64}}:
 011 ₍₂₎

Recall that our QFT's bit numbering is reversed, let's reverse it back

using BitBasis
estimated_phase = bfloat(results[]; nbits=N)
0.75

the phase is exactly 0.75!


This page was generated using Literate.jl.