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.224093+0.0643023im   -0.0583609-0.158845im      0.0104736+0.0193861im    -0.0320573+0.145971im     -0.143184-0.0824071im     0.0398142+0.0400762im     0.133941+0.117549im      0.101387-0.174048im       0.240491-0.0739423im   0.00548604+0.0116629im     0.0681797-0.113857im       0.054955+0.265131im    -0.00539473-0.0120326im     0.207555-0.0307483im  -0.0483477-0.00821996im      0.11433-0.0824983im     0.250314+0.0310696im    0.0198158+0.100033im     0.0819406+0.0303725im      0.0604115-0.0298996im     -0.154787-0.0326751im      0.121195-0.0577223im    -0.0942557-0.0931788im     0.118015-0.0700799im    0.0899829+0.0209842im     -0.333888+0.307528im         0.11199+0.0249852im     0.0366043+0.0434856im       0.213301-0.147684im      -0.152522+0.0196698im     0.148273+0.064268im    -0.000825661+0.23829im
  -0.0325307-0.0213628im     0.253999-0.158273im      0.0473618+0.0581212im    -0.0688739+0.166349im      0.049212-0.0554248im     -0.216457-0.0313529im    0.0413903-0.120862im     -0.067503-0.0475184im      0.226488-0.0168066im   -0.0814006-0.13918im       -0.118461-0.0402797im     -0.268047+0.0196484im     -0.116791+0.160966im    -0.0179086-0.0231685im   -0.208543+0.187158im     -0.0412092-0.137629im     -0.194516+0.0898946im    0.0465253-0.070644im     -0.309195-0.121764im       -0.147525-0.00809584im    0.0963694+0.212094im        0.20597+0.00720539im     0.145457+0.163671im      0.120873+0.0415209im    0.0521749+0.0820915im     0.0099374+0.0384017im      0.0086936-0.0145267im     0.0968037-0.15538im        -0.122302-0.0774401im     0.0761728-0.0636946im      0.22202-0.0539591im      0.0247389+0.120671im
   -0.021638+0.00200217im    0.077963-0.0369868im    -0.0790381+0.150083im      -0.210563+0.123383im      0.130277-0.126137im       0.107555-0.114786im    -0.0477421-0.0121268im   0.00272231+0.193233im       0.024302-0.0566363im   -0.0201808+0.358304im       0.191661-0.0766047im    -0.0149988+0.140073im     -0.0154234+0.0120582im   -0.0519261+0.117628im   0.00540849-0.172408im     -0.0800466-0.056446im    -0.0375744+0.148651im      0.136836+0.0420735im    0.0829542+0.098892im      0.00735354-0.210903im     -0.0180149+0.0997283im     -0.154007-0.138552im      0.0616877+0.1419im       0.0685263+0.161334im     -0.070582+0.170701im       0.269298+0.139047im        0.074241-0.127735im      -0.153743-0.0195999im       0.289663+0.0800872im       0.17651+0.124953im     0.0715626-0.157127im       0.0279956+0.049956im
  -0.0325321-0.0162315im   -0.0962849-0.00503191im    0.0909861+0.333425im      0.0238661+0.121263im      0.152939+0.147077im     -0.0844649-0.311743im    -0.0179656+0.0277605im    -0.110511-0.216228im      -0.137152-0.0267416im    -0.128658-0.159976im      -0.151056+0.0261004im    -0.0121562+0.0640321im      -0.12952-0.0106839im     -0.10016+0.109941im   -0.0553015+0.131602im      0.0100706+0.0185372im     0.233926-0.237651im     -0.064239-0.0508205im     0.139479+0.142206im        0.187703+0.0640124im    -0.0668778+0.0519539im     -0.025485-0.0352229im     0.0929883+0.139166im    0.00652646+0.187901im     0.0322651-0.0225145im     -0.164633-0.0399722im      -0.179079-0.0013796im    -0.0244104-0.227584im        0.252467+0.140306im       0.027343-0.108954im     -0.042705-0.0805858im      0.0209804-0.0845774im
    0.229416+0.00665012im   0.0240149-0.0702158im    -0.0304997-0.00123313im     0.215926+0.00909754im   0.0716132+0.0317109im    -0.0398855+0.0746535im    -0.169941+0.079701im      -0.31968-0.0144711im    -0.0853324+0.0101036im    0.0327197-0.168175im     -0.0287096-0.110101im      0.0128009+0.0893933im     0.0212008+0.0487606im   -0.0510193-0.123097im   -0.0549448-0.15808im      -0.0437404+0.179751im     -0.105738+0.0664242im       0.3468-0.00295im      0.0313527-0.0223789im      0.0418506+0.0291584im   -0.00808955-0.00924273im   -0.0632822+0.181999im      0.0937005-0.137864im   -0.00909146+0.00906933im   -0.187599+0.0189258im     -0.135623+0.0209764im    -0.00530421+0.0695057im      0.211425+0.196853im       0.0881386+0.0942558im     0.0764331+0.0795182im     0.159893-0.393651im       -0.210995-0.0290464im
   0.0832682-0.11966im      -0.109395-0.041515im      -0.214663-0.22156im        0.093861-0.110319im    -0.0809818+0.0498176im    -0.0736312+0.147496im    -0.0321178-0.218141im     0.0821846-0.0460982im     0.0398632+0.124422im     0.0594268+0.062485im       0.040078+0.167659im     -0.0670271+0.083034im       -0.18918-0.119623im    0.00231681+0.0422261im   0.0692047+0.246791im    -0.00534494-0.0249758im    0.0603378-0.120221im     -0.256407-0.022648im      0.128544+0.17797im        -0.133062-0.099179im      0.0258346+0.235481im    -0.00133119+0.128055im      -0.035859+0.0408362im  -0.00553475+0.162108im    -0.0426872+0.135456im    -0.00959803-0.142242im        0.251208-0.152748im       0.159685+0.0441313im       0.200434-0.1344im      -0.00540717+0.00384592im    0.137383-0.180922im       -0.116477-0.177889im
  -0.0229165-0.0025255im     0.366519-0.0680189im     0.0197477+0.17229im      -0.0529116-0.0965467im    -0.348118+0.0102584im    -0.0609457-0.0013458im     0.156228+0.0444144im    -0.183018-0.0435705im     -0.114483+0.273522im      0.142342+0.121482im      0.0362099+0.156647im       0.197275+0.120311im       0.100484+0.22005im     -0.0183195-0.0311065im  -0.0163188-0.0260352im     0.0931663+0.0607394im     0.178291+0.067702im    -0.0247243+0.0166346im    0.0145688+0.196289im       0.0842437-0.0480379im    -0.0749879+0.218176im       0.110222-0.12582im       0.0200261+0.0935693im     0.068181-0.0922363im    0.0265294-0.110427im       0.110034+0.0209678im     -0.0731898-0.00828198im     0.100701+0.00269935im     -0.149612+0.0292237im   -0.00581158+0.032797im    -0.0271695+0.0288923im      -0.272466-0.161599im
    -0.13128+0.0631821im    0.0148947-0.10519im        0.143881-0.118036im     -0.0536186+0.0512235im    -0.144309+0.039445im     -0.0753507+0.00152638im    0.115968+0.167585im      0.115761-0.0890615im      0.045577-0.173071im      0.136958-0.0273504im    -0.0241347+0.175076im      -0.201572+0.0658472im     0.0852296-0.0604056im    -0.122283+0.144306im    0.0451867-0.155072im      0.0341169+0.0628976im   -0.0327991-0.156581im        0.1067+0.250758im     0.0456865-0.0971665im      0.0897231-0.237146im     -0.0912159-0.19719im       0.0695503+0.164665im       0.103289-0.14295im      0.0922714-0.0130274im    0.0568643+0.0210793im      0.154039-0.000736361im     0.158215-0.0771713im      0.261505-0.352931im      -0.0470011+0.0743535im    -0.0275041+0.0778352im   -0.0597812-0.149879im       0.0886741-0.190736im
 -0.00395671-0.0399062im    -0.112783-0.0425329im     -0.159305-0.0557848im    -0.0103524+0.107323im     0.0394505+0.114487im         0.0236-0.0669779im   -0.0965188+0.0445002im    -0.192177+0.0494573im     0.0798071+0.243332im      0.132137-0.00428136im    -0.147828+0.0206399im   -0.00929062+0.221451im     -0.0341789-0.210305im      0.156434+0.0648459im  -0.0267565+0.320219im     -0.0894166+0.163996im     0.0113813+0.108903im      0.183917+0.10598im       0.136615-0.201244im         0.23451-0.0377068im      0.107323-0.131659im      0.0994253-0.00785838im    -0.180197+0.208915im      0.191056-0.0865005im   -0.0374558+0.158489im       0.217321+0.0466251im      0.0584229+0.0724547im    -0.0571168+0.0568188im      -0.121447+0.113552im     -0.0823552-0.160778im     -0.016014+0.127936im       0.0491985-0.0689842im
  -0.0765133-0.0295797im     0.239468+0.0744111im     0.0264089-0.293453im       0.130065+0.0540667im     0.270075+0.0212285im    -0.0582416-0.142448im     0.0513891+0.0279267im   -0.0313537-0.340817im       0.164228+0.0238138im    0.0983571-0.00207567im     0.189006+0.120199im       0.123047+0.0735667im     0.0702112+0.0965229im    -0.108926-0.133852im    0.0485331-0.0111414im     -0.164836-0.0975788im    0.0868007+0.226977im    -0.0900983+0.00140873im   0.0438416-0.0494608im      0.0838656+0.107046im      0.0581223+0.0407655im     0.0607004+0.13107im       0.0615621+0.0414866im    -0.242604-0.224974im     -0.184604+0.122528im      0.0714947+0.0306718im     -0.0223112-0.0545171im     0.0421625-0.0503773im       0.237858+0.00318583im   -0.0128991-0.0408237im    -0.226053+0.0381642im      0.0853992+0.0533524im
   -0.254343+0.145504im     -0.217807+0.315767im      -0.123312-0.0842707im      0.153661+0.0362359im    0.0383703-0.0861252im    -0.0518179-0.0058834im     0.178323-0.0680703im   -0.0950606+0.0108792im      0.144882-0.0892288im     0.117019+0.140532im       0.237397+0.0681166im    -0.0305657+0.0930945im     0.0763252-0.079668im    0.00896059+0.0746132im   -0.189394+0.118529im       0.151699-0.0300005im    0.0644931-0.0884868im   0.00111267+0.109892im     -0.134748+0.000715214im    0.0369432+0.103683im      0.0268445+0.021199im      0.0841083-0.120553im       0.020714+0.0277925im    0.0937316+0.123521im     0.0731287-0.182242im      0.0627037-0.036741im       -0.175215+0.261931im       0.255098+0.156058im       0.0252701+0.0873295im      0.199122+0.0568948im   -0.0453928-0.15112im       -0.0445499+0.157929im
   -0.232396+0.00498036im  -0.0380453-0.0589611im     -0.127461-0.0566443im     0.0097393-0.0357028im    -0.103702-0.107808im      -0.264114-0.306963im     -0.213392-0.0302556im     0.176654+0.0178683im      0.214465-0.0856714im   -0.0386485-0.0123134im     -0.101902-0.0220331im      0.351376-0.0212994im     0.0491015+0.14752im      0.0522315-0.110905im    -0.200945+0.0237431im     -0.233802+0.0586381im    -0.121973+0.00897085im  -0.0274483-0.00402554im   0.0795859+0.0106705im      -0.094487+0.0220046im     -0.152218-0.0888559im   -7.73702e-6-0.0421035im     -0.170499-0.0646689im    0.0496754+0.210183im     -0.126242-0.125362im     -0.0179978+0.00713405im      0.185111+0.0962922im    -0.0615944-0.108561im      -0.0397463+0.119469im      -0.150572+0.0921989im   -0.0393762-0.0697055im       -0.19708-0.011204im
    0.199223+0.167021im     -0.115175+0.0308221im     0.0990406+0.0729915im      0.151742-0.0739869im    0.0207649+0.0847866im      0.138342-0.0927467im    -0.086828-0.198659im      0.102541-0.0615458im     0.0693422+0.0348054im   -0.0713837-0.0475919im    -0.0278309+0.0632352im     -0.166731-0.101757im      0.0857604+0.268387im    -0.0858244-0.0463559im  -0.0675738-0.108558im       0.143925+0.0183321im     0.211761+0.102995im    -0.0121364+0.169631im     0.0131694-0.258818im      -0.0880698-0.061993im     -0.0237954-0.0483721im      0.183843-0.367124im       0.023635+0.052178im     -0.006103+0.089734im     -0.154843+0.0639066im      0.062781-0.0169387im       0.235152+0.0879604im    -0.0802588+0.11196im        -0.002888-0.120861im      0.0695471-0.178994im     -0.147715-0.119765im      -0.0270286-0.2159im
     0.05358+0.00455304im  -0.0999606-0.231644im      -0.049172-0.0103609im     -0.104964-0.150647im    -0.0477243+0.196985im       0.163682-0.2252im      -0.0424716-0.153365im     -0.105733-0.0372355im     0.0862711-0.347346im    -0.0700948+0.213763im    -0.00626576+0.00940361im   0.00120324-0.0999998im     0.0630907+0.00888089im    0.158853+0.0155109im   0.0732082+0.0639109im     0.0959525+0.0179269im    -0.194089+0.0995843im    0.0122271-0.109363im      -0.04825+0.0393669im       0.133979-0.0360852im     -0.131129+0.0384012im      0.159168+0.268468im       0.267036+0.0122269im     0.092897+0.0360593im   -0.0391914-0.195732im      0.0811166+0.0396454im     -0.0697248-0.0394656im      0.128452+0.190251im        0.109103-0.0648932im     -0.036722-0.180757im      -0.12889+0.181782im       -0.101858-0.0763595im
     0.17905+0.10405im      0.0281039-0.0835827im   -0.00450627-0.0946342im    -0.0409124-0.194669im      0.386474-0.0592254im     0.0814582+0.0438184im    0.0960803+0.108878im      0.080007+0.0194688im     0.0935117-0.00678749im    0.208581+0.156733im      -0.108877+0.0351641im      0.058825-0.259088im     -0.0295357-0.150567im     -0.127354-0.0683021im   -0.178465+0.14812im       -0.142707-0.057715im   -0.00486011+0.0693503im    0.0825427+0.00503543im   0.0782664+0.162736im       -0.107663-0.0378917im     0.0163235-0.138216im      0.0279912-0.154762im      0.0591263+0.141373im      0.171681-0.127832im      0.140829-0.102591im      -0.186003+0.136904im       -0.163257+0.0357265im     0.0281244-0.119057im      -0.0178425-0.0822296im    0.00426326+0.105327im     0.0259291-0.0690156im       -0.11648-0.307494im
   -0.187266+0.159097im     -0.131034-0.136637im      0.0307162-0.0370234im     -0.129598-0.0170227im    0.0043269+0.158736im      -0.115541+0.0498962im   -0.0538532+0.0137169im     -0.17424+0.14375im       0.0849057-0.00511263im   0.0905213+0.131174im      -0.170741-0.154653im     -0.0463344+0.237109im      -0.378487+0.16871im      -0.187505+0.0437336im   -0.110205+0.0464882im     0.0549509-0.0699103im     0.050293-0.0174438im   -0.0852693+0.0457738im   -0.0508955-0.00589377im     0.0260204+0.00490881im    -0.141855-0.0691547im     -0.159049-0.032081im      0.0426936-0.0393864im    -0.144172-0.18957im      -0.177078+0.00810408im    -0.185342-0.00993334im      0.073965-0.0800328im     0.0397879+0.135827im      -0.0997293-0.10657im        0.198262+0.230418im     -0.223064+0.139151im       0.0455089-0.0679067im
   -0.130531+0.00098822im    0.124508+0.102643im     0.00926631+0.053096im     0.00392452-0.0228264im    0.0634588+0.136736im       0.152799+0.233879im     -0.112764-0.142418im      0.137488+0.114546im      0.0718768-0.160107im      0.102965-0.199472im     0.00905357+0.119742im     -0.0967186+0.0209244im    -0.0916555+0.0626063im    -0.129724-0.0405162im   -0.161682+0.023448im      -0.130561-0.160641im      0.295766+0.0390247im    0.0863949-0.0447041im   -0.0967479-0.0147024im       0.298584-0.138718im     -0.0284824+0.138517im     -0.0485039+0.223543im     -0.0610308-0.146661im      0.197913+0.101928im    -0.0151758-0.0292505im     0.0968982+0.0281422im      -0.137268+0.0710163im      -0.24314+0.0977306im    -0.00571901-0.0859203im     -0.271926+0.126037im    -0.0535451-0.0457304im      -0.111238-0.00211083im
   -0.166276-0.0581698im     0.203125-0.0928055im       0.22098-0.1578im        -0.192596-0.0863633im    0.0717799-0.0485795im  -0.000195203+0.131984im     -0.194239+0.0484563im   -0.0868962-0.00935001im  -0.00228987-0.239543im      0.006568+0.143246im      -0.138423+0.161112im      0.0548565-0.00468987im    -0.141761-0.0809987im     0.180408-0.0876987im    0.126536-0.0481442im      0.173577-0.0650879im     0.246649-0.138524im      0.228433+0.0644499im    0.0627401+0.0494231im      -0.192345+0.198138im      -0.118917-0.0379716im      0.129691+0.0415618im     -0.212787+0.121045im    -0.0724577+0.0630772im   -0.0927192+0.0796246im     0.0546427-0.120041im      -0.0523447+0.188871im      -0.071038-0.0122067im   -0.000376201-0.0557522im      0.157654-0.188834im     0.0904231-0.0954201im      -0.030712+0.0490561im
  -0.0220153+0.0293285im   -0.0842452+0.0573817im     0.0640544-0.0411194im     -0.107971-0.124122im     0.0997599+0.102621im      -0.177507-0.104074im     0.0488339-0.125445im     0.0495073-0.140012im      0.0370624-0.0660156im   -0.0360591-0.148938im     -0.0152144+0.0818069im    -0.0711177-0.00485049im    0.0218768+0.128893im      0.159398+0.0716093im  -0.0177748-0.107151im       0.127113+0.0308906im     -0.12908+0.235982im      0.210062-0.0991469im     0.210079+0.293707im        0.296159+0.0048966im      0.119744+0.0196824im     -0.128185-0.057858im      -0.113996+0.0785278im    -0.126512-0.0194372im     0.357763+0.113067im      0.0184203-0.129663im        0.187198+0.130712im      0.0194213+0.0403978im      -0.122182-0.232558im      0.0800238+0.172856im     0.0102539-0.0317862im    -0.00379934+0.0408966im
    0.229152+0.0307042im   -0.0304588+0.133324im     -0.0605872-0.142571im      -0.103045-0.11819im     -0.0188525+0.0104063im     -0.118057-0.18095im      0.0242897-0.189967im     0.0974341+0.179533im      0.0854023+0.036216im     0.0496272+0.293828im     -0.0800324-0.0856829im    -0.0942638+0.0372219im      0.114701+0.0748086im    0.0169472-0.0574534im   0.0595484-0.106177im       -0.13477+0.281919im      0.184346-0.222654im     0.0484864-0.00689233im   -0.128137-0.0988576im       0.217603+0.0538607im     0.0316227+0.189634im       0.147062+0.171282im    -0.00564381+0.0608487im   -0.0307892-0.212519im     0.0439497-0.0576604im     -0.204766-0.126221im      -0.0193374-0.0474548im     -0.205501-0.173031im      -0.0639187+0.051291im      0.0832829+0.0292908im    0.0362305-0.169561im       0.0628613+0.104297im
  -0.0886843+0.31792im     -0.0768682-0.0330752im     0.0528752+0.0785083im     0.0279567-0.126791im     0.0904868-0.0969403im   0.000581546-0.0360647im    -0.105113-0.125274im     0.0906115-0.107079im     0.00208309+0.152782im     0.0592549-0.0808929im    -0.0534142-0.00179178im     0.125123+0.202003im        0.12617-0.233396im     -0.115757-0.0438892im   0.0569282-0.146011im       0.185292-0.0840935im  -0.00133017-0.116841im     -0.127034-0.266243im    -0.0966245-0.00884134im       0.12463+0.237979im       0.060233-0.187775im      0.0847215+0.128202im       0.115261+0.0316002im      0.10685-0.0111897im    -0.104073+0.0451965im      0.201479+0.190934im       0.0964085-0.138295im      -0.109037-0.0698244im     -0.0706342-0.151701im       0.154281+0.0690252im     0.234585+0.0220653im      -0.175364-0.00186908im
   -0.157304-0.15911im      -0.124624+0.110431im      0.0330213-0.0883181im    -0.0720562+0.0842811im    -0.115062-0.0415867im     0.0856592+0.0537859im     0.167974-0.00508365im   0.0796892-0.0401986im     -0.156362+0.0829447im    -0.103857-0.00995622im    -0.154693-0.224771im      0.0260333+0.0131615im       0.18265+0.0308196im    -0.180019-0.304199im    0.0439002+0.209275im     -0.0529937-0.142645im    -0.0508233+0.00821189im    0.141855+0.262147im    -0.0857599+0.168154im        0.111923-0.202194im     -0.0449816-0.220298im       0.100998+0.0684662im      0.156101+0.141482im     -0.069483+0.0181372im   -0.0209458+0.0705733im    -0.0537872-0.161314im       0.0438356-0.0071866im     -0.129021+0.0099872im       0.101103-0.148236im       0.124638-0.0821066im   0.00815846-0.00241703im     -0.279354+0.113202im
 0.000529456-0.00447892im   0.0469323-0.0874534im     0.0070403-0.196843im      -0.248878-0.0458717im     0.129233+0.0456982im     0.0770355-0.0225054im   -0.0994353-0.164023im    -0.0474684+0.0537763im    -0.0944027+0.17508im      0.0684628-0.294903im      -0.013155+0.0877764im     0.0631356+0.0905347im      0.110811+0.00018474im    0.123828-0.294298im     0.050411+0.0200839im     0.0111209+0.265211im    -0.0146517+0.0325728im    -0.193761+0.146954im     -0.134129+0.0050861im     -0.0573663-0.00287028im    -0.332248+0.0281038im     -0.144436-0.0977208im      0.130738-0.0737737im     0.229318+0.12543im       0.174223+0.0436963im     0.0283838+0.0503413im      -0.101391+0.0505762im     0.0495812-0.0172416im       0.109965-0.0375348im      0.151954+0.101654im    -0.0929104-0.0181754im       0.233147+0.0748107im
   0.0938652+0.144365im     0.0408426+0.0436953im     0.0900074-0.125536im      0.0371564+0.105165im    -0.0487631-0.097727im      0.0987028-0.0133837im    0.0624071-0.16744im      0.0381783-0.179177im      0.0492995-0.0502818im   -0.0812045+0.218753im    -0.00613592-0.109093im     0.00757911-0.040273im      -0.261503+0.06744im     -0.0470577-0.357051im   -0.0159371+0.112869im       0.240433+0.196504im    -0.0167069-0.0782347im    0.0642157-0.112968im      0.123835+0.0312571im      0.0277306-0.0743793im      0.191808-0.00523184im   -0.0762922-0.0278095im     0.0180584-0.243329im     0.0624117+0.170563im     0.0247924+0.323758im      0.0669852+0.0334265im      -0.165136-0.016127im      0.0449091-0.109154im        -0.14888+0.239476im     -0.0615494+0.0677306im   -0.0925518+0.130541im       -0.101051+0.00402319im
  -0.0123645-0.085799im    -0.0662109-0.0381861im      0.113791+0.149009im      0.0104196-0.205724im      0.103034-0.257491im      0.0537428+0.0239777im   0.00593509-0.140777im      0.032219+0.0189508im    -0.0340386+0.0158152im    0.0954758-0.0170878im      0.079821-0.0815198im     0.0873426+0.0984827im      0.158535+0.0624816im   -0.0850976+0.0650272im   -0.130445+0.220208im       0.269802-0.108579im    -0.0999696+0.0320112im     0.106579+0.137253im      0.273694-0.0259552im      -0.060335+0.123958im      -0.223875+0.133289im       0.158127+0.154178im       0.169647+0.0530225im   -0.0444118-0.0399254im   -0.0774515+0.109779im     -0.0498737-0.162746im      0.00668068-0.054637im     -0.0854287+0.0503979im      -0.136009+0.165678im       -0.24214+0.183055im     0.0404419-0.0525761im       0.292586-0.00788259im
    0.197994+0.0748847im    0.0385618+0.183327im     -0.0578202-0.0777214im     -0.357055+0.164369im    -0.0666339+0.054046im     -0.0660098+0.200974im    -0.0196171-0.079026im     0.0327506+0.0567214im     0.0546907+0.067582im     -0.204998-0.014158im     -0.0897408-0.00254328im    0.0195858+0.0802626im     0.0503077+0.160154im     -0.108899+0.0702456im   -0.127022+0.026238im     -0.0427557+0.0915182im  -0.00729016-0.117721im      0.120307-0.117658im       0.15617-0.00126134im     -0.071853+0.240712im       0.052616-0.217113im       0.126583-0.0778064im     0.0596637+0.0224296im   -0.0552378-0.0128264im   -0.0569642-0.160801im       0.253045-0.123816im         -0.1373-0.0320243im      0.188243+0.013341im        0.280291-0.147787im      -0.234113+0.135715im     0.0211868+0.0611368im      0.0561325-0.0509771im
    0.226178+0.127061im     -0.133936-0.117404im       0.198102+0.158254im    -0.00285429+0.148219im     -0.133592-0.168895im     0.00170872-0.0848796im    -0.163356-0.219149im      -0.04047+0.0278286im      -0.10332+0.109196im     0.0788217+0.0784221im       0.11769+0.34494im       0.0961966-0.025701im     -0.0967053-0.143292im    -0.0826087-0.0507207im   0.0201084+0.0474428im    -0.0472881-0.0355573im   -0.0288064+0.119924im      0.137425+0.145765im     -0.250787-0.00941518im    -0.0361308-0.0367752im      0.101144-0.0988832im    -0.0409905+0.185962im      -0.158835+0.213745im     -0.193937+0.149439im     0.0141068-0.0885453im     -0.103803+0.0122738im     -0.0457007+0.000818021im    0.108111-0.0940179im     0.00213819-0.12565im       -0.104476+0.159353im     -0.207281+0.0229751im      0.0207459+0.123043im
    0.285612+0.029143im     0.0787185-0.0513241im    -0.0297444-0.0882723im     -0.100491-0.00234235im    0.149068+0.136048im      -0.122257-0.0864518im     0.323613+0.22967im      0.0827339-0.00434814im   0.00546648-0.0632806im    0.0187667-0.0500908im     -0.127827-0.160102im       0.129248+0.200521im     -0.0421164-0.0926975im    -0.137611+0.0504564im    0.309702+0.0148803im     0.0933483-0.0747091im    0.0267964+0.107578im    -0.0650249+0.0680525im    -0.056596-0.0736159im     -0.0828907+0.0681253im      0.114585+0.106986im     0.00154821+0.0656998im    0.00987367+0.0407832im     0.049966+0.395043im    -0.0637564-0.156093im       0.100784-0.0944384im      0.0499506+0.139424im      -0.106668+0.098844im       -0.185363-0.0108833im    -0.0742142+0.117635im     -0.163391-0.103366im       -0.019642+0.0416902im
    0.111856+0.0948544im   -0.0807875+0.0961203im     -0.152014+0.118955im       0.136103+0.0381614im   -0.0834369-0.0975591im     0.0854826+0.0635766im   -0.0841841+0.134672im     -0.183468-0.00736056im     0.221997+0.0169707im    0.0261567-0.0217881im     -0.332763+0.0701667im     -0.238771+0.0417333im      0.166904-0.0877246im     0.236423-0.187003im   -0.0181617-0.2132im        -0.103087-0.202056im   -0.00600835-0.105403im    -0.0842845-0.00646814im    0.106691+0.182279im       -0.164808-0.0230267im    -0.0150735+0.13934im        0.041754+0.0921649im      0.156308+0.106253im    -0.0523003-0.00105913im  0.00257426+0.100754im       0.103354-0.0657967im     0.00657481+0.172043im     -0.0703444-0.0904158im      0.0177676+0.0622813im     0.0076135+0.23691im      -0.252368+0.136529im      -0.0162581+0.00931787im
 -0.00907879+0.0375428im   -0.0692936+0.132038im       0.021429+0.00945508im    -0.207749+0.0349157im    -0.170398-0.0592175im    0.00930322-0.186569im      0.235542-0.0217308im    -0.228015+0.0868973im       0.19885-0.141803im     0.0342446-0.174603im       0.121915+0.126863im     -0.0546234+0.0342339im      0.198873+0.0386572im   -0.0564818-0.0778741im   0.0919829-0.00243674im    0.0235078-0.02433im      -0.042857+0.0200592im   -0.0780455-0.192485im      0.027536+0.115846im       -0.104118-0.116515im       0.065152-0.145275im      -0.106356+0.0565708im     -0.233786+0.0637204im     0.178301-0.0135574im     -0.32314+0.195305im       -0.21395-0.059664im       -0.199651-0.0553035im    -0.0777638+0.0648182im     -0.0771034-0.113003im    -0.00998627-0.0678934im    0.0620333-0.118124im         0.13609-0.206742im
 -0.00808727-0.0486479im   -0.0823038-0.0883241im       0.25546-0.0556629im      0.169496-0.0384188im    0.0299923-0.19225im      -0.0117923+0.181916im    -0.0468342-0.0887337im     0.114514+0.022277im       0.125115-0.110078im     0.0499269-0.0835468im    -0.0630014-0.173194im      -0.112128+0.209608im      0.0256357-0.0711345im    -0.201777-0.0593743im    0.156933-0.19016im       -0.120081+0.11872im      -0.181761+0.0320386im   -0.0469871-0.0660051im     0.136748-0.0179303im       0.158248-0.0535021im     -0.147554+0.217176im      0.0330771-0.207132im      -0.268667+0.259529im     0.0654483+0.0380239im    -0.032467-0.143424im      0.0130934-0.11343im        -0.205154-0.108477im       0.192335-0.00282472im      0.042441+0.023488im     0.00631905-0.104106im    -0.0474126+0.16542im       -0.0918671+0.0112713im
   0.0603295-0.0449063im    -0.150127-0.186752im      -0.201507+0.21826im      -0.0708459-0.278396im    -0.0539984+0.093388im      -0.244306+0.14738im        0.02903+0.0141789im     0.264213-0.212106im     -0.0143233+0.131629im     -0.134869+0.142444im       0.157994+0.0821578im    -0.0141893+0.148987im     0.00762171+0.0370769im   -0.0315822-0.136079im     0.056566-0.0223572im      -0.18869-0.16908im     -0.0186185-0.0476027im     0.137942-0.113411im    0.00313195-0.172984im     -0.00409615-0.103861im      -0.102162-0.0559842im     -0.110502+0.022091im      0.0393692-0.0346808im   -0.0176442-0.0204319im   -0.0579983+0.138356im      0.0404954-0.0154883im      -0.275023+0.322339im      0.0675515-0.00800739im    -0.0569152-0.00891947im     0.123056-0.0950626im    0.0107908+0.00682394im      0.127128-0.0308143im

