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.0612051-0.172138im      -0.16932+0.0119995im     -0.0676923+0.171459im      -0.111708+0.0127393im    -0.218416+0.0125846im    0.144089-0.000947209im    0.0279032-0.359442im     -0.0954183+0.127213im       0.209764+0.122239im     -0.140906-0.0935054im   0.000564474+0.0937323im     0.256944+0.0317447im     -0.0440016-0.13799im       -0.149356+0.137367im      0.150106+0.0782227im     0.0394961-0.139233im     -0.225506+0.0370602im      0.151251+0.0213983im     0.0404776-0.126354im      0.0859876-0.106597im    -0.0324191+0.0401988im   -0.0608265-0.138122im      0.0484474+0.0400929im    0.0912404-0.215222im      -0.0868246-0.114372im        0.06589+0.0162437im    0.0187362+0.24799im       -0.0907852-8.91178e-5im    -0.261513-0.0171077im     0.0248188-0.126186im     -0.0644909+0.0455003im     -0.0971616-0.00416105im
    0.103339-0.206527im    -0.0211563-0.0372351im     -0.0419331+0.00588277im   -0.0105794-0.089159im      0.177412-0.11586im     0.0841385+0.0901202im      0.0685834+0.0820328im     -0.173575-0.0340365im   -9.50151e-6-0.202631im     -0.229054-0.0260612im    -0.0793137-0.00102419im   0.0431659-0.152059im       -0.210332-0.127785im      -0.138037-0.0793909im    -0.122161-0.00631256im    0.0642255+0.0847009im     0.105595+0.0974762im    -0.0146248-0.0297573im     0.0524766+0.0516191im     -0.360037-0.232341im      0.113045-0.0767537im    0.0638341-0.0410481im     0.0629036-0.0732868im    -0.118498-0.0428562im      0.0140339-0.0502754im     0.0683428+0.1757im         0.14914+0.0245287im     -0.0114164+0.054119im      0.0959565-0.145655im       0.120156-0.14549im       -0.319333-0.0444769im       0.302383-0.0921467im
    -0.03788-0.0722609im   0.00636896+0.102506im      -0.0220061-0.0406378im    -0.0809112+0.166357im     0.0823982+0.0585367im   -0.121332+0.182646im       0.0120684-0.0495128im     0.0621884+0.268325im      -0.219135+0.141746im     0.0138849+0.00876093im     -0.21547+0.142623im      0.283162-0.13128im         0.107551-0.173567im       0.195327-0.0421303im     0.198515-0.115013im     -0.0203365-0.0149157im    -0.029237-0.169608im      -0.307788+0.029465im      0.0995613+0.0779495im    -0.0386115+0.0213522im   -0.0550486+0.0925356im    -0.138887+0.0882581im      0.143366+0.0258577im     0.144281+0.0941172im       0.064343+0.238099im     -0.0825536+0.164825im      0.113814-0.0111382im     0.00837999+0.0396533im   -0.00616721-0.0728898im     -0.122281+0.103729im      -0.259725+0.0251012im     -0.0263172-0.0106689im
   0.0680586-0.160777im     0.0451797+0.178018im        -0.25529-0.0475816im     -0.151143-0.249953im    -0.0826593+0.0291598im   -0.010402+0.237398im       0.0868527+0.121414im       0.141141-0.0772893im      0.081371+0.0875764im  -0.00812224+0.09838im      -0.0381507-0.0156164im     0.127824+0.0189775im     -0.0393685+0.00626871im    0.0437778+0.0792557im   -0.0534038+0.0932913im     -0.163446-0.14231im     0.00794387+0.0878626im     0.0166422-0.0812912im    -0.0185661-0.065199im     -0.0153489+0.0858455im   -0.0559468+0.183733im    -0.0707935-0.259846im      0.0531731+0.0290087im    -0.274767+0.204544im        0.198145-0.0690284im      0.217005+0.0554884im    0.0130979-0.211485im       -0.238284+0.0599111im    -0.0777729+0.00227819im   -0.0248664+0.239263im       0.115139-0.0770072im      0.0777401+0.118551im
    0.364174+0.138415im     0.0200672+0.153081im        0.171147+0.0612494im    -0.0957645-0.0171943im   -0.0750299-0.263778im     0.193585+0.0902629im     -0.0729834+0.113479im      0.0233906+0.201481im       0.158185+0.152413im     0.0630811-0.196942im       0.198256+0.209895im    -0.0184503+0.041501im       0.0982594+0.161112im       0.208603-0.042313im     -0.114406-0.0467092im    -0.0674259+0.14553im       0.256409-0.0159269im   -0.00395641-0.0672103im     -0.075764+0.0181358im     0.0468366+0.187957im    -0.0548777+0.110182im    -0.0240054-0.040635im       0.057985-0.00568907im  -0.0870038-0.0393121im      -0.126023+0.0294214im       0.17866-0.00239768im   0.0930975+0.17348im      -0.00856127+0.030552im       0.115086-0.0120919im     0.0169548-0.142426im      -0.181778-0.0342676im     -0.0399322+0.0333537im
    0.134944-0.123587im     0.0476826-0.251571im       0.0278988+0.0760496im      0.176365-0.168342im     -0.160489+0.225136im    0.0392413-0.219231im       0.0501399+0.103098im      0.0393011+0.0634158im    -0.0481251+0.0643049im     0.165155-0.173995im      0.0454024-0.0451642im    0.0283853-0.233082im      -0.0736357-0.0383867im    -0.0510185-0.00929914im   0.0166611+0.0443352im     -0.104471-0.0952739im    0.0368864-0.0494663im      0.147622+0.0169802im       0.15275-0.0372275im     -0.174637+0.182791im    -0.0556146-0.0854619im    0.0144347+0.0524564im      0.206697+0.0293386im    0.0895437+0.0129021im      -0.200354+0.283013im       0.146552+0.117942im     0.0455152+0.0461589im      0.0109835+0.129095im     0.00396808+0.0126416im      0.127235+0.198449im       0.137761-0.264954im       -0.031783-0.181512im
    0.170854+0.173687im      0.334827-0.0342689im      -0.158227+0.117901im        0.02068+0.156378im      0.122111-0.0262882im   -0.180335-0.0341294im        0.09088-0.0907281im     -0.102225+0.180248im     -0.0404075-0.196555im    -0.0358304-0.244565im      -0.173662-0.0441325im    0.0427352-0.0396638im      -0.044028+0.0472062im    -0.0168115+0.188618im     -0.171553+0.0600141im    -0.0772758+0.130258im     -0.189127+0.0149251im      0.117448-0.0690334im      0.108366-0.169318im      0.0988036+0.0212597im    0.0497808+0.154401im    -0.0216114+0.291522im     -0.0269416-0.0460812im   -0.0668529+0.118295im        0.049466-0.0956187im      0.132864-0.0280465im     0.258753-0.0575245im      -0.128374-0.150568im    -0.00463367-0.068427im     -0.0534548-0.0450374im       0.11684+0.03118im       -0.0806208-0.116369im
   0.0438315+0.062421im    -0.0690106+0.0925504im      -0.230167+0.176516im       0.105137-0.113883im     0.0135735-0.0279806im    0.208719+0.169594im        0.152304+0.12254im       -0.169374-0.0818167im     -0.176257-0.289113im      -0.10235+0.0704464im     0.0259087-0.145359im     -0.266652-0.0941791im       0.150254+0.176697im        0.18889-0.0474409im     0.129032-0.061859im     -0.0577282-0.110471im     -0.045239-0.0102217im     0.0938216-0.0818364im      0.167376+0.0255886im     0.0715147-0.0129887im      0.12297+0.0708312im   -0.0776736-0.0261182im      0.160478+0.116844im      0.165878-0.235245im      -0.0755848+0.15988im     -0.00969136-0.0153544im    0.0737707+0.0326259im      -0.093846+0.0212863im    -0.0651158-0.058421im      0.0290153+0.0783263im    -0.0451396+0.221752im       -0.128993+0.18877im
   0.0357671+0.183122im     0.0869817+0.0212401im      0.0847771+0.182484im      -0.042855-0.0566902im    -0.309455+0.0428324im  -0.0163164+0.0365732im     -0.0211741+0.0104559im      0.224309+0.0970206im      0.140989-0.327433im     -0.030775-0.0597347im     -0.227261+0.0475812im   -0.0130607+0.118184im        0.125307+0.0394478im     -0.101663+0.0444816im     0.259397+0.0884319im    -0.0107425-0.0882975im     0.161687+0.070155im     -0.0447218+0.252588im      0.0523849+0.119im         -0.090922+0.00969582im   0.0965012-0.0464809im    0.0338977+0.00152896im  -0.00767132+0.0274602im   -0.0783504-0.225523im        0.336501-0.0763406im    -0.0204041+0.0100247im    -0.021273-0.0941298im      0.0595039+0.00221546im     0.163289+0.0302055im     0.0603699+0.0981073im     -0.121641-0.0769258im      -0.118148-0.198437im
      -0.162-0.217112im      0.337005-0.212734im        0.164118-0.0598573im    -0.0897394-0.102866im      0.190115-0.150806im   -0.0121303+0.124498im       0.0471048+0.0345646im     -0.116924+0.146242im      0.0578383+0.0664075im    -0.311507-0.0412091im     -0.132863+0.0578029im   -0.0668889-0.0429228im      0.0676701+0.0913393im    -0.0926459-0.0430745im   -0.0339547+0.00252477im   -0.0812344-0.0960549im   -0.0827085-0.176888im      0.0403592+0.167059im     -0.0206251+0.160067im     -0.0166619+0.101596im     -0.182131+0.0394651im     -0.10642-0.0704935im      0.068396+0.191586im    -0.0659994-0.170572im       -0.134595-0.137427im      -0.055831-0.0682022im    0.0390106+0.0476293im      0.0642179-0.0434668im      0.155734+0.28397im      0.00776954+0.0994664im      0.118315-0.0200426im     -0.0299126+0.128845im
    0.103441+0.145132im     0.0572614-0.140926im        0.203028+0.0123743im     -0.177599-0.0102124im     0.193063+0.0640331im     0.23239+0.254206im       -0.167062+0.051642im      0.0445049+0.229777im      0.0265665+0.0377226im     0.125586-0.0443104im      0.110324-0.309794im     0.0033193-0.135463im     -0.00321324-0.0409029im     -0.187297+0.128128im     -0.141229+0.0694499im   -0.00820461-0.131388im     0.0333247-0.0208236im     0.0966695-0.104954im      0.0612654-0.0335858im     0.0694022-0.164054im     -0.174771-0.107909im     -0.170393-0.121704im     -0.0342069-0.155447im     0.0673822-0.0415808im      0.0773075+0.0226234im     -0.260387-0.0490647im   -0.0775712-0.202893im      -0.0649872+0.121251im     -0.0150993-0.188696im     -0.0338342+0.0689694im    -0.0466392+0.0790105im     -0.0936918-0.0847643im
     0.15381-0.0733839im    0.0456888+0.116418im      0.00454279-0.0299838im     -0.216012+0.0782132im   -0.0522492-0.21691im    -0.0666404-0.0639008im      -0.175472-0.176742im       0.161161-0.159672im      -0.238339+0.0929754im   -0.0765263-0.122024im      0.0799071-0.242667im    -0.0494502-0.205996im        0.054006+3.52787e-6im   0.00595467+0.0720082im    0.0726207-0.12063im      0.00243141-0.00564451im    -0.14454+0.130171im      -0.029652-0.106158im       0.229561+0.200973im       0.135173+0.0812858im    0.0798713-0.0344678im    0.0688064-0.135265im      0.0172732+0.160298im    -0.0135535-0.00621159im  -0.000491172+0.043934im   -0.000930208+0.104285im     -0.145955-0.0908271im      -0.110136-0.120907im       0.123751+0.246797im       0.170509-0.137715im       0.017835+0.0387099im       0.119502-0.2669im
  -0.0270424+0.0294476im     0.124671-0.00519176im      0.275883-0.092639im       0.144396-0.0741936im     0.175383-0.12418im      0.182792-0.124185im       -0.254733-0.064145im     -0.0825114-0.0276665im    -0.0689741-0.154983im      0.103171+0.147695im      -0.181391+0.0286894im    0.0421945-0.0143255im     -0.0352061-0.02285im      -0.0715882-0.181456im     0.0699173+0.174534im     -0.0914756-0.0408027im   -0.0982482-0.0447766im     0.0492087+0.00253516im    -0.155603-0.10271im        0.159356-0.0272597im      0.14482+0.148695im      0.101535-0.272338im      0.0581438+0.135378im    -0.0335537+0.257363im        0.173095+0.181297im       0.102212+0.0231693im    0.0280783+0.264938im      -0.0794164-0.0898628im    -0.0430661-0.0581879im      0.115087+0.0816471im    -0.0734934+0.0754912im      -0.130476-0.118244im
   -0.100623+0.131792im    0.00654039+0.110878im    -0.000240756-0.122881im      -0.121462-0.0328002im   -0.0374946-0.146222im    0.0292869-0.0276547im      -0.137878-0.0705922im     -0.200235-0.00298953im    0.0794157-0.12045im      -0.051127-0.104682im     0.00549691-0.118118im      0.088796+0.00431253im    -0.0859106-0.131401im       -0.15589-0.214449im      0.102306-0.0458539im      0.046891+0.342162im    -0.0192849-0.057806im      0.0305584-0.131644im       0.119006-0.00860721im   -0.0890081+0.137215im      0.099493+0.054129im      0.139751-0.0221059im      0.214312-0.0626189im   -0.0397674-0.042744im       -0.120862-0.0768011im     0.0655082+0.148702im     -0.199781-0.255112im       0.0756473+0.138601im     -0.0936864+0.0471271im     -0.245558+0.130569im     0.00656828-0.127546im       -0.330417+0.133947im
 -0.00375162+0.0512782im     0.156873+0.00412051im     -0.110744+0.0190942im     0.0070003+0.0942465im     -0.11508-0.112963im    0.0129681-0.0405332im       0.222748-0.0861533im      0.160326-0.0157808im     0.0141863-0.145857im    -0.0208268-0.0311799im     -0.031919-0.0758164im    0.0188157+0.0994781im      -0.165479+0.0623119im    -0.0346406-0.19747im      0.0134376-0.366401im       0.069381-0.0427125im    -0.136278+0.179162im      0.0131371-0.0657im         -0.31082-0.106017im    -0.00228691+0.0584466im    -0.393113-0.0311347im    0.0739557-0.109856im      0.0438004+0.130517im     0.0255684+0.124557im      -0.0468942+0.0513988im     -0.206748+0.0657287im     0.118943-0.0194249im   -0.000992724+0.296375im      0.0781162-0.0754922im      0.152191-0.0444821im    -0.0543803+0.0330402im      -0.126472-0.0456448im
   0.0185772-0.0871209im    0.0930095-0.16032im        -0.132574+0.0233221im     0.0128827-0.0180672im    -0.110632-0.0259938im   0.0652861-0.0442371im      -0.125264-0.0782574im    -0.0369515+0.0168451im      0.135977-0.0456577im     0.104359-0.050267im      -0.173591+0.0559938im   -0.0219032+0.151097im       -0.167114+0.0872209im    0.00838843+0.0383021im     0.132174-0.232005im      -0.311411-0.0248864im     0.166283-0.311311im       0.127732-0.060617im     -0.0307979+0.00751654im    0.0180039-0.179274im      -0.10868-0.027081im      0.191287-0.0401152im    -0.0719966-0.149127im      0.180529+0.037486im      -0.0470618+0.181523im      0.0604363+0.0269856im    -0.143426-0.226918im       -0.200171-0.203375im      0.0690036+0.136617im      -0.108176-0.109578im      -0.114008+0.136634im        0.169016+0.0968138im
   0.0847349+0.00666716im   0.0958157+0.0819837im      -0.147252+0.228739im      0.0300372+0.0956062im   -0.0734603+0.102331im   0.00252893-0.100127im      -0.0846283+0.0152258im     0.0624358-0.0280906im     -0.108659+0.273567im    -0.0109449+0.117403im       0.141295-0.0286399im     -0.34213+0.0550627im       0.062936+0.00167549im     -0.25998+0.0458654im   -0.0205549+0.0422594im     -0.186667+0.0947648im    -0.222599-0.161895im      0.0289121-0.0162675im     -0.134261+0.0413553im     -0.195301-0.101662im     0.0952686+0.0900562im   -0.0152954-0.0492268im     -0.130245+0.118164im    -0.0710408+0.0685826im     -0.0620735-0.0796992im     -0.129449+0.0695541im     0.122434+0.00456099im      0.011272-0.0457695im     0.0212305+0.0242623im     -0.105511+0.146526im      -0.391778-0.182241im       -0.135102+0.0226575im
   0.0100004-0.204728im      0.249978+0.0890112im       0.155359+0.0319713im     -0.124714-0.125487im     0.0225416-0.164674im   -0.0411533-0.12748im       -0.0595961-0.0489668im     -0.126081-0.244344im     0.00501991+0.0336784im     0.127907+0.121686im       0.115583+0.0974135im   0.00638445-0.0080601im    -0.00843522+0.19072im       0.0457114+0.136403im      0.235776-0.0921815im      0.255972-0.113266im    -0.0660204-0.010881im     -0.0456768-0.0906305im    -0.0220756+0.00994524im   -0.0054836-0.0860366im    -0.100189+0.22732im      0.0145673+0.177075im     -0.0543344-0.286064im     0.0564088-0.200432im      -0.0161938-0.0303867im   -0.00732346+0.0839436im     0.031664-0.00392264im    -0.0898955-0.0464882im       0.11935-0.311243im     0.00475583+0.221102im      0.0347762-0.140317im       -0.028182-0.060458im
   0.0859852-0.0184986im    0.0128621-0.144449im        0.150429+0.0558883im     -0.242921+0.0360465im  -0.00762278+0.0651854im   -0.111395-0.00851717im     0.0269355+0.163475im       0.145405+0.0907772im    0.00248722+0.0287046im   -0.0101282+0.203008im     -0.0415629-0.263847im     0.0608405+0.0141477im      -0.137934+0.209876im      0.0637007-0.231946im     0.0838714-0.0813968im     -0.110453-0.00127972im  -0.0317846+0.128948im       0.140663+0.0487406im     0.0702023-0.176487im     -0.0298997+0.220759im      0.164303+0.0919597im     0.075247-0.0663985im    0.00641702+0.00204994im    0.292576-0.0363747im      0.0721697-0.220038im     -0.0730753+0.136267im     0.0689151+0.183458im       0.0580627-0.12063im      -0.0716614-0.0792578im     -0.278948-0.0803011im    9.06544e-5-0.0928324im       0.216357+0.066358im
   0.0858668-0.198272im    -0.0428456+0.0558661im       0.157399-0.113445im       0.152382+0.0888266im   -0.0630726-0.0568695im  -0.0888597+0.186281im        0.201718-0.142055im      -0.100402+0.21343im       0.0774356-0.116186im      0.131307+0.142527im       0.207745-0.0297942im    -0.135184+0.000401187im     0.127458+0.119565im      0.0201667+0.19203im      0.0303297-0.176478im     0.00277421+0.118821im    0.00594776-0.038088im       0.103524-0.0707449im      0.165406-0.0955732im    -0.0462828-0.300006im    -0.0566462+0.0274575im    0.0875054-0.083779im      0.0722436+0.053207im     0.0820216+0.2088im          0.212287-0.0892465im      0.113643+0.118153im    -0.0265465+0.0588431im       0.322224+0.04061im      0.00462709+0.200215im     0.00515812+0.122199im      0.0740768-0.0412078im     -0.0157612-0.0706664im
   -0.054413+0.151275im      0.110607-0.140143im      -0.0699783+0.165925im     -0.0588815+0.132868im      0.110677-0.110041im    -0.173488-0.26763im      -0.00812963+0.051961im      0.0770931-0.0351056im      0.046883-0.125334im    -0.0561513+0.17625im        0.200455-0.0105148im    0.0106296+0.00398485im     0.0631652-0.0768489im      0.272453+0.0703384im    -0.138943+0.109862im      0.0799779+0.0585968im    0.0891257-0.208066im      -0.112154+0.120949im     -0.0335444-0.108698im      0.0594006-0.115503im     -0.176779-0.136181im     -0.065342-0.282397im       0.272858-0.0142198im    0.0289003-0.151984im       0.0370694-0.0662514im     0.0807215+0.208891im     0.0167052-0.104416im      -0.0894679-0.10806im       -0.257384+0.0423664im      0.113788-0.000804493im  -0.0669082-0.129394im      0.00590841-0.0144032im
  -0.0230398+0.0835052im   -0.0376397-0.0335135im     -0.0410328+0.180683im        0.21001-0.0786812im   -0.0237473-0.107279im    -0.113843-0.0307312im      -0.082807+0.194005im     -0.0799912+0.0816533im      0.100689+0.0200073im     -0.26142+0.0693698im     0.0552425-0.0589073im   0.00667166-0.11264im         0.281164-0.375606im      -0.114108-0.0439021im     0.183076-0.140598im       -0.13186-0.0990357im    0.0963854-0.00753237im   0.00241361-0.348811im       -0.18656+0.00100296im    0.0725563+0.153794im     -0.122332+0.0577464im   -0.0273628+0.0492717im    -0.0881704-0.0777496im     0.102843+0.0666772im      0.0192173-0.195757im       0.106636+0.0563044im   -0.0677815+0.0224487im        0.11498-0.0936421im     0.0155545-0.0952127im     0.0319063+0.063226im      0.0713133+0.118159im        0.116044-0.176266im
    0.218569+0.0726126im    0.0737621-0.137958im       -0.141428-0.117im          -0.25302-0.126238im     -0.132203+0.19312im      0.128318+0.0821393im     -0.0924387+0.00908925im    -0.204175-0.0921628im      0.138523+0.0483416im   -0.0283126+0.231307im      -0.199396+0.115491im    -0.0699633-0.0760693im      0.0727971-0.110304im        0.29063-0.034496im     -0.107072-0.0088086im      0.241032+0.104833im     -0.139897-0.0401824im      0.202208-0.0934733im     -0.151738+0.096118im     -0.0455554+0.0806041im    0.0156574-0.0718644im   0.00886325+0.0234607im     -0.121263-0.103337im     0.0234977+0.00552918im      0.101652+0.0955875im      -0.12466+0.129743im      0.131352-0.013528im        0.155291-0.0345506im    -0.0744464+0.235272im      0.0249574-0.00115477im    0.0298818+0.049133im      -0.0791585-0.198369im
    0.197907-0.192047im      0.158159-0.0233746im      -0.207057-0.123583im      0.0662655+0.0461075im    0.0442215-0.180524im    -0.160832+0.0318025im     -0.0550461-0.107442im     -0.0649829-0.00176236im   -0.0559417-0.0682221im    0.0767858+0.225908im       0.168556+0.0142129im     0.189605+0.0528273im      -0.121856-0.137931im     0.00484686+0.0297298im   -0.0217014+0.0733181im     -0.249088+0.121051im      0.118839+0.0876821im      0.104474+0.0284097im    -0.0846278-0.183952im    -0.00735997+0.157497im     0.0959009-0.0684362im    -0.222717+0.0329484im     -0.173475+0.175418im     0.0270244-0.333182im       0.0952449+0.208712im     -0.0842346-0.137062im     -0.164668-0.0440162im       0.193264+0.0204162im      0.087295-0.0754197im     0.0440893+0.0277881im    -0.0439064-0.00689132im    -0.0648034-0.00321339im
   0.0614304+0.197746im     0.0774288-0.216925im       -0.149423-0.186936im      0.0416624-0.290828im      0.042862+0.204378im    0.0569276-0.0573477im     -0.0417086-0.154214im    0.000992533+0.0310863im    -0.0110668+0.0980791im   -0.0563924+0.0803174im      0.120388-0.0875603im    0.0886277+0.0301841im     -0.0514492+0.235296im      0.0386655-0.107725im      0.175696+0.110629im     -0.0997776+0.0392912im   -0.0471095+0.00848304im    -0.356142-0.0628027im     0.0967491-0.115758im       0.181538-0.157328im    -0.0689505-0.0641092im  0.000162127+0.0769488im      -0.10035+0.0788741im     -0.11127-0.0842705im      -0.103894-0.178524im       0.218461+0.157069im     0.0496903+0.0136885im       0.125269+0.169343im       0.136957+0.0361145im    -0.0283571+0.0139744im     -0.126576+0.182725im       0.0320276-0.100781im
  -0.0077258+0.0676994im     0.117807-0.112557im      -0.0790349-0.110581im      -0.198453+0.226737im     0.0160249+0.0884415im  -0.0138201+0.12047im      -0.00492223-0.0405569im     0.0545575-0.0699197im     -0.141408+0.0357157im    -0.126577-0.0329117im      0.164755-0.00278234im  -0.0666839+0.224258im       -0.091764-0.0606102im    -0.0364673-0.0795878im    0.0677228+0.140898im      -0.122944+0.0720033im     0.174561+0.200855im      0.0170194-0.130915im     0.00600284+0.217999im       -0.18111-0.0857749im    -0.211987+0.0443431im     0.189988+0.092048im       0.182376-0.121534im     0.0331052-0.0590952im      0.0695774+0.0892827im      0.104974-0.206413im    0.00113187+0.31926im       -0.0573716-0.0853194im     -0.177686+0.0510702im    0.00245702+0.273622im      0.0280413+0.14582im       -0.0116506-0.110585im
  -0.0584679+0.157783im     -0.159091+0.0476012im        0.20267+0.0499509im    -0.0808041+0.126523im     -0.130963-0.0344752im    0.105854+0.0306013im      0.0433813+0.0157988im    -0.0978381-0.0688589im    -0.0679813+0.153271im     -0.338753-0.0166201im     0.0615543-0.120616im      0.214338+0.0928991im      -0.196345+0.172237im      0.0579188-0.0925469im   -0.0260719-0.0716747im   -0.00337773-0.0397043im    0.0184843-0.108519im      0.0984826-0.0352526im     -0.118104-0.00328332im   -0.0638974-0.166442im     0.0695192-0.179231im     -0.220884+0.143443im      -0.132844+0.190716im     0.0837941+0.0764806im       0.103276+0.124779im       0.237655+0.0708189im    0.0926891-0.176611im       0.0359503-0.229772im      0.0839434-0.0760629im      0.160946+0.180406im       0.101665-0.102943im       -0.107098+0.0133618im
  -0.0772309+0.0985341im     0.211144+0.03068im        0.0260989-0.000888457im   0.0653672-0.0451317im   0.00937164+0.13652im     -0.146213-0.031897im        0.247525-0.0629495im      0.133511+0.131586im       0.112373+0.152975im    -0.0169681-0.0256721im    -0.0568148+0.1196im      -0.0765687-0.185294im       0.0118827+0.0750074im     0.0184245-0.229675im      0.194159+0.0595227im       0.10734+0.217504im      0.147883+0.137224im       0.124106-0.155732im       0.127862+0.015216im      -0.142065-0.181846im      0.040441+0.124935im     -0.187271-0.278048im      -0.184414+0.00117683im   -0.113957-0.0112718im      -0.137559+0.129855im      -0.100735+0.0458376im    -0.158583-0.0344627im     -0.0263465-0.252831im     -0.0748935-0.136763im       0.114318-0.109295im      0.0948395+0.0833813im     -0.0714545+0.019635im
   0.0508925+0.0179215im   -0.0535797-0.0393484im     -0.0613506+0.12287im       0.0698816-0.0847793im    0.0553455-0.226597im     -0.15231-0.108649im        -0.15986-0.173063im       0.192248-0.046284im       0.146349+0.0352242im    0.0541839+0.0369076im     -0.231679+0.0229618im   -0.0108532+0.052978im         -0.1104+0.0409093im      0.173262-0.155797im     -0.145297-0.112731im     0.00174504-0.140442im    -0.0278779-0.107254im       0.120825-0.229929im        0.34143+0.242077im      0.0134011-0.0616007im    0.0116862-0.18315im     -0.0981757-0.0289087im    -0.0207722+0.0257342im   -0.0803332+0.0612164im     -0.0113218-0.118564im      0.0125175-0.27667im      0.0851986+0.0827889im        0.21813+0.113844im      -0.118772-0.155967im     -0.0318634+0.2049im       -0.0894388-0.0385988im   -0.000405429+0.0335356im
  0.00289156+0.0708075im     0.166086-0.0839917im      0.0301193+0.078212im      0.0546556+0.155657im     0.0241583-0.0613333im    0.139766+0.229611im        0.118321+0.0453962im     0.0615579-0.225964im      0.0634732-0.0288173im     0.091076-0.0221795im     0.0175899+0.0174814im    0.0991138-0.0726227im      0.0722871+0.0161413im   -0.00742851+0.0977081im     0.163165+0.0587637im      -0.18667-0.0317781im    -0.328866-0.0258866im      -0.20959-0.142128im     -0.0494535+0.112244im      -0.117818+0.0512908im    0.0154944-0.292915im     0.0954152-0.200969im     -0.0150489-0.154011im    -0.0879437-0.0486973im      0.0205813+0.144328im       0.158629-0.0321928im    0.0728121+0.0396589im       0.246484-0.0956304im   -6.22579e-5-0.119891im      -0.163867-0.257547im       0.162505-0.156138im      -0.0378657+0.100562im
    -0.19668-0.0378984im     0.160246+0.0378227im     -0.0351282+0.0783701im     0.0115166-0.0780996im    0.0714522-0.0276074im    0.153043+0.064909im       -0.116386+0.274645im        0.18332-0.0240129im     -0.154207-0.0129514im    0.0468386+0.117506im     -0.0409984-0.00873887im    0.148457+0.152237im        0.135608-0.0598891im     -0.130058+0.0114242im    0.0359336-0.0325828im      0.192797+0.159903im     0.0190845+0.0771209im       0.22056-0.000336146im    0.220613+0.0116753im      0.107489-0.10072im      -0.232433+0.0801596im    0.0213294+0.125479im      -0.268691+0.150156im      0.095973-0.0476785im     -0.0124886+0.118259im       0.284449-0.0219827im    0.0773822-0.023205im       0.0484073+0.118982im       -0.18966+0.126101im    -0.00429405-0.215667im      -0.112067-0.1828im         0.0115554+0.00723413im
    0.072041-0.0786609im    0.0305837+0.00161369im     -0.104158-0.0536182im      0.198469-0.0265661im     0.166191+0.0619785im    0.125406+0.0141249im     -0.0141967+0.227613im      0.0226824+0.115919im      0.0144748+0.0344679im     -0.11474-0.0360168im      0.069476+0.0699295im    0.0941441+0.301888im       -0.085048+0.19665im       0.0141592-0.0297027im    0.0525325-0.221328im       0.043318-0.132614im     -0.150069+0.0615382im    -0.0275661-0.00818887im   -0.0517738+0.0358245im     0.0620307-0.0312048im     0.188315+0.0833797im    -0.150769+0.0363638im      0.281627-0.105635im     -0.149959+0.00223461im    -0.0482044+0.0108928im     -0.125236-0.096131im     -0.227653-0.117385im        0.103762-0.157175im      -0.225047+0.0750437im    -0.0372926-0.0867417im    -0.0612219-0.132464im      -0.0282167-0.381661im

