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.200838-0.117537im     0.0762065-0.152334im       0.118478-0.124053im       -0.120892+0.0916947im     0.104422-0.0557409im    0.0783116-0.0335823im     -0.0445706+0.0546121im       -0.15697-0.110034im      0.129205+0.174086im      -0.139609-0.140515im       -0.103454-0.0745083im      0.043513-0.364809im       -0.141143-0.0444892im    -0.0149996+0.0353333im    -0.124589+0.0272658im     -0.044724+0.187735im      0.131048-0.171418im     0.110018-0.0168934im   -0.0680386-0.205116im      -0.221732-0.171531im       0.0917863+0.250905im     -0.145997+0.0162553im     -0.203057-0.11988im       0.152487-0.0784513im   -0.0469047-0.0716109im    -0.118068-0.119555im    0.00459937+0.0312941im   0.0629784+0.048813im     -0.0710461-0.128684im     0.00871929-0.0748655im      0.10907-0.10546im       -0.170284-0.0512735im
 -0.0223484-0.068833im     -0.278389+0.0201747im      0.173655-0.0686034im     -0.0869783+0.0902157im   -0.0782403-0.0618012im    -0.149471+0.075652im       -0.104164-0.0502098im       0.106707+0.0860199im     0.207568+0.0302533im     -0.122035+0.0803737im     -0.0351335-0.129158im      0.0162095+0.130944im        0.019414+0.0837775im     -0.125482+0.138673im     -0.144904-0.0288059im      0.117476-0.0958164im     0.315838+0.139956im    -0.088522-0.265005im     0.0536782-0.0635013im      0.168143-0.1604im        0.00302653+0.058282im     0.0367347-0.0664796im      0.260073+0.118506im      0.176189-0.0038562im     0.129171+0.0927836im   -0.0733015+0.0667312im   -0.0667752-0.0595897im    0.186614+0.0838388im      0.119592+0.0537358im     -0.134859-0.0634577im      -0.0905-0.181808im      -0.211883+0.132324im
 -0.0413817+0.0649906im   -0.0037489+0.0861555im     -0.256483-0.252185im       -0.102763-0.0474555im    0.0868833-0.00641904im  -0.0299934-0.108496im    -0.000660782-0.0148467im     -0.0562152+0.0879289im   0.00292456+0.0534286im      0.116663-0.0888463im       0.120832-0.0435743im      0.126836+0.203143im      -0.0445834-0.050441im      -0.105593+0.31134im      -0.152526+0.0914541im     0.0863291+0.096614im     -0.251068+0.0196899im    0.111542-0.185896im      0.112395-0.0626033im      0.138143-0.112664im        0.167611+0.328157im    -0.0467675+0.0259489im    -0.0147079-0.0672395im    -0.166859-0.181542im     0.0911767-0.110577im     0.0650432+0.205174im     0.0651955+0.0287725im   0.0118595-0.0174122im     0.0572161+0.19495im      -0.0299013-0.120969im      0.103998+0.0680555im      0.179235-0.118799im
  -0.200722+0.180213im     0.0684581-0.075759im      -0.124938-0.151742im       0.0721381-0.298636im    -0.0285974+0.0770929im     0.170984+0.0636095im      -0.126176-0.0589002im      0.0421202+0.0788066im    0.0965572+0.219918im       0.111335+0.00549649im     0.0532979-0.00388962im    0.0158037-0.0714928im    -0.00670321-0.0465779im     -0.113201-0.182028im     -0.203602-0.103231im       0.285813+0.0249945im   -0.0272595-0.0742582im   -0.236108+0.00451638im  -0.0110523+0.146222im     -0.0945273+0.0239967im     -0.0330937-0.0490889im    -0.135102+0.00198536im      0.19821-0.0518946im    -0.102252+0.121181im     -0.185251-0.149252im    -0.0407187+0.0633291im    0.0201181-0.174904im   -0.0332565+0.246773im       0.266087-0.0758589im      0.145633+0.0992935im   -0.0295204-0.0513323im    -0.0802407+0.0264264im
 -0.0709542-0.264013im    -0.0017838-0.0192337im     -0.035868-0.202376im       -0.124362-0.0283116im   -0.0690935-0.147466im      0.147945-0.195693im      -0.0500004-0.082947im        0.203358-0.241705im    -0.0221709+0.0626604im      0.019549+0.113591im       -0.166799-0.00312499im    0.0665464+0.0281921im      -0.175418+0.289766im     0.00198154-0.063486im     0.0557731+0.0564731im        0.1008-0.0407978im    -0.139372+0.105649im    0.0721097+0.0229955im    -0.189227+0.266377im       0.190565-0.137747im       0.0172097-0.0640169im    -0.118614+0.0272381im      0.072073-0.0653687im   0.00570633+0.0774736im    -0.110641-0.160232im      0.123568-0.261411im    0.00183926-0.131466im    0.0519524-0.0726309im     -0.217478+0.103974im      -0.120713-0.0499979im   0.00914764-0.000274222im   0.0803604+0.145909im
  -0.206329-0.101754im      0.104867+0.0424966im       0.07289+0.0679801im      0.0559811+0.147761im     0.0983523-0.0648461im    -0.247983-0.132976im     -0.00466127+0.107143im       -0.109141-0.0446622im    -0.258772+0.142037im       0.125073-0.0134353im     -0.0277997-0.190362im      0.0464139+0.0714979im     -0.0787343-0.0500963im     -0.117575+0.0487537im    -0.163916-0.0444822im     -0.160731+0.12108im     -0.0752693+0.256055im    -0.111467+0.0756352im    -0.117969+0.0995972im     -0.104563+0.115763im        0.138326+0.129405im    -0.0398052+0.151249im     -0.0209464+0.156522im     0.0466113+0.097306im     0.0611584+0.096501im     0.0968321+0.058119im     0.0338858-0.152049im     0.106487-0.0675423im      0.108121-0.186459im       0.132228+0.108513im      -0.29935+0.0266377im      0.101813+0.250145im
 -0.0606961+0.173796im      0.234796+0.07675im      -0.0511946+0.0362041im      -0.046852-0.140028im    -0.0778331-0.048806im     -0.154464-0.0676366im       -0.24411-0.166948im        -0.11526-0.119686im     0.0388446-0.136186im      0.0471352-0.148555im      -0.0756492+0.10426im       0.0302377+0.0604429im     -0.0164859-0.119304im     -0.0606308+0.0899191im    -0.334011+0.0884878im     -0.117437+0.038849im    -0.0998182-0.165276im    0.0320289-0.0685809im   -0.0438143-0.111887im       0.063749+0.174378im       -0.159032-0.193489im      0.147672-0.161879im     -0.0626008+0.168318im      0.161003-0.0291869im    0.0225367-0.0894561im      0.13058-0.235185im    0.00391903-0.180976im   -0.0472923-0.168122im      0.0675633+0.0533629im     -0.212059-0.0236249im    0.0702853-0.071277im      -0.148953+0.0998537im
  -0.277607+0.185522im     0.0192697-0.0187506im    0.00898461+0.0518851im     -0.0398647-0.0979361im   -0.0429091-0.0853924im   -0.0759513+0.148058im       -0.110613+0.170597im       0.0185362-0.153875im     -0.043791-0.117015im       0.128732-0.0333934im      0.0228067-0.169907im       0.135432+0.0227449im      -0.160987-0.100392im       0.088517-0.0456044im   0.00251363-0.122791im     -0.0195392+0.0864951im   -0.0364321-0.128535im    0.0885482-0.0766237im    -0.244943+0.0214638im       0.29789-0.0839136im     -0.0654795-0.105908im       0.14089+0.207686im    0.000637521-0.0916821im    -0.234421+0.170633im    -0.0237542+0.149805im     -0.240099+0.0961402im   -0.0929676+0.249625im     0.166384-0.0218712im     -0.109964+0.00441112im   -0.0891398-0.0377932im    -0.123587+0.0289677im     -0.134094-0.133793im
   0.224034+0.0719282im     0.124733-0.238576im    -0.00331922+0.0783375im      0.0546485-0.00789544im    0.146277+0.155098im     0.0472772-0.118833im       -0.131158+0.000724306im     0.252935-0.0211329im    0.0614122-0.0315088im    -0.0707064+0.192001im       0.0218229+0.0863917im     0.0946921-0.0951501im      0.0639228+0.0557311im    -0.0503157+0.236695im     -0.184137-0.201659im      0.0183788-0.00307393im    0.178301+0.015569im      0.10102+0.122093im     -0.165842+0.270813im      0.0207748-0.0656955im      0.0369427+0.0250937im     0.135588+0.0371603im     -0.168828+0.13854im      -0.107498-0.143693im     0.0970355-0.1625im       -0.195427-0.08724im       0.137728+0.11457im     0.0107242-0.162153im       0.225959-0.0417358im     0.0623852-0.121157im     -0.147159-0.0412401im     0.0586639-0.0598259im
 -0.0717147-0.185225im    -0.0623169+0.0837225im   -0.00139216+0.236987im         0.17757+0.0376311im    -0.172923+0.0627286im    0.0548733-0.149277im      -0.0958104+0.125902im      0.00994541+0.0567707im       0.2179-0.128073im      -0.272132-0.218229im    -0.000885236+0.343497im      0.0573452+0.0795275im      0.0877699+0.0746731im     0.0360204+0.0275727im    -0.211423-0.0738527im    -0.0256182+0.157377im     0.0564418-0.0696778im   0.0410573-0.0902339im    -0.149709+0.0383869im      0.133423-0.0689737im     -0.0475013+0.0911097im   -0.0468677+0.129803im     -0.0783714-0.0378035im    -0.104925+0.217847im     0.0711251+0.0174555im     0.123761+0.146998im     0.0214071-0.0626949im    -0.10317+0.238604im     -0.0613553-0.145808im    -0.00974028+0.0496552im      0.10407+0.13742im        0.150458+0.121782im
  -0.120048+0.135306im      0.174853-0.09847im      -0.0935137+0.0782808im       0.203561+0.0175844im     0.129231-0.0712977im   -0.0257161-0.0773312im       0.199708-0.00613386im     0.0340606-0.163935im     0.0803475-0.106232im     -0.0144257-0.136618im       -0.244244-0.279599im      -0.145439+0.135905im         0.25497+0.0531844im    -0.0147366+0.0793683im     0.126654+0.160997im    -0.00524064-0.0142839im    0.0429787-0.0572532im   0.0436181-0.186987im     -0.125296+0.117908im     -0.0181653-0.0741583im      -0.287707+0.11215im     -0.0894688-0.183451im      0.0829467+0.0443331im   -0.0319638-0.0489275im  -0.00574149-0.00188234im    0.179684-0.0647853im     0.103315+0.141875im   -0.0329015+0.23471im     -0.00748296-0.0589105im      0.139102-0.126946im     -0.137077-0.165483im      0.0468364-0.0764756im
 0.00704524+0.0775914im    0.0662893-0.0147294im      -0.21698-0.0281486im      -0.194965+0.18855im      -0.208808+0.0219471im     0.168503+0.095244im         0.25738-0.0424147im      0.0361636+0.154259im    -0.0845825+0.0157183im      0.178911+0.00416778im     0.0880908+0.109724im      -0.156255+0.10697im       -0.0553642-0.133105im      0.0895325+0.232551im    -0.0320208-0.0851783im     -0.234519+0.1955im         0.13366-0.0947447im   0.0859935+0.188634im     0.0369824+0.147983im     -0.0427627-0.189644im      -0.0107277-0.0529135im    -0.107928+0.00368919im    0.0246163+0.240484im     0.0625033+0.187238im    -0.0175116-0.131302im     0.0119161-0.0179836im    -0.161738-0.0848352im    0.133166+0.203023im     -0.0927694-0.00634422im    -0.125355-0.0143976im   -0.0795638-0.16377im      -0.0338734-0.0409937im
   0.176284-0.0047935im   -0.0801651+0.0595716im      0.128658-0.165844im        0.130427+0.154648im      0.128725-0.119963im    -0.0752805+0.0436145im      -0.118394-0.0120449im      -0.118306+0.0578001im    0.0576349-0.18039im        0.260409-0.152742im      8.30284e-5+0.126532im     -0.0123554-0.0965305im      -0.348684-0.108742im      0.0173077+0.0147204im    0.0374005-0.0421903im      0.151564-0.189253im      0.146275+0.0379744im  -0.0281856-0.192753im     0.0137405+0.104866im     -0.0205354+0.0950679im      -0.250541+0.0205895im   -0.0660479+0.26802im       -0.150555+0.00790564im   0.0874581+0.0952161im    0.0267664-0.242669im      0.130787-0.0289909im   -0.0151523+0.0594886im  0.00568783+0.0524477im  -0.000795996+0.0344627im     0.0572185+0.115104im     -0.076813-0.178815im       0.182847-0.148821im
   0.177958-0.220752im      0.116882-0.040373im     -0.0348042+0.0456338im      -0.121129-0.107338im     -0.106633+0.0623949im   -0.0665398-0.0974694im       0.180305-0.0281367im     -0.0688089-0.00753308im   -0.103324-0.257238im      0.0837676-0.104939im      -0.0953216-0.0642806im    -0.0767536-0.0659458im       0.110314-0.11178im       -0.349119-0.0830691im  -0.00327573+0.142077im        0.19886+0.159689im      0.164728-0.0448659im  0.00448157+0.0594067im   -0.0970518-0.00463814im   -0.0442624-0.0675774im       0.117234+0.0355656im     0.125715+0.386604im       0.251184-0.0617287im   -0.0641204-0.0439214im    0.0703455-0.0889905im    0.0293135-0.00178873im   -0.122138+0.019077im    -0.257143-0.057992im      0.0051924+0.0695306im    -0.0359672+0.0153594im   -0.0457741-0.0116511im     -0.203499-0.00980575im
  -0.045477-0.142135im     -0.133392-0.074175im       -0.10233+0.136422im       -0.197141-0.0775495im    -0.113008+0.00345542im   0.0595507+0.00148452im    -0.0513589-0.0938992im      -0.168585+0.167315im     -0.111476-0.0512614im      9.793e-5-0.0656306im      0.0871793-0.204938im      0.0198735-0.260202im        0.214599-0.0269332im      0.116469+0.181192im     -0.193162-0.18622im        0.130198-0.100482im    -0.0504492-0.0416329im   -0.158049-0.113024im     0.0182709-0.0916377im     0.0580727-0.0471443im      -0.099304-0.21985im      -0.204391+0.0261226im    0.00399481+0.116457im    -0.0194516-0.0583474im    0.0924456-0.0450434im    0.0378874-0.125321im     0.0897199+0.119537im    0.0176816-0.0796384im     -0.301545+0.0963126im      0.296789-0.0424963im    -0.132049+0.0930407im       0.10157+0.0970102im
 -0.0623512-0.0393935im   -0.0857218-0.329718im      -0.145003+0.090189im        0.248022-0.259992im     0.0821778+0.111413im     -0.064644+0.0163313im      0.0699384+0.0574552im       0.012753+0.0527493im     0.113433+0.0219041im     0.0488081+0.172615im       -0.133116+0.070265im      -0.249844+0.000500315im    -0.146683-0.122506im      0.0334343+0.0280683im    -0.052091-0.00414247im    -0.349047-0.128118im     -0.084819+0.113208im     0.102521-0.137503im     0.0361101-0.150035im       0.109891-0.2209im         0.0758898+0.00696186im   0.0296239+0.0910351im     0.0904056-0.0932841im    0.0888011+0.0587975im   0.00627054-0.179811im     0.0974981-0.0245697im    -0.081102+0.0605836im   0.0390227-0.13403im      0.00640562+0.0892995im      0.174337+0.236905im     0.0870711+0.000514061im   -0.083871+0.129601im
 -0.0414539+0.105968im    -0.0415712+0.0526933im     0.0828932+0.252325im       0.0435425+0.163785im     -0.101106-0.352095im    -0.0835251+0.0858032im        0.10814+0.0427595im     -0.0988693-0.0998482im   -0.0756476+0.0356563im    -0.0699867+0.223157im       0.0713226+0.0438662im     -0.140741+0.101155im       -0.119697+0.105002im      0.0170592+0.0769767im    -0.204062-0.182183im       0.215492-0.0436228im    -0.136009-0.181039im    0.0566741+0.230569im      0.116411+0.0147462im       0.12357-0.118785im     -0.00757056+0.0567795im    -0.170923+0.0928128im      0.078058-0.146002im    0.00318821-0.12443im      0.0134684+0.0492697im     0.198012-0.138836im    -0.0187233+0.107539im    -0.175331-0.079123im       0.221576-0.0786764im     0.0887932+0.00263778im    0.113444-0.1284im       -0.0811678-0.0637522im
  0.0525654-0.0313093im   -0.0752167-0.0336906im    -0.0723941+0.127457im      -0.0168222+0.0866302im   -0.0605657+0.10737im      0.0585338-0.0312177im    -0.00830149-0.295006im       -0.222972-0.131154im      0.174039+0.0670946im    -0.0613963+0.141422im       0.0581763-0.239547im      0.0455773-0.101058im       -0.141252+0.0192163im      0.104948-0.106442im    -0.0505578-0.0365518im     -0.267011+0.0583211im   -0.0702922-0.0446329im   -0.313408-0.04466im      0.0447064+0.284817im       0.115508+0.125522im     0.000279373+0.122951im      0.258161+0.0246823im    -0.0172238-0.121181im    -0.0731651-0.184581im      0.142908-0.0728189im    0.0542159+0.111055im     -0.230896-0.0494336im   -0.130669+0.119344im      -0.101017-0.0472366im    -0.0296924-0.0753185im     0.025606-0.165211im      0.0360283-0.0353133im
  0.0626141+0.140797im     0.0434165+0.183225im      0.0850165-0.0381818im     0.00876348-0.0415566im     0.090907-0.104027im      0.253033-0.314486im       0.0743986+0.0493599im      -0.372973-0.0721112im   0.00358784+0.0381256im     -0.197864+0.196306im       0.0646108+0.0765773im     0.0298183+0.0108447im     -0.0942327-0.0748397im     0.0644519+0.137731im    -0.0517106-0.0554323im     0.0015556-0.0666719im     0.151433+0.2117im       0.104629+0.00243547im   -0.173272-0.175893im     -0.0315871-0.0530269im     -0.0651812-0.090168im      0.141638-0.0982378im      0.174658-0.0424989im   -0.0513273-0.0514467im    -0.197287-0.0689656im    0.0621674+0.0472677im    -0.114611-0.0551825im  -0.0393258+0.110054im      -0.031582+0.103484im      0.0310543+0.0459863im    -0.291769+0.190993im     -0.0681186-0.119223im
  -0.150354+0.0630718im    0.0646664+0.0394307im    -0.0271336+0.128121im        0.193543-0.0967938im   -0.0836721-0.137236im    0.00395752-0.142454im       -0.212749-0.135927im        0.156258+0.0726397im    -0.100835-0.0136856im     0.0626089+0.0924344im      0.0601877+0.0997276im     0.0437242-0.126557im       -0.181168+0.0467502im     -0.134964+0.125216im      0.256732-0.0025934im     0.0604745-0.0528463im   -0.0867324+0.06358im    -0.0619584-0.0102827im    0.0689907-0.0785645im     -0.267124-0.225419im       -0.198781+0.105619im    -0.0116544-0.0398565im     0.0341221+0.203114im    -0.0358084+0.0373224im     0.160765-0.0128627im    -0.034826+0.18267im      -0.280322+0.0128884im   -0.155688-0.101801im       -0.14208-0.150093im       0.014145-0.287755im      0.045868+0.0700822im      -0.10707+0.0655933im
  -0.024309-0.0762674im     0.176192-0.0759696im    0.00265455-0.175073im       -0.169838-0.151961im     -0.042484-0.0965396im     0.110113+0.0873508im       -0.21282-0.210184im      -0.0988607-0.139745im     0.0385881-0.174205im      -0.148659-0.0437554im      0.0958424-0.108217im      -0.398862+0.0678341im    -0.00512993+0.0655711im       0.29489-0.0196037im    0.0642416+0.0139767im     0.0947981+0.0648929im    0.0632218+0.0868853im    0.123093+0.0554435im    0.0590041-0.0476094im    -0.0969059-0.0549233im     0.00433955+0.0870755im    0.0802641+0.0284933im    -0.0140796-0.0293165im   -0.0821388+0.200011im      0.340029+0.113963im     -0.012695-0.00960872im  -0.0676611-0.0730542im   0.0793238-0.0590286im      0.251839-0.0173398im     0.0912875+0.062932im    -0.0498779+0.0702599im      0.179501+0.00972119im
 0.00457869-0.243506im      0.124821-0.00034678im   -0.0721733-0.0220477im       0.117883-0.101635im     -0.251079-0.0386795im   -0.0581817-0.0447976im       0.107725+0.0460387im     -0.0838639-0.0659175im    0.0331232-0.0655479im    0.00378272-0.123013im     -0.00975634+0.134598im    -0.00457181-0.0923711im      -0.102682-0.252929im        0.12259-0.144562im    -0.0691063-0.00164236im    0.0840826-0.066103im    -0.0937174+0.179272im    0.0134874+0.085007im    -0.0478094+0.0716619im     0.0765914-0.0156035im       0.153572-0.136582im    -0.0599384-0.222093im      0.0332267-0.049871im      0.285661-0.0888717im   -0.0506672+0.0151863im    -0.101944+0.229903im    -0.0152115+0.265477im    0.0540133+0.0206808im      0.188477+0.0232882im   -0.00171359-0.373535im     -0.102126-0.165922im       0.142274+0.0466617im
  0.0367767-0.0147098im   -0.0430849-0.149384im        0.01265-0.114645im        0.222525+0.0210523im   -0.0726666-0.00359603im    0.039268-0.0846816im      -0.229746+0.158078im      -0.0685859-0.084489im     -0.185431+0.0567442im     0.0236859-0.141834im        0.129646+0.0281606im    -0.0740966+0.191452im       0.0959228-0.0387007im      0.131905+0.158322im     0.0105989+0.125272im      0.0327381+0.134551im        0.1671+0.175778im    -0.127173+0.175294im     0.0094601+0.140862im     -0.0167316-0.0121609im      -0.107874-0.179683im    -0.0247297+0.0516533im    -0.0835241-0.241786im    -0.0595986-0.197416im     0.0652051+0.0182531im    0.0793443+0.144496im     0.0961235-0.135113im     0.153793-0.0573614im     -0.168481+0.0865884im      0.135006-0.0472806im      0.19409-0.158871im      -0.338347-0.00499332im
   0.156025+0.00167008im   0.0479685-0.0889192im   -0.00634871-0.0909636im     -0.0944531+0.0544505im    -0.116906+0.0959345im     -0.30382-0.0933367im      0.0159414+0.0169692im     -0.0733259-0.130287im      0.068915+0.0554396im     0.0715129+0.0118503im      -0.129785+0.034033im    -0.00871589+0.021529im      -0.0554623+0.0351156im     0.0635192-0.105802im      0.121309-0.213735im       0.117424+0.0435247im   -0.0840412-0.0978196im  -0.0752474+0.130415im    -0.0516213-0.271982im     0.00334019-0.278888im       -0.149109-0.0683326im     0.260448+0.0768141im      0.101834+0.218741im    -0.0977501-0.238311im     -0.112357-0.038986im     0.0553312+0.0944025im     0.140441-0.141636im     0.250899+0.142048im     -0.0238119-0.165442im      0.0975691+0.0159376im     0.165515-5.26389e-5im      0.19293+0.0305508im
  0.0137976+0.0756372im    -0.107572+0.126163im      0.0518014+0.0902166im      0.0116643+0.0932229im    -0.306752+0.108009im    -0.0646035+0.165748im       0.0992871-0.111376im        0.082823-0.220419im     -0.101222-0.0422762im   -1.11512e-5+0.0262918im      0.0523047-0.0452122im     -0.184414-0.170133im        0.104267-0.0108244im    -0.0995273+0.0162314im    0.0380916+0.017121im      0.0840847+0.100525im     0.0479412+0.163307im     0.102047-0.157115im    -0.0624534-0.0418429im      0.136306+0.149193im      -0.0747474+0.168086im    -0.0692549-0.0995774im     -0.239184-0.0497508im    -0.105051-0.0316307im    -0.232756-0.354332im     0.0427358+0.0716524im    -0.164195-0.0775024im    0.225052-0.104556im       0.136006-0.0591229im      0.114834-0.0480284im    0.0248109+0.220891im     -0.0975514+0.0531644im
 -0.0446365+0.0402155im   -0.0738892+0.207819im     -0.0194587+0.16202im      -0.00981021+0.0224273im    0.0149424+0.186104im     0.0748955-0.0822223im      0.0262434+0.101965im       -0.210892-0.169844im    0.00315724-0.00186741im    0.0810592-0.123212im       0.0462536+0.107345im      0.0245755-0.0655603im      -0.243468+0.111553im     -0.0723824-0.0247108im     0.121227+0.142665im      -0.075661-0.133558im     0.0800373-0.0836369im   0.0868893-0.00881441im   0.0219122+0.0990253im    0.00556728+0.102977im        0.175221-0.0509758im    -0.103018-0.0678453im      0.268124+0.194221im     -0.206598-0.0105997im     0.312957-0.0778942im    -0.113627-0.20494im       0.121493+0.0699782im    0.221116+0.0998964im      0.126798+0.0425269im      0.221802-0.0914469im     0.189761+0.026157im      -0.117272+0.0784308im
   0.100652+0.0454726im    0.0369772-0.0280654im      0.271388+0.000733465im   -0.0694984-0.0104123im   0.00540291+0.195989im    -0.0698861-0.118345im      -0.0209264+0.189594im        0.130016-0.01288im     -0.0528113+0.145796im      0.0926311-0.194672im      -0.0523234+0.0823482im     -0.185685+0.00781614im   -0.00586488+0.0652858im     0.0309059-0.03957im      0.0363264-0.133615im      -0.015958-0.0493568im    -0.144967-0.215427im   -0.0427311-0.239212im    -0.0203887+0.0388205im     0.0278635-0.149464im        0.209006-0.169782im     -0.111778-0.0944799im     -0.122004-0.0843177im   -0.0242902-0.119717im      0.150506+0.102156im      0.140955-0.0259165im    -0.339147-0.243475im   -0.0654939+0.030424im      0.0624533+0.0878735im     0.0663263-0.103792im      -0.26491+0.0445648im    -0.0388835-0.192452im
  -0.129881-0.0489643im     0.390556+0.0122436im     0.0374232+0.0813449im      -0.275324+0.191938im     0.0714703-0.0313858im   -0.0248559+0.163387im      -0.0715422+0.0571292im      0.0551964-0.00390008im    0.330945+0.0690134im     0.0913298+0.0862422im       0.178017+0.276335im     -0.0171518+0.0794584im      0.0646382-0.106356im      0.0763704-0.154577im      0.114762+0.0133675im      0.036334-0.034282im    0.00344642+0.0672279im  -0.0222868-0.100038im      0.128817+0.0600348im     0.0705315+0.000865338im    0.0252559+0.136009im     0.0868425+0.0316745im     0.0386791+0.00590499im  -0.0266069-0.060491im    -0.0352058-0.0827237im     0.152565+0.0462171im     0.186881+0.0401451im   -0.061197-0.0777389im     -0.190524+0.0546393im      0.204629-0.0749631im    -0.199633+0.047295im      -0.237779+0.133186im
   0.111601+0.079712im      0.187769+0.233914im      -0.127657+0.0289422im    -0.00826562-0.016967im     0.0979384-0.134154im     0.0137178+0.0783343im      -0.043007+0.124784im        0.165278+0.0578321im    -0.194562-0.11167im       -0.172837-0.0267819im      -0.145156-0.085496im      -0.102135-0.0122076im      -0.110718-0.133976im    -0.00625858-0.174241im     -0.211745-0.207636im    -0.00819063+0.0188229im     0.100713+0.16262im      0.158019-0.258035im       0.25522+0.155257im      -0.150122-0.0630629im       0.061951-0.0753743im    0.0468132-0.0154096im     0.0191529-0.0918903im    -0.162905-0.250482im    -0.0432277+0.0262652im    -0.109118-0.0973273im   -0.0900148-0.0242818im   0.0478436+0.139541im      -0.187019-0.0763488im   -0.00753139+0.0208812im     0.142455-0.0394304im     0.0710015+0.215332im
   0.054216+0.130353im     -0.143519-0.0474482im     -0.213315-0.05215im        0.0714241+0.102823im      0.223272-0.0840349im     0.060704-0.0378957im     -0.0567016-0.0713463im    -0.00681449-0.011658im     -0.292598+0.215258im       0.127299+0.0227656im       0.159454+0.283944im      -0.114572-0.252298im        0.240411+0.00756101im    0.0400882-0.230419im    -0.0476289+0.106828im      0.0232548+0.0692686im     0.075216+0.0103545im  -0.0233869-0.107007im    -0.0884338-0.152977im       0.194878-0.057539im     -0.00159956+0.0590765im     0.152263+0.0732579im     0.0613248-0.0766358im   0.00494225+0.019258im      0.138555+0.0796477im     0.169438-0.157902im    -0.0233187+0.12114im      0.096255+0.0873448im     0.0466535-0.128393im      -0.184021-0.179667im    -0.0824613-0.0531347im     0.0546163+0.136643im
  0.0763095-0.0223839im   -0.0839615+0.108214im      -0.180197-0.214026im        0.065823+0.0945526im    -0.209942+0.249108im    -0.0898981-0.068927im       -0.048094+0.199311im       0.0737824-0.0562913im    0.0863673-0.00407542im   -0.0941305+0.204024im     -0.00223459-0.0393177im    -0.0964845-0.105211im       -0.178087-0.133827im     -0.0723078+0.168032im      0.090427-0.0820875im    0.00988453+0.30982im     -0.0944122+0.0493817im  -0.0647198-0.144348im      0.152181-0.0553519im    -0.0334446+0.099964im       -0.103538-0.0542834im     0.053128-0.0409103im      0.109934-0.164485im     0.0029772+0.21319im      0.0235487+0.164975im     0.0553213-0.284687im      0.229415+0.0224508im   -0.144781-0.0642929im   -0.00465433-0.14125im       0.0627312-0.139337im     -0.128055-0.0263457im    -0.0271556-0.109707im
  -0.216624-0.156276im     0.0225487-0.0713559im      0.178344+0.0881362im     -0.0610847-0.0651755im   -0.0602904-0.0532807im      0.36806-0.145501im        0.197303+0.237518im     -0.00391159+0.184385im     0.0900052-0.0428242im      0.238628-0.0338162im      -0.103157+0.0432796im    -0.0226607-0.0467058im       0.079019-0.0640966im        0.1035+0.129211im     0.0564293-0.10365im        0.115182+0.048691im    -0.0990299+0.126033im     -0.12194-0.132641im     0.0785646+0.051231im    -2.35957e-5+0.152307im       -0.141649+0.0821926im     0.216475-0.0105734im     0.0443225+0.0223814im   -0.0652407-0.180664im     0.0420711+0.0535366im    0.0514875-0.148011im    -0.0779388+0.0165308im    0.182381-0.16448im        0.168398-0.175139im      -0.205224+0.0830145im     0.152571-0.0158448im     0.0113454-0.0401725im

