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.126038+0.124941im      -0.133207-0.0930214im    0.0875693+0.0376421im      0.101674+0.0759251im   -0.0899031+0.0237903im    -0.0267412+0.146733im        0.21191-0.010244im   -0.00891278+0.113332im     0.0715762+0.0731262im       0.101431+0.0783047im    -0.0945745+0.0127201im    -0.00890017+0.075097im    -0.00282607+0.102372im      0.0889384-0.178936im     -0.0352706+0.0468488im      0.224862+0.0354405im   -0.0850746+0.0443186im     0.159558-0.295089im       -0.20156+0.20164im      -0.0472551-0.153511im      0.0401413+0.14451im         0.10164-0.0710377im      0.12134-0.0830934im     -0.0174529+0.0617756im   -0.0301324-0.16371im       -0.126063+0.0205452im  -0.00616883+0.270591im       0.0317407+0.192078im    -0.00042281+0.028329im      -0.157488+0.106533im     -0.195263-0.141685im      0.365632-0.0650629im
   0.0999027+0.0672407im     -0.189043+0.206168im      0.131064+0.133893im     -0.0927943+0.144105im     -0.147162-0.0847636im     0.0792474+0.0199602im      0.055147-0.0736153im      -0.1626-0.0287419im   -0.0230529-0.225764im      -0.0612884-0.0380003im    -0.0254643-0.0262817im     -0.0750411-0.0633839im      0.176691+0.205179im      0.0961551+0.014353im     -0.0159406-0.0595941im      0.174376+0.081034im     0.0974187+0.226296im    -0.0555589+0.0482576im     0.0906136-0.000304531im  -0.0513421+0.0719886im      0.025778-0.327893im     -0.0385097-0.0486552im     0.140893-0.135549im       -0.233016-0.0223421im    -0.152814+0.130333im       0.182322-0.122284im     -0.261881+0.023376im      -0.0832434+0.142757im     -0.0649025-0.0296144im       0.13927+0.00125613im    0.263159-0.020019im     0.0978452-0.0664226im
    0.186927+0.189583im     -0.0965877-0.149im         0.041683+0.0128568im    -0.0643443+0.0761321im     0.047675-0.0297212im      -0.14669+0.0508695im     0.0346768+0.0475355im     0.220056-0.0151118im    -0.186236+0.10157im       -0.0861037+0.00873853im   -0.0154377-0.255007im        0.126552-0.0916272im    0.00525009-0.167913im       0.169233-0.0200097im      0.150939-0.0271572im     0.0890941-0.165512im     -0.109455-0.0991208im   -0.0192943-0.145205im      0.0786289+0.154764im      0.0543869-0.00403264im    -0.170276-0.045061im       0.107364+0.229272im      -0.11405-0.110636im       -0.072837+0.15552im     -0.0820234+0.0226305im      0.185006-0.0879677im    0.0387568-0.0523956im     -0.0617647-0.241268im      -0.251624+0.127325im       0.212157-0.0904959im   -0.0095365+0.236104im      0.124188+0.0489563im
    0.078551+0.0779366im     0.0553083+0.110406im     0.0769507+0.0634681im    -0.0795541+0.274935im     -0.306712-0.143585im     -0.0210554+0.127976im      -0.105468+0.0990685im     0.155498-0.215988im      0.144254+0.0597946im     -0.0206661+0.090761im      0.0321205-0.189082im     0.000418279+0.0430513im    -0.0420543-0.203851im      -0.109797+0.0759159im      0.108847-0.0277607im    -0.0338041+0.0754184im   -0.0646149-0.172124im    -0.0614186-0.0888116im     0.0929515+0.0807266im      0.084003+0.0987889im      0.280773+0.103859im     -0.0649236-0.00101794im    0.104832-0.160326im       -0.183688-0.0161845im    0.0371814+0.0073219im     -0.226802+0.206005im     -0.023611+0.0381741im      0.0778008+0.12083im      -0.0321612+0.0984817im      0.111949-0.0408676im   0.00130529-0.215268im       -0.2716+0.0094435im
   0.0645893+0.193413im     -0.0617209-0.325668im      0.214684+0.115855im      -0.026991+0.0482334im   -0.0242987+0.188781im       0.108848-0.262851im      -0.101826-0.283603im     -0.119511-0.176704im     0.0493675-0.100962im       0.0363695-0.164707im     -0.0854745-0.0529092im      0.0144121-0.123124im      0.0279155-0.129356im       0.088088-0.064137im     -0.0444125-0.188163im      -0.152742+0.0881438im    0.0582776-0.0311897im    0.0737356+0.0760435im    -0.0621578+0.0652978im     0.0994748+0.0670198im     0.0029087+0.231775im      -0.155581+0.0743387im     -0.05196+0.0335295im      0.0123745-0.208133im     -0.185416-0.0275094im     0.0660022-0.220688im      0.139596+0.0138213im       0.126214+0.233497im      0.0485284+0.104569im      0.0287075-0.0457489im   -0.0572173-0.007473im    -0.0367446+0.00487075im
   -0.153731+0.0712334im     -0.142377-0.0180598im    0.0123988+0.121776im     -0.0627376-0.037744im    -0.0892749-0.0780442im    -0.0946406+0.297959im       0.099867+0.0911979im   0.00183533+0.0765782im    -0.180659-0.0634781im     0.00986396-0.193524im      -0.176683+0.214395im       0.0478646+0.06458im       0.0443642+0.0447483im     0.0811713-0.0294343im     0.0324961-0.12216im     -0.00831187-0.134459im      -0.14833-0.0350595im   -0.0121668+0.131631im      -0.239595-0.0474269im    -0.0842438+0.16646im      -0.0163735+0.0338656im    -0.0760603-0.0246125im   -0.0360114-0.0983111im     -0.0349861+0.071974im     -0.245286+0.153547im       -0.09741-0.0655516im   -0.0406265+0.0546377im      0.0971523-0.168252im       0.151608+0.307088im      -0.191735+0.175533im    -0.0454498+0.0492784im    -0.298979+0.109492im
 -0.00519197-0.113653im    -0.00134143-0.0380048im    0.0445911-0.0959794im      0.047273+0.235007im      0.212356-0.123192im     -0.0667946-0.144092im       0.027967-0.0276374im     0.155204-0.109766im    -0.0671798-0.0170499im       0.173002-0.11877im      -0.0135671+0.00131797im     0.0628506-0.179111im      0.0251874-0.241403im      0.0976295-0.141173im         0.2207-0.0796846im     0.0658672+0.0748886im     0.152928-0.0690309im     -0.16009+0.0331124im     -0.234378-0.0420144im     0.0223335-0.185468im    -0.00674621-0.0689987im     0.0128199-0.388854im        0.1019-0.175349im       0.0273354+0.0721603im    0.0366877-0.0261603im     0.0312325+0.0254607im   -0.0346607-0.140117im        0.111299-0.0972287im      0.263133-0.0816932im     0.0504267+0.150001im      0.138928-0.083423im      0.109873+0.141354im
   0.0726813-0.0597442im     0.0958412-0.0157587im    -0.102627+0.155955im       0.059201+0.148841im     -0.196323-0.00709235im    0.0692723+0.0935914im     -0.109333-0.0350462im    0.0269739+0.271967im       0.11268+0.0700399im       0.180173+0.0721245im     0.0360584-0.061736im       0.0558691+0.109434im      0.0835698-0.0493866im   -0.00701429+0.0499672im     -0.104897-0.0660536im      0.141496+0.369907im    -0.0916104-0.108971im     -0.183164-0.169209im     -0.0341639-0.164767im      -0.043591+0.075007im      0.0132756+0.00767752im    -0.234229-0.108432im      -0.16254+0.0782527im     -0.0113501+0.0391282im   -0.0155146+0.0134412im     -0.114281-0.36176im      0.0281494-0.0419463im     -0.0488367-0.123414im        0.11517-0.102622im      0.0448805-0.0727331im   -0.0306543+0.313953im     0.0749592+0.0376712im
  -0.0767896+0.0345538im     -0.126275-0.125443im     -0.107189-0.0727803im     0.0349212-0.0970454im    -0.157045-0.00381951im     0.104335-0.298573im      0.0757083-0.0160039im    0.0547016-0.106251im    -0.0930596+0.181822im        0.163003+0.265706im      -0.163578-0.0227348im       0.131068-0.0551275im      0.025115+0.110718im     -0.0430181+0.139731im      0.0147422-0.0553292im    -0.0644837-0.0403188im     0.204303+0.0626371im    -0.120448-0.00816522im   -0.0257493+0.0349497im     0.0334634-0.197794im      0.0756485+0.0143595im    -0.0912685+0.166219im     0.0731538-0.0641698im      -0.330797-0.0786912im    0.0490638+0.101779im     -0.0483185-0.114839im    -0.0557469+0.161706im       -0.184272-0.343284im       0.115785-0.0402503im     -0.128764+0.0980055im   -0.0703493-0.0806559im   -0.0728525-0.149861im
   -0.030097-0.107857im    -0.00198545-0.0536025im   -0.0601772+0.176735im     -0.0185213-0.053775im     0.0362625+0.11168im      -0.0616407-0.0594472im     -0.199952-0.178164im     -0.104138-0.0742248im    -0.131379+0.0997657im     -0.0910156+0.131373im      -0.292406-0.0611262im     -0.0805617+0.0904415im      0.259155+0.0169306im    -0.0767405+0.00107048im   -0.0062703+0.040788im       0.150809+0.0594457im     0.101372-0.00846415im   -0.160489-0.274744im      0.0251637+0.223873im      -0.208842+0.0639061im    -0.0282656+0.136513im     -0.0536109-0.0287075im   -0.0695198+0.159579im        0.139458+0.0514674im   -0.0914961+0.0218801im     0.0971574+0.256342im     -0.114353-0.017517im      -0.0279197-0.0815924im    -0.0428366+0.00148688im   -0.0616595+0.00484854im    0.169038-0.15909im     -0.0611151+0.354458im
    0.315126+0.00151725im     0.131373-0.00975937im   -0.071924-0.0730831im      0.197391-0.0433303im    0.0164979-0.152395im      0.0762189-0.0540815im       0.14717+0.120271im    0.00847914+0.080839im      0.226467+0.0285122im      0.0864125-0.121284im     -0.0714332+0.153123im       0.0326219-0.174001im      0.0371679-0.130597im      -0.123904-0.0729312im   -0.00846112-0.0637989im     -0.130161+0.062176im       0.14908+0.203219im     0.0211273+0.0561455im     0.0317284+0.0988661im     -0.103851+0.227325im      -0.177797+0.171488im     -0.0354836+0.00398341im    0.234763+0.161077im       -0.245572+0.133292im    -0.0149074-0.016371im       0.008509+0.0498321im    -0.203589-0.00320118im      0.155827-0.0670795im      -0.23042-0.0299073im    -0.0565399-0.0199364im   -0.0917734+0.129356im    -0.0640762+0.192033im
   0.0480684-0.0146665im     -0.045024+0.127912im    0.00351815-0.0984325im  -0.000680635-0.0977457im   -0.0616629-0.0175383im      0.065022+0.0131719im    -0.0743917-0.0613952im     0.185653-0.176699im    -0.0405175-0.177462im       -0.121565-0.203862im       -0.18785+0.0155358im       0.107583+0.113395im       0.118515-0.0478261im     0.0611051+0.00649077im     0.214228-0.0330884im   -0.00388645+0.339501im     0.0620962-0.0495224im    0.0653552+0.0321117im      0.131248-0.0390162im    -0.0271742+0.133466im      -0.109927-0.0716598im     0.0817271+0.0397916im    -0.285769-0.00353996im     -0.047065-0.185001im      0.224664-0.0128411im     -0.144773+0.0523764im    -0.109991-0.137871im      -0.0957466-0.0305305im    -0.0993531+0.106283im      -0.240042+0.206458im     -0.218695-0.0507438im     0.245522-0.0660732im
   0.0240691+0.156438im      -0.164719+0.245873im     0.0158521-0.125251im      -0.178482-0.105976im    -0.0498265+0.020199im    -0.00306843-0.0412661im     -0.073026-0.141327im     0.0763863+0.0500329im    0.0156851+0.0247589im       0.281134-0.0347963im    -0.0926703+0.0140993im      0.0157977+0.330886im      -0.167914-0.0570289im    -0.0151015-0.0255018im      0.148106-0.109622im      -0.172363+0.0129006im    0.0272023-0.0896682im     0.106615-0.0370734im     -0.177022-0.0531638im     0.0475042-0.0178269im     0.0102109-0.00373177im    -0.222307+0.140463im    -0.0035619+0.17126im       -0.0115344+0.208992im     0.0679956-0.0255236im      0.206432+0.225926im     -0.143912+0.0778335im       0.165164+0.035185im      0.0798588+0.00739626im   -0.0341205-0.152606im       0.24548+0.133237im      0.134085-0.111945im
  -0.0861513+0.264146im      0.0972305-0.196258im     -0.113622+0.218481im       0.191191+0.160323im    -0.0941909-0.0194382im     0.0342968-0.22483im       -0.137299-0.192087im      0.183385+0.125911im    -0.0569193+0.0491161im     -0.0482618+0.00874738im   -0.0465348+0.20835im        -0.107524+0.0613291im    -0.0993881-0.0826737im     -0.203057-0.0226073im    -0.0341133-0.0748047im     0.0203959-0.0712199im    -0.222389+0.0414596im     0.108481+0.0500588im      0.107743-0.137274im      -0.147316+0.0401854im      0.115594-0.0425564im       0.34708-0.0930467im    -0.100317-0.131467im        -0.09974+0.0526734im    0.0960096+0.106941im       0.105531+0.0493128im   -0.0555215+0.0131313im       0.123313+0.00100556im   -0.0784537-0.096916im      -0.141601+0.088633im      0.190601+0.0418211im    0.0329498-0.0847319im
  -0.0429747-0.116411im     -0.0135618+0.237351im     -0.113512+0.235136im      0.0658415+0.155794im      0.275367+0.111727im     -0.0560516-0.104832im       0.155033-0.0497169im     0.277148-0.0208981im     0.144184+0.125499im       -0.114645+0.109538im     -0.0464736+0.117343im      -0.0990615+0.0464826im     -0.255024+0.0745377im      0.135186-0.129223im     -0.0656848+0.126515im        0.12429+0.0300095im    0.0129911+0.00815696im   0.0400326-0.0412989im     0.0307818+0.0811563im     0.0800471+0.0124638im    -0.0567754+0.0162026im     -0.333462+0.0523159im   -0.0607065-0.0966277im      -0.204586-0.0851395im     0.113502+0.0282991im      0.233064-0.0885499im    0.0862469-0.118107im     -0.00620958+0.142909im     -0.0305855+0.17127im       -0.132633+0.077483im    -0.0313671+0.00740627im   -0.141212+0.0596893im
  -0.0435587-0.186359im     -0.0423081-0.0332577im    -0.116387+0.116531im     -0.0546321-0.100023im    -0.0253451-0.0451868im    -0.0363424+0.0229635im      0.202116+0.0505261im     0.162767-0.00811997im   -0.309282-0.0150265im     -0.0751486+0.0946504im     -0.109132-0.00321267im      0.214207+0.10942im      -0.0988517-0.0396616im     0.0912548-0.23825im       -0.185957-0.0592644im     -0.258975+0.141181im     0.0813445+0.0933815im    -0.182912+0.10892im      -0.0310835-0.0935502im     -0.097736+0.0488954im       0.25565-0.0472521im     0.0593834+0.0768969im    -0.114895+0.101568im      -0.0899704+0.0881747im   -0.0627346-0.0972385im    -0.0620436-0.0721133im     0.119138+0.0744181im       0.183277+0.177171im       -0.18605-0.154086im       0.239571+0.0322694im    0.0252268-0.148461im       0.10542+0.0872159im
  -0.0158599+0.141668im      -0.113938-0.100572im     -0.246004-0.147308im       0.163858+0.0605418im    0.0194578-0.173144im      0.0339217+0.0999552im    -0.0598922-0.208326im     -0.157545-0.139849im     -0.216523+0.0850653im       0.142444-0.0429107im     0.0424611+0.0582226im   -0.000946181+0.204871im      -0.118897-0.180671im       0.141401+0.0476135im     -0.171318+0.178075im      0.0899198+0.0831941im    0.0688221+0.269748im     -0.142274-0.115156im    -0.00949437-0.0602242im      0.142468+0.236215im     -0.0990322+0.00564188im    0.0250502+0.190192im      0.175642-0.20867im         0.139326+0.0696627im    0.0391811-0.0981057im    -0.0168159+0.0127554im    -0.024451-0.221546im      -0.0795472+0.107953im      0.0540151-0.0149613im    0.00524952+0.0133211im   -0.0650931-0.0302388im    -0.116608-0.0706217im
  -0.0382867-0.192848im      -0.249177-0.0965802im    0.0437657-0.238957im      0.0979525+0.0183793im    -0.278683-0.292687im      0.0519428-0.153258im     -0.0450457-0.0633125im    0.0595116-0.0210755im     0.134928-0.00993736im     -0.196626+0.10474im        0.157623+0.142632im        0.190597+0.177238im       0.167275-0.0836578im     0.0343696+0.025151im     -0.0203096+0.133308im       0.051887+0.0804653im    -0.213696-0.0862345im    -0.043225+0.185467im     -0.0560341+0.143621im     -0.0186394-0.220182im      -0.164939-0.0391823im     0.0225769-0.0328573im   -0.0069478+0.125214im      -0.0430307+0.109504im     -0.103486-0.0112526im      0.202359-0.0114802im     0.156389+0.00404589im    -0.0327859+0.178998im     -0.0416782+0.0500196im     -0.124444-0.0268732im    0.0326241+0.0235488im    -0.106578+0.107868im
    0.261142-0.157993im      0.0266485+0.0227103im   -0.0825092+0.0865828im     -0.114361-0.0596173im   -0.0175963-0.203159im       0.158582-0.194665im      0.0437911+0.116051im    -0.0456194-0.124307im     -0.190764+0.0430323im       0.302726+0.127686im     -0.0495898-0.0629243im      -0.202574-0.0360636im    -0.0822658+0.145226im      0.0939273+0.236885im     -0.0692431+0.0478175im     0.0324302-0.0561075im    -0.214777-0.233263im     0.0122752+0.103973im      -0.028387+0.248551im     0.00958778+0.208556im      -0.153407-0.0738764im     0.0750679-0.00118825im  -0.0358173+0.0179415im       0.092887-0.0907682im    0.0759103+0.105537im     -0.0698568-0.0439668im    0.0473348+0.000748204im     0.262087+0.116071im      0.0410809-0.0238103im    0.00697798+0.21358im      0.0565376+0.0457017im    0.0767401+0.0114533im
    0.191858-0.154445im       0.167304-0.163169im     -0.130078-0.0803056im   -0.00730585-0.0663091im  0.000267675+0.113365im      -0.260628+0.185352im        0.11374-0.285924im    -0.0125842+0.0216628im    0.0623353+0.0664609im      -0.104126-0.0296523im    -0.0485344-0.120692im        0.159579+0.0662741im     0.0177741-0.0607226im   -0.00192578+0.151068im       0.086404+0.169374im      0.0786372-0.143761im     0.0269167-0.0331322im     0.112515+0.192536im      -0.135032+0.177378im     -0.0537916+0.263177im        0.19556-0.0795805im     0.0946197-0.0679457im   -0.0445998+0.0916865im      -0.257307-0.0605674im    0.0627726+0.013485im       0.101676-0.0999193im   -0.0795559-0.0410143im     -0.0250498+0.0633652im      0.319659-0.0690093im    -0.0285589-0.149734im     0.0245748-0.0406031im    0.0360692-0.0846242im
   0.0285125+0.00302915im   -0.0763188-0.00532854im    0.158778-0.0155512im     -0.105543+0.18305im     0.00301391+0.0507672im     -0.134764+0.00930201im     0.176931-0.124107im     -0.103231+0.0195965im    0.0546284+0.0182412im      -0.159235+0.00938747im   -0.0597132-0.205692im        0.189006-0.0826296im    -0.0953686+0.150452im      -0.131985+0.144646im     -0.0898086+0.118758im      -0.097541-0.0182277im   -0.0815567-0.111402im     -0.194222+0.0156402im    -0.0186642-0.280662im      0.0856992+0.067573im      -0.194243+0.28679im      -0.0703627-0.0145014im   -0.0123953-0.0222913im      0.0149614+0.200592im    -0.0537126+0.248245im      0.0630261+0.119973im    -0.0808998-0.121279im       0.0459519+0.0587367im    -0.0721409-0.285585im      -0.134345+0.266788im    -0.0698044-0.0410883im    0.0779826-0.112859im
   0.0423602-0.315432im      0.0948745-0.1283im      -0.0347199+0.0955151im    -0.0833864+0.231484im    -0.0215067+0.0103479im     -0.111066-0.104699im      -0.271495+0.13287im     -0.0766115-0.00843396im   0.0281094+0.0706604im     -0.0230879+0.158402im       0.221563+0.0692577im     0.00260727+0.0118906im     0.0678077+0.119921im      0.0403542-0.0754258im      0.149331-0.200891im      -0.165463-0.0406258im    0.0419645+0.257841im     0.0196123+0.0294902im     -0.301885+0.0312901im     -0.107229+0.134353im     0.00534847-0.0150664im     -0.053115+0.198658im    -0.0703832-0.199583im    -0.000961446+0.0532873im   -0.0768486+0.11566im      -0.0575601+0.213036im     0.0292891-0.113705im       -0.081147+0.0728348im    -0.0266033+0.0822652im     -0.108056-0.0596478im    -0.100572+0.106527im      0.206878-0.125808im
   0.0714021-0.0721379im    -0.0793197-0.133157im     0.0302206-0.178463im     -0.0980451+0.171936im     -0.123918+0.0965161im     0.0955443+0.0591348im    -0.0998634-0.14436im       0.102802+0.076591im     0.0677052-0.0831093im       0.104518+0.0604962im     0.0611848-0.153274im      -0.0790689+0.260515im      -0.182005+0.234157im      0.0335502-0.305888im     -0.0759699-0.248929im       0.180562-0.183456im      0.199552-0.145272im     0.0290897+0.153115im      0.0157996-0.0571695im     -0.091108+0.109978im     -0.0236593-0.00523675im     0.131305-0.0421874im      0.19673+0.161746im        0.022594-0.068552im      0.115025+0.025349im      0.0348685-0.017099im     0.0334066-0.132271im       -0.105832-0.130398im      -0.119958+0.00707526im    0.0838599+0.169571im     -0.132187-0.0423627im    -0.119274+0.142793im
  -0.0172422+0.0783908im    0.00710393+0.173887im      0.125334+0.0840256im      0.117264-0.226215im     0.0231731-0.0770408im    -0.0380132-0.0969941im     0.0499843-0.0199091im   -0.0801515+0.135447im     -0.286582-0.0121674im   -0.000139607+0.000592549im   0.0354061-0.0909015im      0.0174316-0.00720626im    0.0388112+0.172443im      -0.135233-0.0393763im      0.258479-0.303936im       0.126596+0.0765374im    -0.141327+0.048132im     -0.135061+0.0590048im    -0.0460576+0.131347im        0.23984+0.147579im       0.108914+0.167997im      0.0318555-0.147746im      0.127438-0.0250083im     -0.0896272+0.126034im      0.185279-0.035924im      0.0623095-0.0347594im     0.280477-0.161543im       -0.148679+0.0924356im    -0.0576871-0.0891561im     -0.152955-0.19926im     -0.0666743-0.0173603im   -0.0612871+0.0296503im
  -0.0942343+0.0366475im      0.109955-0.0607281im   0.00482562-0.0383138im     -0.194654+0.0301901im     -0.18409-0.147196im      0.0271386-0.0424898im    -0.0647656+0.0202172im     0.080131+0.0338905im   -0.0941836-0.274311im         0.15115-0.125699im      0.0197397+0.236731im        0.106365-0.209091im      -0.132038+0.0938466im      0.147746+0.0520008im       -0.2092+0.11942im       0.0302292-0.181087im     0.0991563-0.0100212im   -0.0555165-0.28649im      -0.0513487+0.120039im      0.0017496-0.0727142im     0.0975251+0.126896im    -0.00321099-0.151801im      -0.20512+0.136132im      -0.0922558+0.0817445im     0.169675+0.212314im      0.0741116+0.0219386im     -0.10416-0.20758im       -0.0573219+0.0818442im    -0.0466614+0.0597916im     0.0111638-0.251481im     -0.154269-0.0872im       0.0228095+0.000309356im
     -0.1662+0.166669im      0.0830145+0.033219im     0.0905641-0.372644im     -0.0278888+0.0529416im   -0.0392574-0.00244867im   0.00262022+0.00380107im    -0.180482+0.0929814im     0.115285+0.0252058im    0.0408979+0.0692466im     -0.0277907+0.107508im     -0.0863261+0.0336491im     -0.0355395-0.157252im     -0.0683145+0.286783im       0.214189-0.00977229im   -0.0692521+0.118366im       0.017834+0.0761704im    0.0927016+0.00210387im  -0.0451598+0.116013im       0.100539+0.0415674im    -0.0342349+0.327031im     -0.0210405+0.183635im     0.00707775-0.104333im     -0.165902-0.165623im        -0.13161+0.0384366im    -0.178575-0.311374im    -0.00138316+0.0583509im     0.160982+0.100495im       0.0282583-0.0603014im     0.0737587-0.0604762im    -0.0602366-0.0346195im     0.228381+0.0664018im    0.0948507+0.0544578im
  -0.0276658+0.113293im      0.0380755-0.0814818im    -0.215362-0.0535281im     -0.177911-0.134089im    -0.0887876+0.0772456im     -0.152921+0.190728im     -0.0674002-0.0874739im    -0.158866-0.0332145im     0.197896-0.120274im     -0.00872901+0.052405im     0.00562543+0.0111927im     -0.0846005-0.0990192im     0.0588037-0.0432464im     -0.158623-0.201688im      -0.128123-0.021628im     -0.0728531-0.0319118im    -0.108807+0.0376728im    -0.343145-0.0255923im     -0.184051+0.0554637im      0.224745-0.057862im      -0.220122-0.134331im    -0.00437851-0.0120608im   -0.0224229-0.0874713im      -0.204818-0.170393im      0.290098+0.00170922im   -0.0216886+0.0217778im     0.177897+0.0618328im        0.13736-0.0443276im     -0.126351+0.106389im     -0.0374248+0.0817774im     0.187931-0.00746867im    0.115142+0.0751981im
   -0.150348+0.102168im       0.225389-0.057292im     0.0187057-0.0912465im    -0.0281695+0.0817438im  -0.00489168+0.110099im      0.0650863-0.0115187im     0.0126161+0.18906im      -0.205631-0.191928im     0.0222339+0.0687864im       -0.15523-0.0979311im     -0.200264+0.0451113im     -0.0114939+0.36838im       -0.173031-0.00502922im   -0.0285347+0.122938im       0.162288+0.101995im     -0.0422614+0.00810519im    0.196758+0.0344771im   -0.0181863-0.0109019im    -0.0699869+0.238796im     -0.0193733-0.109312im      0.0513156-0.0105827im    0.00728023-0.203019im     0.0905673+0.00586281im    -0.0211735+0.153632im   -0.00227291+0.214676im      -0.115091-0.230759im      0.131381-0.0513642im     -0.0258535+0.0832159im     -0.208621+0.0115671im     0.0482546+0.113192im      0.100434+0.24297im      0.0688548-0.0130468im
  -0.0830626-0.0246765im    -0.0468661+0.0921589im    -0.153008-0.0433244im      0.198708+0.280791im    -0.0357579-0.189209im     -0.0854327-0.00920155im   -0.0314176-0.148759im    -0.0555628+0.195727im    -0.0708559+0.0822291im      0.0301269-0.226676im     -0.0013099-0.135126im       0.0311015-0.160892im      -0.112878+0.0712485im     -0.119612+0.279039im        0.09972-0.0832557im    -0.0188822-0.155702im      0.160952+0.0896553im    0.0364355-0.0969604im     0.0337359-0.0652275im      0.094332-0.010335im      0.0231987-0.14958im      -0.0539815+0.0762657im   -0.0861356+0.328712im      -0.0541035-0.0589276im   -0.0851822-0.0600583im     -0.101121+0.0479393im     0.266582+0.113849im      -0.0274088+0.111674im     -0.0451441+0.224825im    -0.00649906+0.174418im     0.0689114-0.0621231im     0.144473+0.151037im
  -0.0174163+0.0259693im     -0.157291+0.271323im    -0.0102276+0.10599im       0.0526579+0.203055im    -0.0608423+0.0687609im     0.0206658-0.0594439im      0.225345-0.0731827im    -0.105273-0.117178im     0.0951507-0.119161im       -0.132434+0.153063im      0.0764778+0.189781im      -0.0451853+0.084589im       0.110708-0.138055im       0.118155+0.2058im       -0.0673043-0.130751im     -0.0602241-0.260522im      0.133453-0.14998im     -0.0497597-0.0644206im     -0.192714+0.0306332im     0.0551894+0.0936156im     0.0767826+0.0404588im      0.154634+0.0111912im   -0.0626531+0.0408107im      0.0490846-0.104996im    -0.0353953-0.299648im      -0.103471-0.0878624im    0.0102309-0.180034im        0.113601-0.233678im       -0.14873-0.169221im      -0.157432-0.127841im     0.0216277+0.05003im      0.0612195+0.0209033im
  -0.0711996+0.18906im      -0.0236341+0.062731im     -0.225397+0.0098579im     -0.098997+0.0939936im     0.193847-0.0500446im     -0.193014-0.197239im    -0.00369838-0.0851765im     0.204401-0.0232283im     0.145812-0.160996im      -0.0957812+0.0632164im    0.00408281-0.0936277im     -0.0279436+0.160535im     0.00394381+0.0897747im     0.0658843+0.109581im     -0.0668518-0.159384im      0.0529954+0.0381346im   -0.0350016+0.206352im     -0.201443+0.184037im      0.0762861+0.16255im        0.161832-0.00174993im    -0.101897-0.00213736im    0.0890911-0.13799im     -0.0213635+0.0956388im       0.146755+0.0779375im    -0.103264+0.130512im      -0.197832+0.0419991im    -0.159292+0.279118im       0.0773864+0.00219999im     0.130394+0.0189958im     0.0786086-0.178977im     -0.278232+0.0435804im    0.0131794+0.029666im
  -0.0843161+0.0521913im    -0.0375469+0.0713314im   -0.0951239+0.0799539im    -0.0296555-0.0881498im     0.201339-0.186166im       0.304201-0.0914527im    -0.0936928+0.010489im     -0.216705-0.080027im      0.189321+0.120439im       -0.121602-0.15847im        0.105989-0.366638im        0.065649+0.0066941im      0.119719-0.0781774im      0.249686-0.080931im       -0.21104-0.00161222im    0.0781465-0.0970866im   -0.0618705+0.00652873im   0.0226969+0.0587158im    -0.0596662-0.0864097im     -0.166695+0.0735726im       0.23149+0.045076im     -0.0320308-0.066363im    -0.0382619+0.0253851im     -0.0988841+0.250663im      0.184731+0.0566237im     0.0278327+0.0105717im    0.0745343+0.0614682im      0.0898745-0.159111im     -0.0241659+0.165306im      -0.125471+0.0183892im   -0.0167863-0.0754327im      0.09148-0.0667208im

