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.167428-0.130758im    -0.129735+0.0317116im       -0.08544+0.255802im    -0.0155203+0.330253im    -0.0179045+0.0552106im     0.115373-0.0860921im     -0.283929+0.0533819im       0.1925-0.0385825im   -0.0671866-0.0718845im      0.066419-0.248873im       0.0796803+0.0362535im    -0.137212-0.138376im      0.150928+0.0971523im       0.213217+0.0183131im   -0.0105194-0.0774811im    -0.129218+0.208472im       -0.173927+0.0616071im     0.0368189+0.101332im      -0.049438-0.0159053im     -0.126102-0.0569038im     -0.243702-0.124764im      -0.0580691-0.0124416im     -0.154769+0.194214im      0.0767405+0.0155271im     0.0638025-0.132035im     -0.0694801-0.110563im     -0.0635543+0.0767491im     -0.124637+0.0347402im      -0.11109+0.00622941im     0.0337605-0.071892im     -0.155919-0.126119im     0.00454026+0.0706326im
    0.0541228+0.0160561im  -0.0596365-0.161882im       -0.140323-0.203041im    -0.0854305+0.140367im     -0.146954+0.084312im    -0.0367443-0.0877334im      0.103976+0.0375181im   -0.0678668-0.104663im     0.0573546+0.0998416im     -0.173376-0.242326im        0.240979+0.163418im     -0.173447+0.00387888im    0.110759-0.0942971im     -0.0716172+0.0801477im    -0.222286-0.0771068im    -0.036099-0.00180528im      0.207051+0.048387im     -0.0189488+0.0573971im     0.0186677-0.0147116im     0.0725503-0.270003im      0.0875121+0.0883924im       0.214143+0.106301im     -0.0559516-0.0114894im    -0.0901768+0.0506082im     0.0412858+0.0157848im     -0.016802-0.111262im      -0.121973-0.178778im        0.11618+0.182971im      -0.279289+0.0527825im      -0.132114+0.12091im      0.0110609+0.0107083im     -0.210984-0.164591im
    0.0967445+0.0991785im   -0.149181-0.029646im      -0.0705002-0.118738im      0.112099+0.225391im     0.0170985-0.0165558im   -0.0682847+0.139854im       0.123928+0.135869im      -0.27732-0.014236im     -0.115753+0.176573im       0.201543+0.278702im      -0.0229829-0.0832155im   -0.0255396-0.0874135im    0.0143702+0.0388589im        0.17074-0.034066im     -0.297429-0.0818861im    0.0948563+0.086751im       -0.036288+0.0650639im    -0.0103429+0.0439043im    -0.0843108-0.0981479im      0.034769+0.0455925im      0.270614-0.126606im       0.0192644+0.00112292im    0.0964117-0.101508im       0.095143+0.211564im      0.0742788+0.0218634im    0.00726799-0.084072im        0.04147+0.0408673im     -0.193313+0.0680862im     -0.196545-0.0494787im      0.0212859-0.201969im      -0.14856-0.0960835im      0.194465+0.128715im
     0.149672-0.0697645im   -0.179941+0.0771738im      -0.109871+0.085134im     -0.282973-0.288495im    -0.0946993-0.108367im      0.068697-0.0251416im     0.0578945+0.0991265im    -0.207794-0.045768im     0.0278315+0.124032im     -0.0331082+0.0536466im      0.0978048-0.0109203im    -0.103539-0.154973im    -0.0398998-0.110526im       -0.170157+0.22065im     -0.0376585+0.06094im     -0.0797259+0.0927158im      -0.208524+0.122616im      0.0216056+0.0243693im     -0.107612+0.0973014im      0.050293+0.260961im     -0.0640262-0.0393591im      -0.107288-0.00570275im    0.0546105+0.116119im      -0.146827+0.00326213im    -0.107038+0.0977432im     -0.325834-0.185166im     -0.0256684+0.110611im      0.0913649+0.213448im       0.151947-0.0558311im    -0.00419287-0.021499im     -0.134205-0.0360671im    -0.0966819+0.0328832im
   -0.0201226+0.137399im     0.113374+0.184854im       -0.138113+0.0811987im     0.228869-0.0120486im     0.122911-0.262375im     0.0784175-0.042771im     -0.0767446+0.0472832im    0.0327835-0.0908024im    0.0953034+0.0644813im     0.0371846+0.112284im       0.0778217-0.0228925im    0.0955876-0.117985im      0.301922+0.196985im      -0.0250848+0.16205im       0.158242+0.079715im     0.0357796-0.114037im       0.0880423-0.0210526im     0.0294326+0.0676951im     0.0321421+0.0618049im      0.202418-0.11173im       0.0522395+0.0749957im     -0.0138297-0.00324094im    0.0290073-0.0696568im     -0.340236+0.0949562im     0.0776893-0.0809003im     -0.201207+0.166477im      -0.117182+0.0833934im    0.00714006-0.0789684im    -0.0714553+0.156463im       -0.178819-0.140417im     0.0228474-0.287041im     -0.0512429-0.0343024im
     0.316426+0.0330351im  -0.0603413-0.0282234im       0.107365-0.14198im      0.0409113-0.00587214im   -0.175844+0.167523im     -0.213355-0.377409im      -0.194214+0.0469017im    0.0901181+0.0443531im     0.308134+0.124153im       0.190478-0.131034im       -0.188034-0.0774336im    0.0628427+0.0684383im   -0.0306292+0.0979897im      -0.193364-0.052165im    -0.0282855+0.00642788im  -0.0396315+0.143118im      -0.0883563+0.0755249im      0.165895-0.0330984im   -0.00868145+0.0843462im   -0.00632786+0.00852816im     0.125854+0.00204417im     0.0302454-0.0787575im     0.0531509+0.0262375im     -0.153414-0.109736im       0.117866-0.0815383im      0.070802-0.00363541im    0.0431369+0.172212im      -0.046706-0.0667716im      -0.10934+0.085408im       0.0158552-0.082914im      0.043034+0.0232202im     -0.120082+0.24138im
    0.0618071-0.0803802im  -0.0194188-0.0446066im     -0.0161505+0.0522638im    0.0125399+0.0616208im     0.098841+0.0144477im   -0.0364129-0.101908im       -0.16553-0.398837im     0.0418461-0.290728im     0.0290307-0.0132633im     0.0495305+0.024217im       0.0468066+0.0854061im   -0.0690374-0.1646im       0.0600134-0.0294827im      -0.115312+0.0680938im     0.161029+0.0420369im    0.0771555-0.11064im        0.0956885+0.0260476im     -0.180142+0.216934im       0.067848-0.0463564im      -0.15673+0.206319im       0.279557+0.0758075im      0.0114176-0.0475023im      0.132916-0.00815696im     0.259819-0.0502492im     -0.129208-0.0597915im      -0.10626+0.0355959im      0.330792+0.0495008im      0.131705+0.0055067im     -0.202575-0.0282812im     -0.0652684-5.15096e-5im    -0.15789+0.0336041im    -0.0275391-0.000805306im
      -0.1953-0.0505184im    0.107905-0.0130418im      -0.122728-0.154486im    -0.0823699-0.0420888im    -0.283522+0.0741959im     0.142809+0.0529819im     -0.118265+0.0225467im    -0.098525-0.16208im      -0.148957-0.0762641im     0.0245693-0.0912631im     0.00985788-0.112794im    -0.0319926+0.288094im     0.0499546-0.0418284im     -0.0148087-0.122672im     0.0673441-0.0633078im    0.0337858-0.0795293im     -0.0734727+0.0271572im     -0.109035-0.134919im      -0.121714+0.237211im       0.045164-0.0329802im       0.16478-0.122284im       0.0552509-0.00559916im     0.041126-0.0720231im     0.0613972+0.0329342im     -0.128114-0.219465im      -0.134285-0.230165im     -0.0824212+0.180271im       0.150637-0.314549im      0.0103138-0.038035im       -0.199061-0.237288im     0.0705281+0.0323557im     0.0613646+0.00131241im
    -0.198786-0.0615278im    0.136426-0.0359074im      0.0434851+0.123926im      0.012761-0.0758854im    -0.112327-0.25567im       -0.23184-0.063185im        0.10613+0.0531172im   -0.0472148+0.053677im      -0.11087-0.239909im     0.00921193-0.0509325im     -0.0990506-0.0258816im    -0.182933-0.00464897im  -0.0864608+0.357549im       -0.154081-0.169694im     -0.157158+0.282724im     -0.106556+0.108881im      -0.0347094+0.126703im      -0.131735+0.0755208im      0.130148-0.022058im     -0.0791292-0.037636im       0.152867-0.051074im        0.049081+0.0618525im      0.107679-0.0638381im     0.0176715-0.117569im       -0.02507+0.193509im     0.00344847-0.0885333im     -0.113785-0.0431195im    -0.0105393-0.107484im     -0.0405938-0.00232978im    -0.0967347+0.1747im        -0.17796-0.200675im     -0.0789519+0.0835618im
    0.0508906-0.0377355im     -0.1257-0.103496im     -0.00854065+0.101032im      0.166995-0.00360588im   -0.273227-0.0336364im     0.144697-0.000652371im  -0.0900596+0.00851405im   0.0242654-0.0249864im     0.135503+0.0242463im      -0.25389-0.0701658im      -0.135528+0.151773im     0.0379835-0.0638508im   -0.0589353+0.0684821im      0.0639908-0.0337345im    0.0336221+0.008729im      0.260781-0.108295im         0.22115-0.0518191im      0.243869+0.110105im      0.0863841+0.124737im       0.107434-0.053334im       0.141406-0.000449332im    -0.211541-0.0866767im    -0.0783879-0.038436im       0.180985-0.0068446im     -0.205703+0.144541im     -0.0222168-0.0270306im     -0.253716-0.00361751im  -0.00935995+0.120529im      0.0609012-0.301267im       0.0403373-0.00774969im   0.0345953-0.137792im      0.0912253+0.232831im
   -0.0575246+0.0979174im   -0.053627-0.0329067im      -0.166413-0.177594im     -0.233889+0.0144007im   -0.0591183-0.0789704im    0.0489547-0.0680756im     -0.300461+0.0836764im    0.0556682-0.122044im    -0.0656175-0.0647815im    0.00694534+0.14733im        -0.189233-0.22154im      -0.089035-0.0545036im     0.115642+0.020505im        0.063333-0.0460975im   -0.0514839+0.279608im     0.0916878-0.0627358im       0.113859+0.106186im      -0.131476-0.183725im     -0.0170184+0.028452im     -0.0545489-0.193109im     -0.0719464-0.0800706im      0.0683035-0.17677im      -0.0651824+0.0611912im    -0.0733822-0.0328715im     -0.253722+0.210654im       0.132667+0.197292im       0.109432+0.0164993im     0.0235044+0.283351im     -0.0245338+0.101502im        0.177656-0.106867im     0.0324505+0.0487711im     0.0131223-0.0579705im
    0.0608158+0.0641289im    0.065208+0.121053im        0.122478-0.160589im      0.153612-0.0987153im    -0.113556+0.0502961im    0.0406971-0.039889im     -0.0247663-0.100039im      -0.16708-0.00941954im   0.0203633-0.217772im    -0.00700502-0.0590855im       -0.16137+0.0279188im    -0.161119-0.0815191im    -0.169122-0.0603366im         0.1259+0.0181023im     0.163126+0.0491706im    0.0981278+0.0811275im       -0.17253-0.01761im       -0.138529+0.0716566im    -0.0853425-0.326756im      -0.126347-0.097719im     -0.0426082+0.0124501im     -0.0707505-0.242592im      -0.015852+0.10917im       -0.164587+0.155834im      0.0161679+0.0762193im     -0.294868+0.00253676im    -0.119568-0.0772014im     -0.155142-0.00482338im    -0.241361-0.108471im        -0.14292+0.0525396im     0.248476+0.119256im      0.0486977-0.0716915im
   -0.0886148+0.126424im   -0.0892376+0.204521im       -0.124374-0.222991im     0.0112981+0.213978im     -0.128751-0.112639im     -0.307473+0.0191772im     -0.150061-0.134151im     0.0139551+0.138111im     0.0941187+0.0076858im    -0.0841336+0.00534306im      0.070919+0.137576im    -0.0474117-0.0401337im    -0.199521-0.315406im       -0.194247-0.14002im      0.0815356+0.0757754im    0.0163716-0.0831689im     -0.0884931-0.160246im      -0.115091+0.0985544im     -0.133961+0.0392221im      0.150526-0.146133im      -0.153637+0.0223164im     -0.0514355+0.109041im       0.149335-0.0132151im    -0.0211873-0.0127711im    -0.0683274-0.0694498im   -0.00347368+0.070799im     -0.0433341+0.0626983im     -0.175488-0.0702522im      0.102362-0.0633045im       0.112958-0.0173752im    -0.278686-0.139757im       0.068814-0.063547im
     -0.19323-0.151772im    0.0965333-0.000826629im    -0.059556+0.162818im   -0.00679609+0.195579im     -0.078179-0.0764599im     0.218996-0.106389im        0.10767-0.150551im     -0.174511-0.115665im       0.11802-0.0929199im    -0.0229144+0.154557im       -0.198384-0.0250928im    -0.164461+0.161253im    -0.0607482-0.0211921im      -0.401649-0.00956013im   -0.109108-0.154893im        0.1413+0.0702633im     -0.0435421-0.10535im       0.0766182+0.0374357im   -0.00288641-0.0715402im     0.0508046-0.00855288im  -0.00227317+0.0869099im      -0.149882+0.0945315im      -0.26695-0.0752427im     -0.180801+0.0798008im    0.00299127-0.0802081im     0.0857773-0.0732828im       0.18482+0.0814655im    -0.0914232+0.121134im     -0.0275149+0.204509im        0.125912+0.0601926im    0.0902333-0.0164726im     0.0990164+0.00210505im
 -0.000404852-0.140399im    -0.141584-0.163911im      -0.0970036+0.0481907im     0.104108-0.119962im    -0.0586824+0.0262385im   -0.0813591-0.0907295im    -0.0511554+0.0223414im     -0.16029+0.132595im      -0.11633-0.1228im         0.078615-0.0988131im    -0.00818163-0.230521im      0.213371-0.116139im    -0.0654742+0.194918im      -0.0630179-0.116399im     0.0083216-0.362942im      0.117349-0.0178559im       0.212935-0.0529861im     -0.209505+0.087713im     -0.0407113-0.286502im       0.139601-0.136818im      -0.168167+0.126395im       0.0752947-0.0818482im     0.0332094-0.0259395im    -0.0486755-0.0828923im     0.0463163-0.0652421im     -0.140753+0.0157986im   -0.00907984+0.111828im        0.23491+0.0954734im      0.133228-0.000219247im     0.073931-0.0797784im    -0.199301+0.0779903im     0.0221548-0.00534819im
   -0.0349909+0.0281269im    -0.10427-0.000584696im     0.146992+0.113738im      0.106735+0.100828im    -0.0203626-0.106706im    -0.0252578+0.0627296im     0.0571202-0.0126646im   -0.0161613-0.00290011im   -0.107714+0.134414im      -0.235751+0.00748517im     -0.183661-0.0672116im  -0.00907913-0.0112522im   -0.0828016-0.0133701im      -0.230065+0.174041im     0.0864192-0.0742738im    -0.319423-0.206291im       -0.105076+0.197956im      -0.197541-0.241687im     -0.0282592-0.0434189im      0.108926-0.0755366im    -0.0079657-0.181419im      -0.0963684-0.14129im       0.0666967+0.0186798im      0.120886-0.00540046im    0.0677287-0.306696im       0.113433+0.166562im      -0.122422-0.0629024im      0.120308+0.205602im         -0.175-0.0335326im     -0.0818325+0.0151008im    0.0308749+0.0198928im   -0.00247863+0.18653im
    0.0372283+0.0755487im   0.0180254+0.0296873im     0.00712597+0.12334im      -0.104689-0.104158im    -0.0401459-0.00256088im  -0.0617359-0.22507im       0.0715762-0.12277im      -0.103979-0.0201464im   -0.0252428+0.0794917im     -0.298783+0.0382162im        0.10436+0.0563516im    0.0318526+0.0822109im   -0.0537551+0.323533im        0.215892-0.0457753im    0.0949664+0.0301368im     0.165042+0.166256im      -0.0874767-0.369012im      -0.118869-0.00905056im    -0.115521+0.157003im      0.0652693-0.0160496im     -0.108783-0.20912im      -0.00327576-0.0432339im     0.0984357-0.0795067im    -0.0932521+0.0574087im   -0.00255578-0.134598im        0.20594-0.0572413im       0.22885-0.15212im      -0.0800974+0.161648im     -0.0514129-0.0566917im      -0.160176-0.119025im    -0.0816973+0.0617141im     -0.109949+0.0202621im
     0.163388-0.22753im    -0.0561098+0.120155im        0.089703+0.0463019im     0.163937+0.0135434im   -0.0346781+0.0215677im    0.0130207-0.0324337im     -0.137521+0.0391654im   -0.0167274+0.169668im    -0.0145664+0.200536im      -0.265613+0.00435564im      0.125181-0.12664im       -0.15915-0.00819377im    0.107248+0.000158781im   -0.0580587+0.11487im       0.093555+0.0147092im     0.231583-0.00439362im    -0.0898935+0.225729im      -0.226496-0.112937im      -0.132317-0.197346im      0.0489131-0.00562111im    0.0451758+0.0123008im       0.117116+0.0598712im     -0.215826-0.0873041im      0.114224-0.0243911im     0.0480572+0.230254im       0.221959-0.0861642im      0.119348+0.134439im      -0.099926-0.196491im       0.143708-0.0537224im     -0.0896323-0.0164911im    0.0753257-0.16232im       -0.100388-0.139047im
   -0.0857268+0.150965im    0.0835124-0.0413845im      0.0167445+0.231457im    -0.0949262-0.0338425im   -0.0412631+0.193036im     0.0394999+0.153682im      0.0471323-0.0176475im    0.0972238-0.00551694im   0.0897289+0.180915im      0.0531323-0.0994229im       0.166586-0.0984695im    0.0518163-0.0735219im   -0.0949702-0.00132504im     0.0360492-0.166415im       0.10926+0.0848535im      0.02149-0.0957456im     -0.0108203+0.17137im        0.100818+0.00119999im    -0.122978-0.316589im       0.101832-0.299773im       0.153216-0.111167im       -0.255932+0.06561im        0.246794+0.103086im      -0.156245+0.0130626im     -0.163019+0.00632153im    0.0282381-0.229264im       0.237566-0.0647273im     0.0713802-0.0318087im   -0.00176079+0.112182im        0.102958+0.0626026im    0.0816029-0.110588im     -0.0172112+0.0721307im
     0.206779+0.0303211im   -0.270783+0.0317138im       0.112331-0.116265im     -0.112372+0.0145094im   -0.0635823-0.223498im      0.136906+0.0616387im     0.0674957-0.0530728im   -0.0408824-0.114795im    -0.0855505-0.0775552im   -0.00376422-0.0213347im       0.127569+0.0421822im    -0.101603+0.0610622im   -0.0966502+0.167932im        0.014729+0.0773594im    -0.097472-0.0570196im     0.159469-0.239006im     -0.00604336+0.105239im      -0.032392+0.111305im       0.238794+0.110634im      -0.106201-0.288681im     -0.0709346+0.0131518im      -0.155804+0.00114675im     0.113183+0.219157im      0.0711313-0.117997im       0.213098-0.0440104im    -0.0183355+0.00142687im     0.104922+0.0221087im     -0.207706-0.148675im       0.202701+0.250113im      -0.0719717-0.0493775im    0.0443938+0.128763im      0.0127022+0.0846683im
    0.0588829+0.118282im   -0.0103116-0.249861im       -0.233186-0.136381im      0.127553+0.0656162im   -0.0694979+0.0547155im    0.0496468-0.230281im       0.198668+0.276275im      0.108423+0.00434672im   0.0534503-0.108577im     -0.0495312+0.141613im       0.0257288-0.173505im     -0.217884-0.255762im     0.0205302+0.123618im      -0.0497922+0.0813931im     0.148605+0.153971im     0.0623527-0.0462449im     -0.0915435-0.0260562im   -0.00845858+0.151776im     -0.0498343-0.00198748im     0.122959+0.110612im     -0.0424688-0.125188im        0.016372+0.186658im     0.00196514+0.123723im          0.121-0.0035462im   -0.00434188-0.269308im      0.0102083+0.02692im       0.0449949-0.0781849im     0.0731766-0.173614im      0.0756076-0.088209im        0.133267+0.178893im      0.133959+0.112382im       0.134911-0.0673221im
    -0.182877+0.061629im    -0.202565+0.134047im       0.0373659-0.0937227im     0.157479+0.00778166im   -0.283634+0.0150672im     -0.21474-0.107378im       0.149453-0.139124im      0.189113-0.155883im     -0.135339+0.0273357im     0.0617484+0.00410482im      0.148525-0.185939im     0.0678106-0.194104im     -0.164517+0.0200936im      0.0571586-0.0151092im   0.00349462-0.133284im    -0.0204871-0.000237495im    0.0754796+0.14933im         0.11173-0.10006im       0.0361061+0.210658im      -0.105504+0.134559im     -0.0114243-0.090528im       -0.217665-0.188847im      -0.204464-0.203442im     -0.0968473+0.126766im       0.101432+0.0886535im    -0.0166248-0.0208829im      0.113788-0.0972096im     0.0914492-0.0276407im     0.0391978+0.0626117im      0.0213653+0.0896774im    0.0356157-0.0885605im     -0.015795-0.24199im
     0.142885+0.116029im     0.137954+0.0959916im     -0.0940807-0.0840588im   -0.0163174+0.00457018im    0.210873-0.122345im    -0.0152667-0.214553im      0.0849537+0.0826419im    -0.096639-0.120851im    -0.0745708-0.0716877im    -0.0603268-0.10799im       -0.0469415+0.11347im      0.0970513+0.155022im     0.0212148-0.0529918im       0.170224+0.0609631im    -0.089732+0.114867im     0.0377663-0.139064im        -0.13526+0.176213im      0.0568924+0.0140102im    -0.0463401-0.140809im     -0.0375511-0.152754im     -0.0655397+0.00462398im     -0.250651-0.0349197im     -0.247071-0.37829im       0.0445704-0.134361im      0.0273871-0.120058im     -0.0841236-0.0883633im     0.0813023+0.0465419im      0.135501-0.0989359im     -0.046757-0.172091im        0.261996+0.0134706im    -0.185107+0.0587731im     -0.155322+0.0632145im
  -0.00186832-0.0586314im   0.0618634+0.0172163im     -0.0112801+0.0776806im   -0.0679213+0.00463205im    0.171291+0.175143im    -0.0956288-0.232034im      0.0888523-0.097296im      0.221507-0.239889im    -0.0889522+0.0730257im      0.106771+0.00343595im     0.0879348-0.0866519im    0.0159463+0.0837102im   -0.0783241-0.0841484im    -0.00330376+0.0520398im   -0.0568089+0.0113848im     0.102019+0.00219624im    -0.0643751+0.0478108im     -0.190794+0.186585im      -0.078467-0.0762653im     0.0650425-0.0468253im      0.216208-0.153908im       -0.136485+0.128196im      -0.124197+0.00691113im    -0.130683-0.0577089im     -0.032014+0.0973291im     0.0954227+0.14892im       -0.435402-0.00621922im   -0.0788023+0.11979im        0.231228+0.0226098im      -0.188436-0.0704494im   -0.0738624+0.196913im       0.167473+0.0412416im
    -0.104799+0.115281im     0.144098+0.0664114im       0.148006+0.114853im     -0.263005+0.0270559im    0.0543199+0.00470407im   -0.121107-0.0879188im    0.00375796+0.148572im     -0.103367+0.162843im      0.072457-0.0406927im      0.127874+0.135505im        0.195454+0.0586119im    -0.119687-0.169095im     -0.086979-0.0149303im      -0.187767+0.0874359im    0.0358455-0.0435793im     0.222737-0.00445073im      0.297762+0.064331im       0.115254-0.0333679im     0.0786833-0.113067im      -0.212678+0.0279913im    -0.0585409-0.125296im      -0.0226531-0.183297im     -0.0114529-0.0898902im      0.134681-0.0686939im     -0.102231-0.287304im      0.0791349-0.060728im      -0.217346+0.0634411im     -0.105947-0.00987852im   -0.0205879-0.0421142im      -0.042177-0.234966im      0.100263-0.00871391im    -0.147077-0.135053im
     0.184075-0.0575489im   0.0484824-0.00111263im      0.150785+0.162152im    -0.0361156-0.0401211im   -0.0187965-0.0965584im     -0.11427+0.0364208im    -0.0835559+0.205566im     0.0489095-0.111168im     0.0583813+0.235104im       0.151447-0.0941162im       0.265038+0.0234581im    -0.117904+0.287197im    -0.0444873+0.12848im        -0.097807-0.0623225im   -0.0841807+0.0308295im   -0.0413433-0.0252431im      0.0380896-0.182744im       -0.25773+0.00272548im    0.0337514+0.062073im     -0.0329897-0.0451812im     0.0297677+0.0168389im      0.0179316-0.212931im      -0.137735+0.0417656im   -0.00606436+0.116524im     -0.0509447-0.0999479im      -0.18516+0.116125im      0.0562718-0.0659826im     0.0246221-0.00924888im   -0.0194689-0.166197im        0.278291+0.132803im      0.101718-0.129086im       0.315908-0.107081im
   -0.0837986+0.236028im    -0.244926-0.207057im       -0.115339+0.187316im      -0.13576-0.137319im    -0.0194975-0.00339966im  -0.0740922-0.0288265im     -0.142205-0.0493187im   -0.0270959-0.0209394im     0.289205-0.161087im     -0.0696643+0.00277005im      0.090688-0.111252im    0.00240285+0.17185im      0.0218166+0.0199438im      0.0819308+0.0280733im   -0.0731802+0.172725im     -0.183293-0.0685655im      0.0829122+0.117071im     -0.0448436-0.0245102im       -0.1046-0.117745im       0.110937+0.160107im     -0.0777556+0.345738im       -0.155843-0.0447757im    -0.0125155-0.167125im       0.114453+0.101059im       0.171905-0.0157953im      0.107959-0.0896432im    -0.0441043+0.0154002im     -0.171305-0.0420999im    -0.0551235+0.00661856im     -0.189333-0.0415669im    0.0175804+0.0677408im        0.2173-0.083448im
    -0.128412-0.305554im    0.0688891-0.242264im        0.076616-0.0864771im     0.167607+0.0583444im     0.121265+0.152023im    -0.0269854-0.0583513im    -0.0340428-0.0127459im    -0.243914-0.0498303im    -0.106332+0.146288im       0.166032+0.0801045im        0.10074+0.022571im    -0.0693304-0.140281im     0.0701651+0.0549586im     -0.0415386+0.0810396im     0.123684+0.217293im     -0.124115+0.100181im       0.0404813-0.100203im      0.0254869-0.193466im      -0.109865+0.221724im      0.0848688-0.257723im    -0.00780911+0.226632im       -0.298761-0.128409im       0.114657-0.0601741im     0.0794863-0.0390832im     0.0296458+0.0356548im    -0.0405621-0.0520647im    -0.0417613+0.0406631im     -0.190967+0.013758im      0.0926456-0.031388im       0.0376798+0.0825705im   -0.0169521+0.158936im      -0.110973-0.044332im
     0.158973+0.118629im    0.0314267+0.0583071im      -0.141313+0.0200328im     0.121079-0.0172752im    0.0815138-0.0404396im    0.0926791+0.0170233im    -0.0413579-0.164021im    -0.0742121+0.130348im      -0.09066-0.286056im      0.0900224-0.000935369im     0.241071-0.13806im      0.0386673+0.106779im      0.232599-0.137527im       -0.235173+0.0168935im    -0.130663-0.075495im     0.0751915+0.216488im        0.127784+0.103031im     0.00376759-0.0447649im    -0.0918722+0.14529im      -0.0348918-0.0396309im     -0.039258-0.122533im       -0.230346-0.0821642im      0.092278+0.215672im      -0.113949-0.0711771im     0.0487386+0.0631775im      0.216866+0.0507462im     0.0520732-0.114098im      0.0779772-0.0671421im     -0.100968-0.359362im      -0.0641188+0.109916im     0.0010018-0.0233217im     0.0554464+0.0914198im
   -0.0214913-0.0888471im  -0.0599644-0.0498073im      0.0210917-0.0941162im    0.0412092-0.141739im    -0.0205156-0.0894539im   -0.0902611-0.0137406im    -0.0486239+0.0606im        0.240818-0.13144im      -0.144137+0.00727223im    0.0360095+0.174401im       0.0731901-0.0308996im    0.0333343+0.141708im    -0.0279035-0.129086im       -0.178485-0.0258756im    -0.052075+0.116739im     -0.102258+0.254974im       0.0590095-0.108641im       0.134113+0.14739im        0.059673-0.220629im       0.110702-0.171307im      -0.212579-0.107583im      -0.0555026+0.147238im     -0.0304756-0.105775im       0.291149+0.138653im      0.0604822+0.0563872im     -0.174398+0.0653078im      0.183586-0.0154416im     0.0542598+0.0707645im     0.0158717-0.077516im       -0.189589-0.215765im      0.253042-0.0739294im     -0.146017+0.158543im
    0.0701553-0.120395im    -0.254701-0.281571im        0.136558-0.0769804im    0.0271487-0.0144302im     0.153725+0.12566im       0.136467+0.11804im       -0.131935+0.0193806im   0.00408361+0.0665372im   -0.0912357+0.0195948im     0.0126048+0.14856im       -0.0682127+0.043143im     -0.164054+0.119702im     -0.207241-0.0316925im      0.0318222-0.137163im      0.043899+0.174884im      0.037732+0.00816014im   -0.00036832+0.10334im        0.122623+0.065918im       0.152981-0.0290989im    -0.0541527+0.0173837im   -0.00903792+0.0110132im     -0.0353055+0.000626112im    -0.13064-0.0178629im     -0.376335+0.0705066im    -0.0660737-0.268166im      0.0722192+0.108603im       0.035285-0.07772im        0.142011-0.0756336im     0.0284641-0.134308im       -0.215925-0.0250536im    -0.265757-0.1782im        -0.068294-0.132821im
    0.0323303-0.0785689im   -0.061583-0.176532im       -0.112105+0.190401im     0.0632317+0.108123im     -0.197476-0.14695im     -0.0792799+0.13472im       -0.085035+0.0491835im     0.152325-0.123926im        0.2043+0.0210301im      0.049143+0.213047im       -0.122066+0.183319im      0.118403+0.0939235im    0.0693753+0.00561962im     0.0795796-0.00465658im    -0.17755-0.0997961im     0.186107+0.0680502im     -0.0429915-0.00196505im    -0.113149-0.266708im      -0.105232-0.118921im      -0.119481+0.0500078im     0.0106049-0.160487im       -0.150689+0.133914im       0.191298-0.0114802im     -0.054586-0.123394im      0.0464396-0.0392763im     -0.167435+0.141642im      -0.059533-0.00115671im    -0.024543-0.0822838im     0.0278419-0.0726489im     -0.0264864+0.139668im     0.0139296+0.159642im      -0.277113-0.257159im

