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.295222+0.0465778im  -0.0242492-0.156217im     -0.059953+0.103916im       0.090982-0.0924295im     -0.110752+0.00342537im   -0.0204063+0.0248384im     -0.0538835+0.151925im    -0.0752471+0.140078im       0.137351-0.0166264im    -0.209732-0.0563928im      -0.0112384-0.0633461im       0.186945+0.10898im        -0.110383-0.0911385im   -0.177343-0.143179im       -0.1371+0.114043im       -0.32972-0.0794053im      0.0488185-0.142622im      -0.10792+0.0260735im     0.0166636+0.00303595im   -0.228676-0.107572im     0.0455719-0.0694947im     0.0833485-0.0726646im    0.0766784+0.164802im    -0.0387345+0.116337im     0.0936064-0.240469im      0.0120891-0.0796003im    -0.0618073+0.243409im    0.0345647-0.0131306im     -0.151012+0.00868589im  0.00952843+0.197353im      0.224304-0.0122631im       0.151339+0.11896im
  -0.0384617-0.0850738im  -0.0340093-0.233762im     0.0936457+0.0958599im     -0.109456+0.0672755im    -0.0742436+0.08836im     -0.00168121-0.0994666im       0.244161-0.075016im       0.10235+0.0244625im     0.0809758-0.147401im      0.144015-0.110288im        -0.156516+0.0517604im         0.1075+0.138927im        0.136116-0.0316605im   0.0975766+0.160395im      0.189431+0.237263im      -0.222249-0.217543im      0.00243613-0.0912716im     0.149299-0.146684im      -0.113665+0.0112092im   0.00680638-0.173051im    -0.0813367-0.0516895im     0.0983357-0.11506im       0.178815+0.0837915im    -0.138307-0.0907622im    0.0836659+0.22557im       -0.121592+0.137141im     -0.0950247-0.0989799im   -0.132801+0.0874282im      0.102179+0.00249546im    0.274416-0.0953747im   -0.0104175-0.100126im      -0.0558312+0.0341942im
   -0.217703+0.126466im    0.0259333+0.110363im     -0.149405-0.107988im       0.194659+0.258774im      0.0375954+0.174941im      -0.261649+0.011429im       0.0503064+0.0153977im    -0.075167+0.131711im       0.048729+0.0152495im    0.0861502+0.195426im      -0.00781162-0.0613498im      -0.067952+0.0226876im      -0.118659+0.0116963im   0.0745285+0.25869im      -0.101514-0.154835im      0.0721596-0.0971558im     -0.0563108-0.0215552im   -0.0876369+0.00594207im     0.406378-0.12177im     -0.0380501-0.116442im     -0.203054-0.0157724im      0.087718-0.115423im    0.00374318-0.136995im    -0.0221007+0.0557209im    0.0832002+0.201895im      0.0397689+0.0830464im   -0.00510768+0.0275217im   -0.100992-0.00849553im    0.0487775-0.00271333im   0.0222064-0.0050584im     0.266634-0.0961612im     -0.0278225-0.152692im
   -0.187006-0.0644618im   0.0821899+0.107959im     0.0735847-0.219269im      -0.174415+0.0610231im     -0.029917+0.15369im      -0.0725067+0.0405718im     -0.0497697+0.0424339im   -0.0132508+0.159753im      -0.136143-0.0111249im    0.0674209+0.0704383im      -0.0183987-0.0811439im       0.106709-0.0435763im       -0.13992-0.254314im    0.0697749-0.202324im     -0.129044-0.0220359im     0.0533721+0.0664639im      -0.058603-0.199172im     -0.124521+0.186123im      -0.262882-0.188986im      0.124249-0.0904167im    0.0706021-0.274161im     -0.0838641-0.0769314im   -0.0582932+0.0475039im   -0.0282671-0.193179im    -0.0419012+0.124432im       0.075175+0.0324755im    -0.0373032-0.162924im     0.152468+0.0497473im     -0.209444-0.132984im      0.149823-0.0486298im    -0.154264-0.190053im       0.0568813-0.0701425im
   0.0640414+0.196379im    -0.069764+0.0383467im     0.152413-0.171623im       0.106738-0.0297857im     -0.191389+0.0857006im     0.0558728+0.038464im       0.0844843-0.107503im     -0.113456-0.0258511im     0.0999451-0.0179273im     0.134908-0.0658886im      -0.0113397-0.0632334im      -0.066065-0.00359851im    -0.0478176+0.0777029im   -0.157154+0.0242648im    -0.175012+0.0440582im    -0.0450228+0.00384458im    -0.0110942-0.23699im       0.124433+0.0983993im     -0.177185+0.236647im     0.0315619-0.0945127im     0.106032+0.0194524im     0.0316076+0.090738im     -0.030387-0.219796im      0.137357-0.16125im     -0.0443806-0.0122917im      0.211554+0.139951im     -0.0442224+0.288098im   -0.0534318+0.314605im       0.143951-0.184994im    -0.0421077+0.101677im     0.0616231+0.0694394im      -0.249012-0.10477im
  -0.0338859+0.0169071im   0.0371921+0.177721im    -0.0781987-0.220532im      -0.128693-0.103394im      -0.152486-0.108724im      -0.189808+0.333746im        0.249473+0.0934602im   -0.0544026-0.0583741im      0.051112+0.00266765im    0.167685-0.185344im         0.178611+0.00276974im     0.0989111+0.1277im         0.0816202+0.0609513im  -0.0982622-0.074317im      0.185778+0.101081im     -0.0228406+0.0589694im      -0.149536+0.0435036im   -0.0531926-0.000595704im  -0.0372994+0.0788338im    0.0355663+0.210033im    -0.0411343-0.076311im     0.00190039-0.103121im     -0.219537+0.0118684im    -0.236294+0.0457827im   -0.0548508-0.0631309im    -0.0376046+0.0776422im    -0.0887787-0.186271im    -0.132696+0.110903im      0.0290007+0.105405im      -0.21753+0.0147435im     0.246664-0.0828378im      0.0869053+0.0154039im
  -0.0816775+0.132671im    -0.129335-0.0726355im     -0.14233+0.0378017im   -0.00818321+0.16909im      -0.0241902-0.128276im      -0.116793-0.0972539im      -0.101586+0.182293im    -0.0780311+0.0934275im     -0.192914-0.020136im    -0.0668886+0.0277127im       0.0410483-0.128762im     0.000485549+0.0430695im     -0.0592437+0.175202im    -0.082536-0.132188im     0.0415065+0.156761im      -0.137232+0.122423im        -0.19467+0.141301im    -0.0122702-0.0981807im     0.0743501-0.187153im      0.174634-0.129978im      0.133632+0.127117im      0.0135497-0.0615865im    -0.048688-0.0710986im   0.00467263+0.0927547im    -0.242853+0.174493im      -0.206134+0.200302im     -0.0480426+0.0128374im   0.0624284+0.259917im     -0.0205659+0.0321783im   -0.0409042+0.120371im     -0.224778+0.107679im       -0.200678+0.218315im
    0.139656+0.0924956im  -0.0165841-0.0316285im   -0.0340909+0.192246im    -0.00903883+0.0909575im    -0.0553236+0.117433im       -0.13633+0.203749im       -0.341522-0.0566932im      0.24392+0.178524im     -0.0282229+0.0280375im   0.00203311+0.0652532im        0.182013+0.122302im        0.156427+0.00420015im   -0.00276102-0.10839im      -0.15586+0.0135709im    0.0451696-0.10037im       0.0638549-0.00543267im     -0.109217+0.0173215im      0.12843+0.154609im      0.0915961+0.079908im     0.0577258+0.065845im       0.14004-0.00392731im     0.035946+0.0801439im     0.190005+0.175212im      0.146451-0.289997im     0.0399024-0.0230908im     -0.110004+0.0174606im      -0.15534-0.0855962im   -0.139897+0.0592133im     0.0361438-0.0625109im   -0.0615087-0.172484im      0.211791-0.055352im       -0.125403+0.242756im
  -0.0146338+0.0843591im   0.0916213-0.0233123im     0.191003+0.0848783im    -0.0334113+0.0186942im     0.0194677+0.0967106im     0.0252116-0.130365im      -0.0837554+0.0643279im   -0.0629377+0.0470145im      -0.11197-0.0706037im     0.121702+0.000332377im     -0.163749+0.213271im       -0.365225+0.314506im      -0.0866109+0.0726357im    0.191984-0.020275im      0.332604-0.031531im      0.0702668+0.0413948im     -0.0740062+0.047366im    -0.0183735+0.270957im      0.0049771+0.0193771im     0.017474-0.0690085im   -0.0356732-0.114501im     -0.0361614+0.0599499im   -0.0946266+0.0335238im    0.0350917+0.0102453im   -0.0463633-0.0786034im     -0.141581-0.122738im      -0.232216+0.252483im    0.0619223+0.152754im      0.0116301+0.0224726im   -0.0916094+0.0759705im    0.0817841-0.107945im        0.220741+0.0291245im
    0.031484+0.0625312im   0.0225935+0.229212im    -0.0232322+0.15216im       -0.175284-0.036539im       0.372421-0.0326296im      0.139396-0.201579im        0.222867-0.0116543im   -0.0903937-0.104875im      -0.220797+0.0539783im   0.00521709+0.0357878im       0.0978412+0.105713im        0.228433+0.0485373im      0.0848105-0.0498235im   -0.158082+0.161851im    -0.0400892+0.00587791im    -0.139492-0.0568883im     -0.0613631-0.0528199im    -0.118469+0.206728im     -0.0638952-0.132671im     -0.163519+0.00979277im   -0.118857+0.0415776im     0.0708474-0.0185064im    0.0834412-0.0595458im   -0.0180837-0.103443im    -0.0833705+0.124916im    -0.00242148-0.11213im       -0.224746-0.0462459im   0.0827415-0.0500612im     0.0388135-0.228843im     -0.195603+0.143479im      0.110116+0.113821im       -0.117272+0.0273829im
  -0.0539908+0.0378227im    0.199261+0.0116838im    -0.106805-0.0717004im    -0.0319158-0.0161695im    -0.0345552+0.0544531im      0.146418+0.0655414im      0.0120573-0.159434im     -0.152248+0.033664im      -0.153065+0.310548im     0.0723438+0.110326im        -0.160121-0.0611043im     -0.0324556-0.118715im       -0.144149+0.200218im       0.1128-0.186177im      0.229578-0.0876804im    -0.0552914+0.00074574im      0.099226+0.0607854im    0.0818986-0.0817847im     -0.019822-0.0601886im   -0.0909365-0.118765im     0.0337514+0.0712915im    0.00712063-0.247794im      0.292444+0.062711im     -0.135717-0.25417im      -0.104435-0.2357im       -0.0442039+0.017878im       0.219045-0.117314im    -0.029615+0.0920987im     0.0811739-0.109694im    -0.0174481+0.0555532im     0.172111+0.139506im       0.0122353-0.0124437im
  -0.0860738-0.0578519im   0.0710413+0.0472749im    -0.024705-0.0993464im     -0.176499+0.155791im       0.222604-0.0438436im     0.0470783-0.0546815im     -0.0223435+0.0538796im     0.212385+0.209897im      0.0716116+0.0213297im     0.102696-0.125939im         0.160828-0.209919im       -0.122565+0.236475im      -0.0309437-0.068173im   -0.0454212+0.243728im    -0.0661402-0.0621955im   -0.00405651+0.0713387im      0.0134545-0.0352462im    0.0409749-0.0609989im     -0.168786+0.0501608im    0.0521517-0.0123021im    0.0641375-0.0471074im    -0.0364559-0.303767im     0.0543369-0.149308im      0.237675+0.134088im      0.150657-0.303078im      -0.062471-0.0714872im     0.0647063-0.0946733im     0.17376+0.0718539im      0.256907+0.1065im       0.0369785-0.00095017im   0.0139964+0.113344im      -0.0178578+0.0950385im
   -0.129532-0.129095im   -0.0245914+0.121009im     0.0888424-0.00455894im    0.0683597-0.207842im      -0.197878+0.135097im       0.120735+0.0717968im      0.0397214+0.117786im      0.131385+0.166219im      -0.253547+0.100758im     0.0383913-0.0219771im       0.0178157+0.0497746im       -0.11001+0.116858im       -0.064049-0.0856899im   0.0647874-0.00302883im   -0.129117+0.19732im      -0.0499809+0.000577801im      0.10546+0.160095im      0.101353-0.0135216im     0.0265439+0.121725im      0.188892+0.183696im     -0.199654+0.276803im      -0.100358-0.0230118im     0.144852-0.0766397im    0.0197434+0.193863im    -0.0839014+0.0437013im    -0.0403431+0.107514im      -0.103083+0.0164516im    0.196854-0.107518im       -0.17141-0.22461im        0.10056-0.144496im      0.210867+0.0775574im     -0.0990312-0.0286093im
  -0.0541382-0.0393421im    0.129373+0.0999346im    0.0800245+0.207587im       0.119543+0.0380505im     -0.112656+0.25568im      -0.0206552-0.106287im       0.0236661-0.0558494im    0.0527626+0.0705522im     0.0552868-0.223096im      0.183825+0.017044im         0.107212-0.175527im        0.167527-0.000230746im     -0.21703-0.0696953im   0.0827617-0.202221im     0.0498384-0.0517761im    -0.0721003+0.0770231im       0.173339-0.0491666im    0.0964608-0.074911im      0.0452514+0.0033356im   -0.0939167+0.220974im      0.069607+0.101741im     -0.0653343+0.0350756im    -0.130669-0.0734095im    -0.196923-0.13716im     -0.0834024+0.185323im     -0.0174267-0.213986im     -0.0618491+0.0281222im    0.184523-0.0610625im      0.253864+0.288317im    -0.0495381+0.0888402im   -0.0108702+0.16948im       -0.0654472+0.019594im
   -0.148335+0.0719815im    0.257711-0.10925im      0.0950359-0.0875771im    -0.0950419+0.0790738im     -0.172811-0.0211097im      0.159562-0.00990985im     -0.151034+0.025063im     -0.133996+0.010551im      -0.230398-0.210997im     0.0727826+0.104372im         0.155388+0.0931996im      0.0519419-0.0359741im       0.105132+0.235378im    -0.150124+0.209516im    -0.0326547-0.0571633im    -0.0895455-0.0303394im       0.267339-0.0487256im   -0.0664291+0.0796352im     0.0128568-0.019282im    -0.0943228-0.0245751im     -0.23678+0.0600523im    -0.0739246+0.10556im      -0.236409-0.0643905im   -0.0519584-0.115196im     0.0695765-0.164451im       0.029346+0.240453im      0.0680144-0.0538257im   0.0120882-0.0977436im   -0.00142679+0.0790022im    0.0595535-0.114012im    -0.0787439-0.0571076im    -0.00583356+0.285189im
    0.186705+0.0929148im   0.0418185+0.1505im       0.0329073+0.207303im      0.0434382+0.253282im     -0.0601632-0.0867164im     -0.026511-0.00587103im     0.0919828+0.121849im    -0.0503879-0.0783621im     -0.353836-0.157617im     0.0644238-0.105586im     -0.000540659-0.00448658im     -0.148622+0.127018im      -0.0788297+0.0327019im    -0.13062-0.0330363im    -0.085902-0.149936im      -0.242806+0.11128im         0.116937-0.0699691im     0.191148-0.245361im      0.0323751+0.102646im     0.0334534-0.0826531im     0.101695-0.0981038im      -0.15313-0.0518387im    0.0128911+0.10906im      0.0830671+0.039792im     0.0910293+0.0350111im      0.155091-0.186226im       0.065465-0.177834im    -0.192118-0.0184128im     -0.258817-0.0229307im   0.00348949+0.0565427im    0.0737757-0.10586im       0.00636806-0.132758im
  -0.0163753+0.100193im     0.234917+0.114249im      0.167156-0.0290954im     0.0221417+0.11822im      -0.0238729-0.00249762im     0.164424-0.0106148im      0.0496327+0.237385im     -0.073337+0.221768im      0.0184645+0.105158im    -0.0956302+0.111019im        -0.409266+0.137478im        0.209379+0.0795486im      0.0681068-0.281491im    -0.052229-0.046413im     0.0279498-0.0710152im     0.0223672-0.139986im       -0.164105+0.0973075im     0.105485-0.118455im      0.0340778+0.00677534im   0.0262782+0.212283im     0.0563485-0.0547604im    -0.0169702-0.0276088im   -0.0844494-0.153395im    -0.0407761+0.118329im    0.00555069-0.0534182im      0.125327-0.0146729im     0.0855439+0.0628874im    -0.26682-0.0146421im      0.124503-0.0444122im    -0.084212-0.0645267im    -0.158616+0.0316299im     -0.0764355+0.16941im
  -0.0257326+0.0417853im   -0.136356-0.214487im     -0.172638-0.0381553im     0.0384141-0.112182im       0.052359-0.104339im       0.177965-0.126103im        0.218606-0.00537548im  -0.0615563+0.184842im     0.00497444-0.173859im    -0.0126724+0.163359im        0.0423151-0.195511im       -0.057032+0.200535im       0.0982955-0.121631im    -0.108359-0.0479389im    0.0120734-0.0562783im     0.0963906+0.201748im      -0.0454247+0.0905601im   -0.0824194+0.0155748im     0.0547671-0.00743428im    0.195228+0.0777919im   0.00111708+0.0585468im     -0.265251+0.0721385im    0.0814104-0.0533938im    -0.209619-0.338449im       0.35834+0.00944137im   -0.0840596+0.00345194im    0.0700703+0.115581im    -0.118795+0.00804278im   -0.0815198-0.0720235im   -0.0782743-0.0317853im    0.0268585+0.0537378im      0.0541537-0.0575032im
  -0.0716412-0.0442583im  -0.0389605-0.0943891im    -0.248778-0.021734im     -0.0397615+0.114665im      0.0956011+0.0911315im     -0.106662+0.0943871im       0.164122-0.0397049im    -0.144932-0.0733367im     -0.119157-0.151275im    0.00710004+0.110308im        -0.206921-0.0407833im       0.128121+0.0344545im      0.0606888+0.190161im      0.06882+0.0107014im    -0.171714-0.141573im       0.150406-0.0412821im       0.202213+0.0581038im    0.0140387-0.0784367im     -0.264324+0.0990615im     0.025337+0.263434im      0.105923+0.0204281im      0.279162+0.0136272im    0.0773861-0.115384im      0.108289+0.0267636im   -0.0660779+0.0215927im     -0.102642-0.186556im     -0.0808392+0.152111im    0.0420313+0.182447im      -0.194424+0.0487352im   0.00135425-0.233967im     0.0755082-0.0521285im      0.0990982+0.181498im
    0.102511+0.0734216im   0.0183836+0.118601im    -0.0663902-0.162431im      0.0443316+0.0668511im   -0.00904499+0.186601im     -0.0797086-0.0957028im     -0.0495825+0.162654im     -0.140076+0.116098im       0.140022-0.0912286im    -0.165438-0.0726322im       -0.142097+0.119462im       0.0045171-0.0963261im      0.0527044+0.0570145im    0.248827+0.165062im     -0.061576+0.00887788im    -0.256325+0.10795im        0.0716734+0.11388im      0.0209262-0.0272706im     -0.231501-0.00423502im    0.128156+0.0263063im    0.0695877-0.0841558im   -0.00167544+0.247187im      0.160323+0.0775043im   -0.0187453-0.0590616im     0.142165-0.0721521im     -0.171333+0.184823im      0.0120791-0.133128im     0.160928-0.167541im      0.0247562+0.107494im     -0.315088+0.139513im     0.0962264-0.0727524im      -0.156455-0.0999326im
   0.0557303-0.156068im    -0.208512-0.15421im      -0.197171-0.0516978im     0.0328215-0.222412im     -0.0606707-0.0134301im     -0.194015-0.0705445im     -0.0178872+0.0596409im   -0.0946994-0.0698577im     -0.162274+0.120095im    0.00857832+0.0863825im      -0.0638445+0.0380282im     -0.0446609-0.1137im        -0.0360956-0.144051im      -0.1165+0.0872907im     0.165898-0.162015im     -0.0394721-0.114182im     0.000992489-0.110967im      0.169405-0.150996im      -0.160565-0.170367im      0.149204-0.0135426im    -0.199703-0.114824im      -0.246243-0.136044im    -0.0943669-0.0258392im    0.0782325-0.0616335im     -0.10202-0.0759992im      0.121159-0.102728im      -0.109246+0.200898im     0.052961-0.149225im       0.134588+0.167743im    -0.0390966+0.028842im      0.107829-0.169873im       -0.227537+0.127333im
   0.0679249-0.132063im    -0.201878+0.052487im    -0.0135866-0.120723im    -0.00573743-0.0702481im       0.23217-0.098718im      0.0625217+0.0527215im      -0.181287+0.123778im     -0.212378+0.0627385im     0.0963798+0.0168072im     0.199356-0.152941im        -0.158641-0.000608041im      0.29677+0.0113849im     -0.0854122+0.111954im      0.13059+0.0281402im   -0.0130083+0.047115im     -0.0763103+0.179296im        0.283815+0.00311497im    0.044031+0.30764im        0.204596+0.0943846im     0.158702-0.0440509im   -0.0906556-0.0903757im     -0.204582-0.0147874im     0.112451+0.0440928im    0.0316877+0.0810172im    -0.021573+0.113748im       0.137339-0.0657494im    -0.0131915-0.0309138im   -0.192561+0.0977605im     0.0257771+0.110155im      0.130612-0.00136781im   0.0162906+0.123825im       0.0110197+0.132097im
   -0.290818+0.144047im    -0.179501+0.199332im      0.133513-0.182949im      0.0918154-0.0118446im      0.283894-0.101215im      0.0598591+0.115069im      -0.0524189-0.158326im      0.183993+0.115727im      0.0241336+0.0320899im    0.0156556+0.230443im       -0.0235643-0.0847162im     -0.0712333-0.0249756im       0.206517+0.0402723im   0.0288085+0.0276986im     0.143811-0.0292076im    -0.0931284-0.136095im         0.13169-0.0503305im     0.150571-0.26307im       0.0324319+0.0196718im   -0.0177113+0.162409im    -0.0289674-0.0891817im    -0.0759636+0.217506im     -0.103361+0.209737im     0.0237271-0.0686116im   -0.0645786-0.0526088im     -0.016627-0.00493312im    -0.188469-0.0347791im  0.00896202+0.127383im      -0.162584+0.0278026im     0.100379+0.224919im      -0.03844+0.0672666im     -0.0359189-0.0020705im
    -0.19305-0.156022im    -0.023232-0.0525181im    -0.161856+0.0695797im      0.295465+0.11012im       0.0272167-0.192634im       0.196393+0.120927im     -0.00367721-0.0536761im   -0.0180845-0.0741329im   -0.00666963+0.16189im      -0.090826+0.123922im        0.0989659+0.0952435im     -0.0364051+0.193699im       -0.172657-0.0206667im  -0.0527146+0.144562im      0.197231+0.0455625im     -0.201093+0.165098im       0.0618255-0.0929688im     0.111335+0.156693im     -0.0939504-0.0707728im    0.0900234+0.0926148im     0.182697-0.173404im       0.198633+0.225096im    -0.0958063-0.0443259im    -0.132845+0.0879677im   -0.0322638+0.0851482im     0.0555388-0.0436233im      0.162642-0.0711667im   0.0860683-0.0150647im      0.178435-0.122505im     0.0417388-0.193424im      0.015906-0.122317im      -0.0743082-0.0742421im
   0.0574382+0.121782im   -0.0271176-0.130163im      0.104032+0.0590618im     0.0131339+0.121765im        0.11494-0.0856553im     0.0128138+0.178943im      -0.0580555+0.228947im     -0.304881+0.201596im      0.0324377-0.0979283im     0.200336-0.0337241im        0.196406+0.056743im        0.166012-0.0940513im     -0.0977707-0.0531876im   0.0144214+0.12494im       0.283573+0.159967im       0.255713-0.102704im       0.0610529+0.0274442im     -0.20816-0.276032im     -0.0830735+0.0251035im     0.021999-0.103902im      0.119859+0.0923395im    0.00536309+0.0814761im    0.0436677-0.00752404im  -0.0238485+0.00789432im  -0.0641378-0.126819im      0.0482316-0.14508im      -0.0619038+0.0723307im    0.123408-0.113572im     -0.0501505-0.13978im      0.0899693-0.0504742im    0.0336758-0.000847406im    -0.121236-0.219649im
    0.153743-0.0583725im  -0.0989858-0.0574251im    -0.129844-0.0695776im     -0.102706-0.0303144im    -0.0123018+0.00781856im     0.148278+0.063347im         0.14249+0.21683im     -0.0800557-0.151825im     0.00408729+0.084774im      0.157969+0.253295im        -0.112655+0.0591366im      0.0209306-0.0590152im      -0.185252-0.125864im    0.0511769-0.00489633im  -0.0118538-0.118636im      0.0186443+0.00925197im    -0.0198231-0.21745im      0.0865959+0.0329961im        0.1915+0.191879im     -0.258469+0.0302783im     0.217008+0.15205im      -0.0660043-0.0191969im    -0.177239+0.10174im      0.0620319+0.103481im      0.230163-0.0381825im     -0.306153+0.188349im      -0.145472-0.125904im     0.180887+0.0524501im    0.00322811-0.0309958im     0.110243+0.0745084im   -0.0426938-0.076977im       -0.088542+0.026495im
   0.0574417-0.192928im     -0.16702-0.0168712im   -0.0661786-0.0382123im     -0.173744+0.268896im      -0.191823-0.0149725im      0.242425-0.0690798im      -0.211198+0.0699465im     0.247455-0.00355089im   -0.0940706+0.0752822im    0.0428453+0.190261im        0.0236409+0.066849im          0.1769+0.038202im     -0.00188523+0.318393im     0.158045-0.113002im    0.00266033+0.123661im      0.0428854-0.0391787im       -0.14828-0.0550132im    -0.199548-0.0989325im     -0.134277-0.0158688im   -0.0105693+0.166803im    -0.0985758-0.0244798im   -0.00430834-0.0207874im   -0.0382293+0.00351734im   0.0431454+0.0396317im     0.232206+0.104831im       0.169548-0.073009im      0.0295939+0.118663im   -0.0793696+0.0182429im     0.0683042-0.00102847im  -0.0435318+0.230438im      0.169336-0.0441394im     -0.0437079-0.119366im
   0.0604509-0.240193im     0.211183+0.0543408im    -0.213347+0.122163im      0.0548769+0.0331251im     0.0844074+0.140345im     -0.0493831-0.0161758im      -0.122841+0.0322641im    0.0842005+0.00407549im    0.0451924-0.0283716im     0.207182-0.0421387im      -0.0346572-0.136568im       0.0100484-0.0256639im      0.0708517-0.156811im   -0.0831368+0.0390204im     0.189114+0.104247im      0.0216493+0.139758im        0.127828-0.18766im     -0.0385689-0.0828223im    -0.0829858-0.0524424im    -0.184816+0.0648455im    -0.185732-0.119379im     -0.0767925+0.0719037im   -0.0401614+0.0634707im     0.134647+0.111818im    -0.0895103+0.0270526im     -0.208182+0.239956im       0.200197+0.23113im     -0.183694+0.116264im       -0.19864-0.165091im      -0.21965-0.0342885im   -0.0494637+0.128691im      -0.0418188-0.0982448im
   0.0239244-0.059967im    0.0479517-0.188629im      0.147927-0.109599im    -0.00322619+0.127212im     -0.0760941-0.0533368im    -0.0474675+0.222504im        0.122997-0.153283im    -0.0387253-0.0676451im     0.0198513-0.106681im      0.272379+0.221872im       -0.0179184-0.10811im        0.0243643+0.0304689im       0.177984-0.0445495im   0.0231797-0.132176im     0.0166831+0.0309769im    -0.0879582-0.0362713im      -0.199458-0.11143im      0.0698033+0.0786342im      0.112002-0.0590504im    0.0410618-0.130438im    -0.0592545-0.037503im      -0.105746+0.23786im       0.303262-0.106514im      0.132945+0.241597im    -0.0280031+0.0106379im     0.0192066-0.164059im       0.150896-0.0768656im    0.215996-0.150601im     -0.0347765-0.0346054im    -0.233543+0.0928749im     0.020207+0.0279873im      0.0196264+0.220717im
 -0.00592508-0.0587838im   -0.195608-0.0905934im     0.222709-0.0125421im     -0.124962+0.306756im    -0.00160529-0.0575445im     0.0536909+0.131299im        0.106563-0.00582451im    0.107388+0.00280233im     0.187801+0.022944im     0.0483155-0.0513224im       -0.246244+0.0584636im      -0.112108-0.0257554im      0.0483963-0.0772895im   -0.118068-0.072262im    -0.0954393-0.0142308im     0.0196482+0.354325im        0.182832+0.0398526im   -0.0187233+0.017773im      0.0844676-0.164542im     0.0104154-0.0609896im    -0.182866+0.142862im       0.231783-0.170065im     -0.186063+0.212656im     -0.082114-0.137796im    -0.0813728-0.091631im    -0.00877032-0.0849856im    -0.0171431+0.0792401im   0.0868313-0.0982511im    -0.0471331-0.0444764im    -0.157024-0.0730871im    0.0559335-0.0279331im       -0.25144+0.0152405im
   -0.032541-0.0534384im   0.0499292-0.00230223im   -0.103596+0.0592072im    -0.0395997-0.00799368im    -0.161962+0.119483im      -0.112323+0.265927im    -0.000716789+0.0420823im     0.136241-0.0645448im     0.0485308-0.0137253im   -0.0472906-0.056126im       -0.0797277+0.181034im       0.0622773+0.0435939im      0.0956923+0.156663im    0.0330381+0.243964im      0.107213-0.171755im      -0.100296+0.0204006im     -0.0452579-0.238876im    0.00817041+0.105233im      0.0861562-0.135031im      0.230114+0.0379988im     0.129904+0.0624249im    -0.0121147-0.120846im   -0.00425904-0.19889im      -0.114107-0.0775605im    0.0502317-0.127121im     -0.0550824-0.129475im      -0.102324+0.077634im   -0.0153628-0.138691im      -0.210224-0.0879266im     0.102543+0.183627im      -0.25795+0.36529im       0.00311693-0.125413im
    -0.25912+0.298599im   -0.0539037-0.177711im    -0.0905978+0.0110634im     -0.204904-0.013093im      -0.151892+0.00221907im    -0.025792+0.0427075im      0.0406456+0.0620718im    0.0659706-0.163037im      -0.144082+0.136691im     0.0717103-0.22359im          0.096399+0.123512im       -0.106028-0.0656206im      0.0616943-0.164811im     0.171872+0.0473832im    -0.085429+0.09914im        0.155813+0.0474686im        0.23255+0.131576im    0.00724151+0.00453825im      0.14429-0.0260546im     -0.18739+0.167702im     0.0861762-0.348283im     -0.0715884+0.0415673im     0.134784-0.0464275im   -0.0200775+0.00150784im   0.0823312+0.101441im     -0.0414951-0.114165im       0.116963+0.0710107im  -0.0163358+0.0283145im     0.0716441-0.0685793im   -0.0284162+0.14467im     -0.0875063+0.0227155im      -0.217065+0.0681397im

