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.245752-0.149773im      -0.285878+0.0409im      0.00208884+0.0502458im      -0.067028+0.0387843im    -0.0807509+0.148118im    -0.114411+0.0583703im   -0.142914+0.0597635im      0.0565261-0.22392im       0.0806857+0.242498im     -0.0120344-0.0423268im     0.114361-0.116603im      0.0125965-0.112711im      0.126375-0.164595im      0.0271241+0.0612386im      -0.134149-0.0405899im    -0.0226616+0.00410452im    -0.224033-0.0932452im     0.0581636-0.31754im        0.086889+0.103085im       0.197847+0.139031im     0.0911192+0.144608im    -0.0195517-0.127447im      0.074972+0.143112im      -0.136216+0.128743im     -0.0618202+0.045346im     -0.136793-0.1007im         0.151092+0.114326im       0.130033+0.175276im     0.170175+0.0121724im      0.0223243+0.022919im      0.0647169-0.070369im    -0.0840417-0.130517im
    0.116702+0.106624im      -0.206621-0.189478im    -0.0387631+0.0982406im       0.393923+0.317009im      0.0402104+0.0675169im     0.06305+0.0942055im   0.0588706+0.0479976im     0.00188376-0.0759636im  -0.000615465-0.0880738im      0.102251+0.00867243im  -0.0377302+0.0930334im    -0.0749077-0.0344602im    0.0748693+0.0700023im    -0.0219954-0.0462457im       0.185903+0.095737im       0.172281+0.0968383im     0.0336188-0.0645555im    -0.0614247+0.0398452im    -0.0491099+0.0859921im       0.11643-0.0967363im     0.158779+0.133226im     -0.223576-0.168659im     0.0183824+0.328775im      -0.130029-0.0298661im      0.146019-0.109568im      0.117466+0.140448im        0.11463+0.117447im       -0.10496+0.0265525im   -0.103906+0.0595275im       -0.15654-0.132968im      0.0449438-0.00603546im   0.0280811+0.109868im
    0.296149+0.11052im      -0.0941528-0.110326im     -0.135013-0.24004im       -0.0116052-0.0420396im     -0.147232-0.182407im    0.0290342-0.085575im   -0.0800114+0.15549im        0.0763518+0.178606im        0.20578+0.0784488im     0.0443853-0.200215im    -0.0974647-0.0346714im     0.0374398-0.210658im      0.125018-0.0765049im      0.128475+0.00321534im     -0.146841+0.0483271im      0.111131-0.0455343im      0.050458-0.102518im    -0.00208541-0.115441im      -0.142756-0.0701576im      0.015267-0.150104im     -0.193152+0.165475im     0.0269943+0.0702696im    0.0768396+0.145925im       0.166517-0.064349im     -0.0520174-0.0568101im     0.152243+0.126607im     0.00596691-0.0334336im      0.279172+0.040313im      0.16722-0.0855657im     -0.0170699+0.13085im       -0.202304-0.12769im        0.02825+0.0778203im
    0.105467+0.177502im     -0.0388508+0.204981im    -0.0653098+0.162243im      -0.0701571-0.142113im     0.00431141+0.0324763im    0.164604-0.121496im    -0.151992+0.103093im       -0.114915+0.0947554im      0.171932-0.206276im       0.112514+0.0609653im    -0.188322-0.0979182im      0.133332-0.0477339im    0.0753241-0.129185im      -0.159113+0.0175843im     -0.0371124-0.0984703im     0.0748031+0.00668021im      0.12839+0.13752im        0.169678-0.328414im     0.00134441-0.113529im      -0.238976+0.0571851im     0.160932+0.195432im    0.00179745+0.00265144im  -0.0950537+0.0148741im     -0.178039-0.0642253im     0.0205266+0.130183im    -0.0956329-0.0302936im   -0.00685305+0.122057im      -0.184342-0.0675191im  -0.0186599+0.17252im        -0.190281+0.0445422im    -0.0401948+0.167891im    -0.0761174+0.0410363im
   0.0637161+0.0557399im      0.109554+0.0528133im    -0.179838-0.00128931im     0.0993596+0.134489im     -0.0574763+0.0387159im   -0.111983-0.19601im      0.140914-0.221407im      -0.0169151+0.0296496im     0.0573308+0.127805im      0.0707708+0.117531im     0.0509426-0.0461593im     -0.188228-0.18417im      -0.128033-0.0725936im    -0.0176462-0.119416im      -0.0673789+0.0405554im     -0.126839-0.0213446im     -0.039273-0.110321im     -0.0256028+0.0180658im    -0.0411983-0.251512im    -0.00727851-0.0501756im    0.0157418+0.0763075im    -0.346482+0.1771im          0.0237-0.102677im      0.0955522-0.0469782im     0.0317188+0.175831im     -0.162469-0.118203im     -0.0969474+0.240384im       0.147908+0.225179im    -0.221704+0.242638im     -0.00672214+0.105045im       0.101974-0.0344774im     0.105166-0.067059im
   0.0421334+0.0243456im    -0.0472577+0.0532083im    -0.072074-0.0246194im       0.316178-0.0446831im      0.167709+0.0235943im  -0.0693147-0.209147im     0.150936-0.130398im       -0.129712+0.0630401im    -0.0915483+0.00440681im     0.230906+0.0740304im   0.00126537+0.0562952im      0.108982-0.166086im    -0.0291539-0.249745im      0.0521056+0.13331im        -0.112192-0.0354014im      -0.19261-0.127985im    -0.00774739+0.0886463im     0.0580298+0.0126081im    -0.0873357+0.209107im       0.234404-0.0317483im    -0.164163+0.0903099im     0.116334-0.125875im     -0.171152-0.213226im      -0.201748+0.0522731im     0.0618072+0.0582325im   -0.0739227+0.0543669im     0.0854975-0.00673363im   -0.0435985-0.166148im    0.0975551-0.0884716im      0.0846181-0.101719im      -0.170866-0.0390754im     0.257854-0.0120611im
    0.169164-0.0120729im     -0.160955+0.0269817im   -0.0420176-0.121348im       0.0369308+0.186166im       0.049753-0.137872im   0.00717325+0.10232im     -0.317127-0.0891468im       0.113404+0.137079im      -0.192496+0.0296435im    -0.0308337+0.0502738im     0.130507+0.00807902im   -0.0929994-0.0101255im   -0.0882595-0.0835938im      -0.19915+0.15582im        -0.133494-0.159342im      0.0317409-0.108553im     -0.0282577+0.0578873im     -0.102089-0.0224953im    -0.0121415+0.114249im      -0.162693-0.306145im    -0.0433743-0.107118im    -0.0737908-0.228111im      0.069267-0.0792298im    -0.0414387+0.0340746im     -0.126744-0.0411442im    -0.195955+0.106048im     -0.0875594+0.146078im       0.039225-0.201761im   -0.0338103+0.0395589im       0.175835+0.122219im        0.19637+0.0995379im    -0.209589+0.0711585im
  -0.0771021-0.170187im       0.162377-0.156459im     -0.282703+0.0629949im      0.0830211+0.0681141im      0.116335-0.249697im    0.0160703-0.252236im   -0.0467202+0.216569im      -0.0465993-0.155593im     -0.0228973-0.208613im     -0.0668397+0.00484945im    0.220182-0.0251118im     -0.166872+0.0833156im     0.224643+0.0118095im     -0.134442+0.0491624im      0.0772402-0.0226897im     0.0546288+0.0969263im      -0.15144+0.0681234im      0.120143-0.29781im       0.0463968-0.00895351im    0.0730062-0.0336156im   -0.0334318-0.10183im     -0.0518392+0.0897199im   -0.0567215+0.0287327im      0.099965+0.150796im       0.038136+0.0417236im   -0.0949875+0.214386im      -0.189062-0.163425im    -0.00171751-0.0532669im  -0.0850866-0.0794832im    -0.00679602+0.0912831im     0.0125902-0.0227736im     0.170707-0.0871083im
    0.078629+0.0785449im     -0.107389+0.150427im     -0.100006+0.0348958im      -0.163989+0.134333im      0.0667145-0.0394606im    0.157566+0.0209418im   0.0528616-0.0864581im      0.0624693-0.0429373im    -0.0588893-0.0788257im      0.104464+0.246153im    -0.0133447+0.0657624im     -0.100267+0.279465im     -0.245789-0.00128148im      0.26519-0.218704im       -0.119681-0.108428im      0.0628667+0.0552534im     0.0372641+0.196198im       0.199056-0.071844im      0.0703986+0.194711im      0.0558094+0.113729im    -0.0651991+0.069624im     0.0805882+0.100834im     0.0517718+0.0569072im     0.0443364+0.183539im     -0.0415953-0.125065im      0.182849+0.156519im      -0.039477+0.227946im       0.208983+0.101342im    0.0879674-0.0290096im   -0.000831933+0.083114im      0.0915419+0.130539im      0.173015+0.00440084im
     -0.1863-0.0483338im    -0.0149992+0.140009im     -0.330642-0.159308im    -0.000238304-0.04669im        0.078819-0.129419im     0.186256+0.0781577im   0.0786493-0.0648956im      -0.239375+0.185293im      -0.150688+0.239203im     0.00977881+0.068859im    -0.0858208+0.164059im      -0.140193+0.118576im    -0.0022992+0.20772im      -0.0150677+0.205083im      -0.0738166+0.161259im       0.152169-0.141648im     -0.0693626-0.140313im     -0.0509674-0.128719im       -0.12159-0.129317im      0.0291234-0.00712644im   0.0149721+0.146118im     0.0983629+0.0463804im     0.139499+0.051415im     -0.0685083-0.0365967im      0.266371+0.0284857im    0.0415228-0.0977045im    -0.0605064-0.0500018im    -0.0479331-0.0117389im    0.147152-0.0161283im    -0.00286688-0.158953im       0.114345+0.162067im    -0.0724714-0.0810149im
   -0.134198+0.0309071im    -0.0757138+0.0306304im    0.0897014-0.0783651im       0.162497+0.170172im      0.0838239+0.181343im   -0.0984901-0.219193im    -0.215466-0.025765im        0.108047+0.0105112im    -0.0131241+0.0571379im     -0.076369-0.075543im    -0.0593184-0.0259783im     -0.197076+0.151112im    0.00535001-0.154125im       0.180138-0.277381im       0.0150317+0.0378559im    -0.0401062-0.0261768im      0.166665-0.0796004im      0.101316-0.143565im     -0.0562544-0.168358im      0.0516077-0.240612im     0.0207776-0.0672158im     0.115232+0.139818im    -0.0172112-0.115325im      -0.139501-0.083234im     -0.0089419+0.0530299im     0.181245+0.0123868im       -0.1765-0.0987687im     -0.338475+0.113291im     0.210753-0.0782934im      0.0926741+0.0388442im     0.0883297-0.0624525im    -0.111849+0.0802274im
    -0.12998+0.0711834im      0.108022-0.183946im      0.105772+0.122747im      -0.0498332+0.111674im       0.107413-0.149424im    0.0530313+0.124823im    -0.053957-0.012871im        0.013629+0.0432485im    -0.0443131-0.0954959im     0.0394263+0.0304458im     0.332099-0.118194im     -0.0947411-0.161484im     -0.200637-0.124546im     -0.0299155+0.0300524im      -0.195657+0.0888632im       0.13312+0.0534353im     -0.199717-0.0820286im     0.0236221-0.117453im    -0.00168677-0.109932im      -0.134929+0.00812453im  -0.0504202+0.107449im     0.0793218-0.0293741im    0.0848199-0.332595im      -0.117222-0.160645im    -0.00126368-0.150994im      0.271801-0.0378755im       0.25822-0.1223im       -0.0145054+0.120166im    -0.052547+0.0361483im       -0.17932-0.0280907im    -0.0430001+0.0570874im    0.0877925+0.150267im
   0.0102941+0.240444im      -0.293852+0.17999im      -0.241032+0.060568im       -0.231243-0.0307721im     0.0926192-0.200391im   -0.0797253-0.0201391im    0.086243-0.0120562im       0.179466-0.0952738im      -0.14428-0.0830179im    0.00635938+0.0180949im     0.111752+0.0029931im   -0.00446853-0.122482im    -0.0838036+0.0504489im    -0.0229085-0.175308im        0.131817-0.0612266im     0.0324716+0.0113561im     0.0783534-0.00667512im   -0.0202648+0.00409364im   -0.0343489+0.022568im      0.0092912+0.0715213im    -0.029822+0.0879049im    0.0368085-0.0383706im    0.0546936+0.00723973im    0.0605594-0.00480134im     0.185234-0.0379726im   -0.0813384-0.0627588im     0.0978576-0.279133im      -0.173063-0.0553643im  -0.0119382+0.261103im        0.204435+0.00424768im    -0.022715-0.413519im    -0.0607865+0.0149226im
   -0.174167+0.0418779im     0.0207555+0.15173im      -0.149527-0.090888im       0.0213205-0.0130197im      -0.16916+0.1336im     -0.0155875-0.0449115im  -0.0530029-0.128247im      -0.0275292+0.176203im     -0.0803026-0.272607im       0.241845-0.062117im      0.347713-0.191826im      0.0532355+0.154686im    -0.0517025+0.0939167im    -0.0240441+0.0122753im     0.00564835-0.137933im     -0.0902684+0.103182im      -0.102671-0.0162553im    -0.0787926+0.1657im       -0.0949755-0.205488im     0.00701853+0.0937149im   -0.0393339+0.0153528im    -0.101651-0.0869908im     0.030263+0.335695im      -0.112636-0.0558237im    -0.0427211+0.128896im     0.0447273+0.00350792im    0.0500223-0.0219482im    -0.0391439+0.0263783im    0.106284-0.225231im        0.104342+0.196985im      -0.159851+0.0625034im   -0.0024379+0.123675im
   -0.032276-0.0871726im      0.082719+0.0343982im     0.203711-0.069161im       -0.174009-0.0785691im      0.114961+0.0607752im   0.0160318-0.352756im    0.0237357-0.0425234im      0.0776966-0.134712im       0.177311+0.137929im      0.0793547+0.0429775im    -0.079834-0.00326211im  -0.00451185+0.0371642im    0.0272247+0.0197459im     -0.152507-0.0960096im      -0.137307-0.239668im       0.105997-0.165582im      -0.316085+0.024103im      -0.158624+0.126823im    -0.00574615-0.0546458im   -0.00857287-0.0845497im   -0.0390324+0.206501im    -0.0532819-0.0107646im    -0.165853+0.185548im       -0.12975+0.0161213im      0.141847-0.149113im      0.228031+0.151196im     -0.0333181-0.137831im      0.0467495-0.0953707im   -0.149817+0.120919im         0.14732-0.0849892im      0.118063+0.0614147im   -0.0366403+0.0756026im
   -0.159346+0.111571im     -0.0179053+0.117603im      0.045767+0.0153711im     0.00711455+0.0312057im   -0.00239165+0.0928457im    0.136286+0.0395584im  -0.0834316-0.0275846im    -0.00611431+0.0888303im     -0.176153-0.0144598im      -0.15631-0.130703im      0.212864+0.0117084im      -0.13556-0.065161im      0.241804+0.0111594im     -0.146486-0.099458im       -0.164174+0.110843im      -0.210922-0.20472im        0.202906-0.00649844im    -0.105321+0.0755869im      0.058782+0.269959im     -0.0530249+0.0315244im    0.0518703+0.0410192im     0.183254+0.101016im     -0.128904+0.0881344im    -0.0338724+0.0773363im      0.126173+0.270813im      0.175228+0.149017im     -0.0909255-0.0120782im      0.252192+0.0511951im   -0.161644+0.154281im        -0.20437+0.00975211im   -0.0797543-0.0626659im   -0.0274046+0.0797841im
  -0.0893307-0.0106153im    -0.0152506-0.0100985im   -0.0713198+0.0134982im       0.145043+0.172891im       0.193292-0.129627im    0.0589267+0.225746im    0.0317313-0.258587im         0.24541-0.0751132im      0.158744-0.040945im       0.149486-0.1681im       -0.271656+0.0750298im      0.070797+0.0951314im     0.201243-0.0248133im      0.109813+0.0856869im     -0.0717396-0.230157im      -0.218507+0.148941im      -0.006773-0.00788956im    -0.266082-0.119204im       0.144235-0.0502991im     -0.215903+0.123293im    -0.0555936-0.0200516im   -0.0036181-0.0832798im    0.0851874-0.055199im     -0.0219582-0.107047im      0.0428073+0.106423im     0.0795784-0.0118479im     -0.105286-0.204533im      0.0596205+0.0594459im   0.0119991+0.0815056im      0.0195345+0.0922661im   -0.00949614+0.0696383im     0.132502-0.112846im
   -0.106058-0.106024im       0.231643+0.139436im      0.203012-0.129959im      -0.0367621-0.0300203im      0.131258-0.142319im    -0.028926+0.150425im    -0.167077-0.133506im      -0.0757477-0.233664im     -0.0441268-0.0125754im    -0.0206994+0.153961im     0.0663863-0.204447im      0.0393018-0.113012im      0.061442-0.0249694im      0.291951-0.0554568im       0.216351-0.0116282im     0.0472925-0.16774im        0.162828-0.143059im     -0.0828613-0.0947401im     -0.330555+0.0217794im     -0.122199+0.016121im     0.0440969+0.171745im    -0.0787014-0.0454143im    0.0859455+0.093087im     -0.0224477-0.0069792im      0.033005-0.0406935im   -0.0219504+0.0607351im     -0.082122+0.131991im    -0.00150273-0.259096im   -0.0228488-0.051916im        -0.10171+0.101609im     0.00995844-0.126122im      0.181246-0.0723368im
    0.099422+0.134182im       0.157158-0.0402728im    -0.150468-0.0328016im     -0.0249145-0.00254687im     -0.22256+0.124989im    0.0661122+0.252318im     0.192183-0.231366im        -0.17991-0.205672im     -0.0333332+0.125675im      -0.185854-0.312678im    0.00871696+0.0969203im     0.0923526+0.151595im    -0.0268429-0.161061im     -0.0223749-0.0491653im     -0.0616725+0.0513072im    -0.0693491-0.156452im     -0.0826804+0.0365524im      0.194079-0.232926im     -0.0893939-0.0928129im    -0.0773353-0.0313162im   -0.0120311-0.12186im     -0.0697905-0.0760346im    -0.190194+0.0594526im    -0.0565265+0.0833722im     0.0601867-0.126546im     0.0649879+0.105148im       0.145994-0.0384078im    -0.0943288-0.0940374im  -0.0843278+0.045im            0.11347+0.210091im      0.0685635-0.0594946im    0.0556074+0.124647im
  -0.0842179-0.0749041im   -0.00719522-0.237899im     -0.162193+0.0913103im      -0.172038-0.0348338im    -0.0434201+0.129123im    0.0926387-0.0443961im   0.0295226-0.0369988im      0.0037675-0.0206979im    -0.0524218+0.0610979im      0.173642+0.0716967im    -0.042053-0.0352503im      0.244194+0.101505im     -0.234989-0.190877im    -0.00970049-0.0276981im     -0.0983992+0.0389629im      0.195574+0.0428392im      0.068793-0.232406im       0.034492+0.112538im    0.000584511+0.0748079im       -0.1492-0.199392im      0.284524-0.155709im    -0.0938961-0.093105im    0.00267554+0.0123156im    -0.0907694+0.0157239im    -0.0153282+0.218283im    -0.0298001+0.118642im      -0.204192-0.212916im        0.18123-0.0746476im    0.177554+0.0412812im      -0.146567-0.083789im      0.0158211-0.193644im        0.1188-0.038144im
    0.256314-0.00167872im    -0.229107-0.110782im     0.0618706-0.258242im      -0.0607548+0.00194898im    0.0995435+0.0972753im  -0.0348805-0.178222im    0.0275618+0.0535305im      -0.137709-0.101624im      -0.125115-0.0201871im     0.0413903-0.122548im       0.21539-0.0758409im      0.147911+0.23525im      0.0427934+0.031076im       0.177487-0.115825im      -0.0116522+0.120032im      -0.248508-0.0282906im    -0.0329601-0.0349854im    -0.0718444-0.0702249im   -0.00400411-0.141777im      -0.174034+0.141154im      0.123723+0.0478357im    -0.014571-0.0594371im     0.157567-0.159739im      0.0213698-0.0405971im      0.113027-0.118664im     -0.190018+0.248773im      0.0163108-0.032205im      0.0574375+0.0473521im  -0.0717455+0.0575626im     -0.0621046-0.227642im      -0.104341+0.177096im      -0.11231-0.125961im
    0.124512+0.111904im      0.0605412-0.00570477im   0.0396955+0.0670113im      0.0841456-0.0842683im     0.0670072+0.101504im    -0.253254+0.0649932im  -0.0547117-0.0172527im      -0.119357+0.211182im     -0.0874024+0.06862im        0.118788+0.228458im    0.00857353+0.169205im      -0.196125-0.00055182im    0.239812-0.00588286im     0.203127-0.0430023im     -0.0818541-0.0102792im      0.136558+0.0825289im    -0.0742612-0.0841086im      0.127431-0.139372im    -0.00215157-0.0555027im      -0.11191+0.299495im      0.134272-0.102651im     -0.134705-0.136694im    -0.0687411-0.0180299im   -0.00815918+0.108126im      -0.157321+0.047355im       0.19623-0.0623338im    -0.0852153-0.148391im       0.170845-0.172093im     -0.15075-0.0192571im       0.188201-0.088213im     -0.0918815-0.119646im     -0.194722+0.061595im
  -0.0494575+0.0820889im     0.0637825-0.0233273im   0.00745052+0.0472607im      -0.118972+0.138779im     -0.0301859-0.0336919im  -0.0562623-0.112119im   -0.0146878+0.201025im       -0.136529+0.135336im     -0.0961886+0.0874546im     -0.166074-0.300073im     0.0300513+0.0964036im     -0.134307+0.0717976im     -0.12718-0.0142837im     0.0676137-0.0209752im       0.225045-0.398949im     -0.0922563+0.0591279im      0.113152+0.0502908im    -0.0211041-0.0779998im     0.0507258-0.0396053im    -0.0513044+0.00197948im   -0.166298+0.00805755im   -0.200119+0.0103732im   -0.0127801+0.0142384im     -0.239666-0.0777787im    0.00740628+0.0218947im    0.0135753-0.181267im      0.0996868+0.0545694im      0.254803-0.198237im     0.117947+0.00292419im     -0.123573-0.284323im      0.0674247-0.0616198im     0.119623-0.0158148im
    0.107663+0.341915im     -0.0414735-0.03188im      -0.143505-0.16423im       0.00908768-0.192106im     -0.0348259+0.12776im     -0.132801+0.0451719im   -0.144497-0.112406im        0.109435-0.142876im      0.0603179-0.0340882im    -0.0551954+0.044726im     0.0892051-0.0285609im    -0.0152251-0.0567624im    -0.105685+0.07888im      -0.0860874+0.229198im        0.039255-0.146768im      0.0326151-0.135994im      0.0266239-0.125496im      -0.119184-0.120229im       0.218202+0.0379239im      0.224128+0.183139im      0.204712-0.0394058im    0.0131612+0.193782im    -0.0620052-0.0611962im     0.0428545-0.289845im     -0.0730058-0.0311536im     0.102135+0.136995im      -0.113369+0.0264273im    -0.0328906-0.0688038im  -0.0222814-0.194736im      -0.0580984-0.125159im       0.212521+0.00492139im    0.168969+0.0205448im
   -0.137526-0.116617im     -0.0278291-0.106923im     0.0360612+0.0448342im      0.0309539-0.177032im        0.16724+0.0853612im    0.178755-0.0291214im   0.0835001-0.000813274im    0.0164558+0.0689909im     -0.172097+0.115615im      0.0542231-0.204997im      -0.14768+0.0491625im     -0.160014-0.00853802im   -0.155931+0.0945076im     -0.105583-0.00909094im    -0.0541152-0.0137741im     -0.125518+0.161238im     -0.0218826+0.0597124im    -0.0172435-0.0775617im     0.0251014-0.167406im      0.0728235+0.100731im      0.133886+0.211514im      0.149647-0.0907957im     0.130129+0.0052235im    0.00112381-0.0651541im     -0.232845-0.201286im     -0.133548+0.12003im       -0.233154+0.198749im    -0.00343516-0.101686im    -0.133663-0.0322837im     -0.0505986+0.119837im      -0.101758-0.324981im     0.0394297+0.242693im
   0.0725095-0.150225im      0.0502625-0.0576703im    0.0248341-0.212728im       -0.012871+0.0728871im     -0.255399-0.0239626im  -0.0646985+0.0960225im   -0.151713-0.09053im        0.0887506+0.116105im       -0.13067+0.0700078im    -0.0298089+0.139626im    -0.0167432+0.118496im       0.191781-0.102523im     0.0231021-0.0165506im   -0.00553174-0.0218673im        0.26908-0.013123im      0.0833935+0.0553039im     -0.123052+0.308165im      -0.064817-0.0504763im      0.283382-0.175002im     -0.0190774-0.0555177im     0.180578+0.133903im     0.0857886+0.150594im     0.0734263-0.134229im      -0.212086+0.214299im        0.26977+0.110864im     0.0691465+0.0545733im   -0.00811625+0.0542219im     0.0203968+0.0502776im    -0.03926-0.0503952im      0.0604806+0.0106228im     -0.157564-0.139573im      0.102804+0.0876913im
 -0.00689454-0.101179im      0.0530063+0.114332im    -0.0781355-0.200429im      -0.0303229+0.0092335im     -0.180283+0.218386im   -0.0625282-0.136805im   -0.0929207-0.201717im      -0.0453061+0.0501525im      0.178851-0.180063im       0.031982-0.14031im     -0.0981466-0.135906im      -0.173098+0.167625im    -0.0225105-0.0213187im    -0.0499054+0.10365im     -0.000238741+0.0804421im      0.325478+0.0827128im      0.112351-0.0911723im     -0.107058-0.0433975im     0.0738295+0.167515im      0.0247087+0.121901im     -0.309932-0.0779492im    0.0472862-0.19563im       0.132878-0.171438im     -0.0734315+0.168845im      0.0762505-0.122185im   -0.00708835-0.0025201im    -0.0152021+0.0457923im    -0.0575531+0.0298661im    -0.19727+0.115974im       -0.156244-0.0778145im    -0.0423843-0.202582im    0.00630477-0.0722526im
   0.0315238+0.194584im      0.0442919+0.045816im    -0.0518082+0.00590817im    -0.0990621-0.0150778im    -0.0572266+0.244638im     -0.13155-0.0289986im   -0.115895+0.110288im      -0.0610026-0.233963im      -0.185499+0.279753im       0.234981+0.0670213im    0.0385573+0.285288im     -0.0481424-0.0492834im    0.0861716-0.0387199im    -0.0777773-0.0313546im      0.0883069+0.155825im      0.0410836+0.220467im     -0.0675627+0.137873im      -0.220409+0.0372477im    -0.0646742+0.0730895im     -0.139523-0.0382703im    -0.277504+0.072965im     0.0421938+0.116432im      0.107068+0.027543im     -0.0149765-0.0201135im     -0.193915+0.0208893im    -0.054331+0.0328464im     0.0041228-0.145212im      -0.110052-0.0746472im   0.0511565+0.0326075im      -0.225414+0.195295im      0.0330791+0.137643im      0.108883-0.0276452im
  0.00462849-0.0195697im    -0.0980366+0.0298532im    0.0220764-0.0033213im       -0.19779+0.03983im        0.151525+0.013171im    0.0698795+0.069857im   0.00134334-0.0655024im      0.0832799+0.149334im      -0.110367+0.00838123im  -0.00418969+0.0737888im    -0.102089-0.0323446im     -0.138357+0.0931519im     0.254838-0.27414im        -0.29534-0.0652708im     -0.0436184+0.181164im      0.0403544-0.0795082im      0.087328+0.106554im    0.000169222+0.12458im       0.0411598-0.135018im      -0.115572+0.0992623im    -0.026211+0.00936442im   -0.247695+0.0509988im    -0.135305+0.0196882im    -0.0410475-0.133869im     0.00761042-0.184325im    -0.0349357+0.0678689im      0.156373+0.0597298im    -0.0142957+0.0819504im   0.0610208-0.36832im        0.0109402-0.0409573im    0.00715315-0.193489im      0.148172-0.306785im
  -0.0081451-0.12435im       0.0480365-0.139956im      -0.10626+0.0843621im      0.0908231-0.110337im      0.0272427-0.128966im    -0.192166-0.0823143im   -0.172135-0.0185882im     -0.0606221-0.0685314im     0.0715564+0.192017im      -0.107707+0.136045im    -0.0736655+0.0177056im    -0.0467014+0.0579913im    -0.144558+0.0467679im      0.023445-0.154006im       -0.132695-0.00320566im    0.0413526-0.223248im       0.210393+0.283834im      0.0334059+0.0403833im      0.086081+0.03035im       0.0693765+0.184593im    -0.0541032-0.143472im    -0.0627323-0.208531im      0.171438+0.131564im      -0.131661-0.3298im         0.197869+0.0294467im    -0.121139+0.0300759im      0.088902-0.153786im      0.0651699+0.0961613im  -0.0736588-0.0647573im      -0.126249+0.206782im      -0.117543+0.0543786im   -0.0474604+0.133785im
   -0.133744-0.0341104im     0.0647948+0.179739im     -0.030719-0.141104im       0.0522576+0.116385im       0.083109+0.0648704im  -0.0167083-0.0025402im   0.0550342+0.153755im      -0.0232922+0.135595im     -0.0037852+0.0397788im     0.0106742-0.069071im      0.134316+0.0164061im      0.178837-0.0274642im    0.0257835+0.0126068im      0.212014+0.0112341im      -0.131702+0.0987863im       0.20263+0.125572im      0.0266632+0.00407549im    -0.055086-0.0672769im       0.18342+0.218552im     -0.0947424-0.0956443im     0.119071-0.119602im    0.00172685+0.228107im     -0.198053+0.125127im      -0.158613-0.315486im      0.0149457-0.343311im     -0.194587-0.127283im     -0.0779567+0.0246302im     0.0374149+0.0118602im   -0.143417+0.135619im        0.192717+0.101232im      -0.125738+0.00623556im    0.109088-0.0239273im
  0.00669372+0.0503004im      0.213846+0.143954im     0.0913517-0.139799im        0.135985-0.0791185im     -0.066274+0.159723im    0.0624746+0.113086im     0.106347+0.243245im         0.25231+0.127074im       0.011978-0.0389409im    -0.0501899+0.0631587im     0.101989+0.103638im      0.0547435-0.0268859im    -0.126557+0.0807321im    -0.0779752-0.0206761im     -0.0152298+0.000549703im  -0.0799894-0.0146827im     -0.141026+0.215474im       0.130812-0.116942im      -0.165224+0.0238424im     0.0938995-0.0169417im   -0.0181013-0.0337899im    -0.108478-0.246622im      0.122209-0.0347249im    -0.0466973-0.202668im      0.0344735+0.0274871im      0.17171+0.1566im        -0.152159-0.01386im      -0.0056159+0.0475553im   0.0954587+0.18627im       -0.0591607+0.015751im      0.0226525-0.143254im     -0.057301-0.437649im