and then generate the state $ψ$

psi = P[:, 3]
32-element Vector{ComplexF64}:
   -0.1340164380082891 + 0.16509670091712408im
   0.05001066392067624 + 0.04493817865537042im
   0.08874543953422813 - 0.16601926645462997im
  -0.08455008305131252 - 0.10285202300402688im
 -0.057891491681069954 + 0.21017761067162305im
  -0.13541884776065974 - 0.06789604572432145im
  -0.07791783485941942 - 0.1607953311121761im
   0.03750164160418995 + 0.03350083117021158im
  -0.04060868020412586 + 0.08935083818297057im
  -0.13049991957573387 + 0.05383751533644128im
   0.11939805570658424 - 0.012958430341912144im
   0.08726734946713441 + 0.017139716512612126im
  9.471300551757746e-5 + 0.02746419669935906im
   0.06032822776948886 + 0.08484077443758963im
    0.2909251245266513 + 0.006366579405525763im
   0.29278026674028146 + 0.009198162781643954im
   -0.2494772407304276 - 0.008210950333921482im
   0.10553214993705631 + 0.0827185016153039im
    0.3310005221541248 + 0.0im
    0.2385736693669294 + 0.1579208475636802im
   0.03497050046279891 - 0.04745489019160039im
   0.16052470141958047 - 0.11493956406551106im
   -0.1626318554711888 - 0.17812641710131774im
  -0.07237334655824586 + 0.08761284591527255im
   0.07436920943350073 + 0.012775989011164723im
  -0.04608677765237347 - 0.033666006837514875im
  -0.16908367052750528 - 0.090090579327637im
  -0.09324353650894084 - 0.07259943577258125im
  -0.11904804186000907 - 0.26074320657730643im
   -0.1466139215586288 - 0.026989596670783794im
  0.028654439102971066 + 0.000512996707737504im
   0.09005767190328584 + 0.003388870984626112im

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.