and then generate the state $ψ$

psi = P[:, 3]
32-element Vector{ComplexF64}:
  0.010569156621101045 - 0.004932353595830744im
  -0.03378034357044643 - 0.0635568534528003im
  -0.06060956892081102 - 0.030079824369597732im
  0.051672561941616034 - 0.05767309815472583im
 -0.057176674446597325 + 0.07483003487623384im
   0.04669379122362164 - 0.07307558377986768im
  -0.11656203003757498 - 0.03123826589395969im
 -0.029428375478164678 + 0.007275814836469886im
    0.3867709257485541 + 0.0im
 -0.004041957964722448 - 0.2840647234435855im
  -0.15458248906773592 + 0.2300501095462852im
   -0.1266830595315796 + 0.1391421982212812im
  0.004695219256071152 - 0.0635096330915735im
   0.08884196631603039 + 0.21265554757844116im
   0.22577219116478003 - 0.17252518282368964im
   0.07888775706763915 - 0.11239869168846732im
   0.15111219060775036 + 0.0032635539634263766im
   0.10320841716182187 + 0.12452000754670565im
   0.09996179949875568 - 0.019493649378616366im
 -0.019375990545901587 - 0.01739728627626541im
    0.1753709582439439 + 0.03621173487432327im
  -0.19786100801558187 + 0.07840671013078554im
  0.030083210598887127 + 0.1671557698183287im
 -0.015365011697603088 + 0.07911453300154593im
   0.18504707375660057 + 0.16919349222839974im
   0.05919107102793313 + 0.19634748239549596im
  -0.14733121188716006 + 0.06859797477563846im
   0.22856172478654344 - 0.11354492679979299im
    0.1756133145305634 + 0.0813995882096004im
   0.13045066122458882 + 0.08000629073632386im
   0.10339643315329784 - 0.02500150668745882im
  -0.10558884086187185 - 0.019170950738718988im

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.