and then generate the state $ψ$

psi = P[:, 3]
32-element Vector{ComplexF64}:
   -0.1618959762468179 + 0.06077345296315615im
  -0.16161575385330945 - 0.08773940537174724im
   0.12333713783118624 + 0.059527413746401636im
   -0.0503137489644757 + 0.0583047393142391im
   -0.0403155248419717 - 0.03296116303078862im
  -0.16503795193979257 - 0.08093913656409657im
 -0.033075386009976414 + 0.08475464504884092im
  -0.16763759361718264 - 0.11279472312999034im
   -0.1222253594434076 + 0.16441504125754655im
   0.22262601000966337 + 0.0832340498158133im
   0.03431953044988106 + 0.20277177563267643im
  0.017289547498438942 - 0.06736617068945386im
 -0.021010880823474607 - 0.02478992644542189im
  0.004387216961397142 + 0.23478660389350778im
   -0.1996676593506908 - 0.06432035371671872im
   0.11217344950385882 + 0.1551166018033406im
    0.1043597669294414 - 0.07948695728805198im
   0.02824670778767206 + 0.019809357077584064im
   0.11431450740175725 - 0.07316875986092015im
   -0.1480586084341524 + 0.21026322544373116im
  0.010965440945219942 + 0.017630492931488856im
   -0.1532705805280993 - 0.05694266751306547im
   0.06929090378460714 - 0.09226840561562649im
   0.23463391544217393 - 0.17761090110682132im
   0.14925999729309247 - 0.22073956061092914im
   0.07562493432034696 + 0.0017034348736148924im
  -0.07096908590582642 - 0.028201527673375897im
 -0.004982112487040186 - 0.06293132984002803im
     0.442336914323011 + 0.0im
 -0.010624983585855594 - 0.018551381016223424im
   0.06656915543178787 - 0.09859872641958532im
  -0.05816822395818354 - 0.11539874813409078im

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.