and then generate the state $ψ$

psi = P[:, 3]
32-element Vector{ComplexF64}:
   -0.15220323377901707 + 0.05066034802534268im
   -0.22086716593290456 + 0.06534058858266494im
   -0.12957728311002806 - 0.061133859098731494im
    0.24989531249186658 + 0.056344534146864175im
   -0.23355022243292672 - 0.009271471983047674im
   -0.08094860101525186 + 0.03357223983690001im
    0.06622415615933405 - 0.09544132641517095im
   0.031035935625802043 + 0.10650246579541461im
   0.014897822194347154 + 0.1937113020045521im
   -0.05469825761932536 + 0.0128250870454635im
   -0.05279411347018903 + 0.22815977465743115im
   -0.20232700253621164 - 0.09452904474231866im
    0.11752511435939904 + 0.1571329162637559im
   -0.01208962122376183 + 0.06271183300778149im
    0.06587961670028475 - 0.12790931552667im
    0.30545988180532124 - 0.09328092107639056im
    0.08726473111091801 - 0.22442119697931462im
    0.11685320905242177 + 0.007523878972622064im
   0.031604434757637426 + 0.06329785155816864im
   -0.07374930411253186 - 0.08109036169300393im
      0.329913896344766 + 0.0im
    0.13942613014291255 + 0.07022053403349127im
   -0.09513442947886859 - 0.24575664744145803im
   -0.00652215747373941 + 0.01425090007594031im
  -0.052420584156922106 + 0.03337408674680469im
    0.12437285511422125 - 0.02261026069922352im
 -0.0035752123651027557 - 0.006272095782456589im
    0.15131741771402418 + 0.11066699636279287im
    0.11064927868718924 + 0.05887501724569436im
   0.007484103730081307 + 0.05943195496587929im
    -0.1519262727774155 + 0.14635367894983878im
     0.1586330723539135 + 0.02066399859714528im

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.