and then generate the state $ψ$

psi = P[:, 3]
32-element Vector{ComplexF64}:
  -0.012467199804046956 - 0.13935171392966572im
  -0.030232681335050776 + 0.12695470874208545im
     0.4280042722089263 + 0.0im
   -0.02935147059040326 + 0.1733559175396085im
    -0.1056366118755083 + 0.12583566206624103im
   -0.06026000604862868 + 0.04552623040043073im
   0.039789553268997975 - 0.20035014003930385im
  -0.038694435516237816 - 0.00028826298413770456im
    0.04068761690553429 + 0.13171631499891087im
   0.018164120507605495 + 0.008140487455787094im
  -0.027714257017360362 + 0.1746886102091793im
  -0.029980149537939885 - 0.03735766325716829im
     0.2183274073692761 + 0.06819777213015213im
    -0.2613656445958553 - 0.2133768119772868im
   -0.17400394533778193 - 0.11549346669442948im
 -0.0003714698930555489 - 0.08754667709912428im
     0.1842839410242312 - 0.0706075545869798im
    0.14022771022825387 + 0.03652067562170871im
   0.015116724127405341 - 0.012666881768944715im
    0.09879157638734183 - 0.06555625544777663im
   0.011359744119186468 + 0.096545230277582im
   -0.30747603580135247 - 0.1615526392026316im
   0.003389273849690351 - 0.10361299947550466im
    -0.1553747599016821 - 0.05910430937100498im
   0.048173365094520644 - 0.01890589008907602im
    0.07348070450629612 - 0.07900192748237633im
   -0.04206613784523587 - 0.04025220974819875im
     0.1023047287602718 + 0.020318378717935157im
   0.028476476049814913 - 0.0020732398375780895im
    0.15562234900863736 - 0.1797257367238294im
    -0.0886086574931284 - 0.10728010763011027im
   -0.23352010805277465 - 0.016659391380628816im

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.