and then generate the state $ψ$

psi = P[:, 3]
32-element Vector{ComplexF64}:
   -0.1543441831560704 - 0.1694220203585271im
   0.09364641113942107 + 0.04680330160108434im
  0.023808487863861444 - 0.035874016937443645im
   0.02884778350954975 + 0.039724272642547485im
  -0.02261352692826893 + 0.11948108257959607im
   0.04263173711137835 - 0.15980430089173914im
    -0.137345185841997 - 0.10512117221140364im
  0.036153404525798266 + 0.11787929412045475im
  -0.14766563111197373 + 0.20020440996067335im
  -0.08725311071839469 - 0.027624940772420177im
   0.30880850859439235 - 0.07198284394543346im
 -0.014151635809681082 + 0.03203610176451192im
  -0.02705165570571775 + 0.08330387864553956im
   0.09871451828420233 + 0.12947105172193582im
   0.33439987995348674 + 0.0im
   0.06300550680387387 - 0.11706599259557963im
   0.22494910506701657 - 0.04944560041814626im
   0.01440388966913161 - 0.01826520163898956im
   0.09407564534983057 + 0.08421781714288737im
   0.17168528929858834 - 0.09282893396698641im
   0.03258640933164265 + 0.11561128639406693im
   0.11101960808443917 + 0.011467808128232622im
   0.05673702515407257 - 0.14488137498422543im
  -0.27438600850937334 + 0.0431317634545761im
    0.2224967962416331 + 0.07175832316414951im
  -0.09945800900900606 + 0.11518723112382635im
   0.15307929586906743 - 0.09959654904163964im
  -0.20292261124078956 - 0.09756816930341783im
   0.03135374880783468 - 0.058039553558786816im
  -0.21024142667423518 + 0.04780806203252405im
  -0.10834135957938922 + 0.19165183907479236im
   0.08876704793027292 - 0.06606143581090722im

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.