and then generate the state $ψ$

psi = P[:, 3]
32-element Vector{ComplexF64}:
    0.1378678468141358 + 0.0407824652086543im
  0.005124144644891575 - 0.08400385696963306im
   -0.0969649129493187 + 0.06363418457622648im
  -0.05540242716893569 - 0.04232154429187627im
   0.11145567576364929 + 0.1010535215425691im
   0.07950455451320299 - 0.07799632671509084im
  -0.21252366018479216 + 0.07641270299035581im
   0.12059034372714317 - 0.01972248878975173im
  -0.09151431614293168 + 0.09527915756572257im
   0.01647390106654733 + 0.03953320632452361im
    0.2394022553315128 - 0.06107838719204015im
    0.0603841253872635 + 0.07017901569246064im
   -0.1837987814644506 - 0.03523049484972634im
  -0.06727684867410853 - 0.02876175497014945im
  -0.03772791990978954 - 0.14602294912715114im
  -0.30063274494734293 - 0.007592672990536771im
 0.0009218340888652121 + 0.03440427946340063im
   0.08431398324498707 + 0.00605331226275776im
   -0.1720947583341672 - 0.05924666315284285im
  -0.02679835795271187 + 0.1603008633414325im
   0.08476270098133848 - 0.03587170057960595im
   0.08207885184698667 + 0.04438704712741568im
   0.18598762436417776 - 0.16212849366640575im
  -0.06657538643913502 - 0.0025439382522762575im
  -0.29691722131047243 - 0.10015337815583687im
   0.04564032863656614 + 0.17537831193491596im
  -0.04749731577672657 - 0.2226818563933793im
   -0.1713877302833126 - 0.07158229644908358im
   0.16231267853829426 + 0.15625091239746047im
    0.0462840965513795 + 0.19574155687985367im
   0.34210306716648564 + 0.0im
    0.1170725176728909 - 0.14422713241999605im

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.