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.234052+0.268097im    -0.219767+0.0193754im     0.0284397+0.0682119im       0.151715-0.0795874im     0.0461023+0.0192528im    -0.0209897-0.0480185im      -0.104286+0.129313im     0.0328682+0.143994im     -0.150172-0.236146im       0.113079-0.146772im      0.0225094+0.139373im      -0.0718955-0.0366354im     0.169031-0.00569791im    0.105923+0.0786207im   0.0934774-0.0516257im      -0.266471+0.199907im       0.0967335+0.0857892im      0.102568+0.187449im     -0.0161074-0.0518071im    0.0938414+0.217445im    -0.0429903+0.0553892im   -0.0248183-0.0374499im    -0.233711+0.080225im      -0.126331+0.0975094im    0.0587825-0.0290336im      0.235338+0.058468im      -0.0221616+0.0216024im   -0.0344348-0.00615225im  -0.0326063-0.0991206im      0.198979-0.0384482im   -0.00148173-0.240107im       0.165193-0.103383im
    0.154325+0.0939976im    0.172756+0.216051im      0.0677279+0.115274im       0.0401433-0.00302155im   -0.0440611-0.158916im        0.13309+0.0555258im       0.145389+0.0351136im   -0.0776031+0.105391im     -0.123452+0.025875im       0.129396+0.0638291im   -0.00491438+0.183269im        0.150992+0.146536im      0.201762-0.138276im      0.100949-0.0267537im   0.0901676+0.0745463im     -0.0843573+0.000517841im    0.0416485-0.106989im      0.0508729-0.0372042im     -0.113677+0.0498507im    -0.269185-0.0709212im     0.186572-0.00398885im   0.0945963+0.119353im     0.0898688-0.165282im      0.0443239-0.0825683im     0.108159-0.0745597im      0.181916-0.0944767im        0.21241-0.0202044im     0.142111-0.0823513im     0.285987-0.00816433im      -0.1084-0.117969im      0.0752076+0.161794im       0.191775+0.239851im
   0.0780013-0.0923936im   0.0355853-0.110899im       0.361628+0.285409im       -0.133793+0.161304im      -0.113924-0.0379952im     0.0885432-0.0549388im      -0.279085-0.0819944im    0.0729976+0.0178338im    0.0789586+0.0221515im     0.0476687+0.125502im     -0.0266978-0.139495im      -0.0298064+0.161706im    -0.0526797+0.0592895im     0.123673+0.0132579im  -0.0847091+0.0714952im       0.154998-0.145546im       0.0154714-0.0697442im       0.12762+0.081458im       0.109494-0.283035im     0.0262042-0.0756635im    0.0357435-0.0431234im   -0.0605256-0.187831im     -0.128471+0.270311im      -0.153143-0.0125623im   -0.0662089+0.0865975im      0.132572-0.0734758im      0.0215331-0.0165099im   -0.0134363+0.0682196im     0.101328-0.188702im      0.0558533-0.2011im        0.0958873+0.0108353im    0.00893236+0.166898im
   0.0375201-0.0143837im  -0.0648031+0.00812163im     -0.11458+0.169578im        0.256796+0.145679im       0.122779+0.142262im     -0.0353413+0.119476im      -0.0431265+0.0604156im      0.02373-0.0472931im   -0.0118122+0.273566im      -0.122315+0.0158711im     -0.208612-0.0326513im       0.113098-0.11946im     -0.0606141-0.11993im     -0.0451324-0.0129874im    0.122096+0.226564im      -0.0951566+0.108967im         0.11484-0.109276im      0.0486564+0.100887im       -0.14192+0.0971151im   -0.0803545-0.121254im     -0.124375-0.100856im     0.0114797-0.101317im     -0.207897+0.219694im       0.167302+0.00215621im   0.0590263-0.149149im      -0.207343-0.0552599im     -0.0691508+0.246885im     -0.301038-0.0408745im    0.0900294-0.113793im     0.00938265+0.0544362im     -0.010855+0.0805159im     0.0781956+0.161567im
   0.0908666+0.12071im     0.0879479-0.0488778im      0.130408-0.121878im       -0.082423+0.0821043im     0.0155224+0.0127562im     0.0184484+0.0980153im     -0.0581204+0.0463647im    0.0348266+0.257693im    -0.0599087+0.192861im       0.127274+0.2282im        -0.112082+0.115642im       0.0314092+0.15007im      -0.211202+0.0361428im    0.0129914+0.177589im   -0.0598675-0.179139im      -0.0839382+0.0341158im      -0.116732+0.25267im      -0.0951226+0.073838im      0.0573595+0.0518456im     0.116996+0.126482im    -0.0642799-0.305317im    -0.0532884-0.106308im      0.100447-0.107966im       0.005871-0.02907im       0.117515-0.0847658im     0.0715781+0.0850877im      0.0728126+0.217115im     -0.190186+0.0431108im   -0.0129436+0.0420992im     -0.232718-0.134138im      -0.294978+0.0782253im    -0.0406822-0.0607946im
  0.00809159+0.339504im     0.304159-0.00954234im    0.0751318-0.0338409im      0.0397752-0.00249058im   -0.0238767+0.00445945im     0.163756+0.134519im      0.00810011-0.127324im     -0.103881-0.207193im    -0.0152292-0.0435481im    0.00831137-0.112146im       0.114719+0.181104im       0.0157951+0.131092im     -0.144026-0.110968im     0.0583425-0.205998im     0.137635+0.0415705im       0.189957-0.0139369im      0.0377913+0.07406im        0.104077+0.00790283im    -0.109562-0.145075im     0.0525887-0.0856932im    -0.412259+0.0145886im   -0.0110903+0.191941im    -0.0885829-0.0526317im     0.0433575-0.0309395im   -0.0774827+0.224834im     -0.0456255+0.106587im       -0.127536+0.157203im    -0.0105154-0.119565im     0.0333631-0.0488488im    -0.0686753-0.0901297im    -0.0235594-0.148568im     -0.0653886-0.063233im
   0.0895914-0.0240123im   0.0398945+0.136697im     -0.0012803+0.0326891im      -0.129879+0.254678im       0.010866+0.2995im       -0.0261898+0.229094im        0.116892-0.0711187im    -0.104737-0.112103im     -0.190144+0.0144991im   -0.00756637-0.0256074im   -0.00799959-0.0451657im     -0.0856702-0.105814im     -0.218987+0.19609im     -0.0103809-0.0256136im  -0.0174987-0.00598934im    -0.0840773-0.223609im        0.222138+0.00154331im     0.237565-0.0691192im    -0.0389144+0.193888im       0.12732-0.0159377im     0.083804-0.121545im     0.0800541-0.114425im      0.125616-0.0447579im    -0.0656341+0.0538145im    -0.207857-0.0695533im      0.156902+0.0993165im       0.183185+0.149098im      0.185775-0.0069299im    0.0082895-0.0701798im     0.0360735+0.127435im       0.143284-0.14284im        0.143776-0.106505im
    0.125318+0.0149194im  0.00914852+0.0831209im    -0.0502931+0.132191im     0.000954975+0.0150163im     0.0595243-0.0330689im    -0.0755104+0.187319im        0.260675-0.0437713im     0.200629+0.413001im    -0.0917448-0.0118219im     0.0162268-0.0134272im     -0.120574-0.233482im      -0.0858072+0.0237918im    0.0435837-0.00607715im   0.0748282-0.122639im     0.169588+0.0499794im      0.0590643-0.200674im       0.0456443+0.0452447im   -0.00115743-0.0208914im    -0.0312971-0.0975367im    0.0794684-0.102433im    -0.0157586+0.0925721im    -0.215886+0.049548im     -0.024242-0.0379312im     -0.083619-0.307757im      0.123932+0.0460844im     -0.150575+0.106322im      0.00333741-0.23246im     -0.0868892+0.0407256im    -0.155956-0.0977362im     -0.197322+0.133285im    -0.00667885-0.216773im    -0.00928004+0.0355537im
   -0.178999+0.0636565im   -0.024239+0.195715im      -0.147131+0.102463im      -0.0103805+0.100691im     0.00300386+0.28163im       0.0232144-0.20163im       0.00655018-0.113456im     0.0520277+0.170504im      0.129396+0.243449im     -0.0864113+0.0585137im      0.239207-0.132425im      -0.0110364+0.160196im     0.0106783+0.168102im    -0.0389444+0.0974339im    0.322109-0.211625im       -0.122817+0.16233im       -0.0466458+0.0459675im      0.169209+0.0970891im     -0.145262-0.140219im     -0.044088-0.0160449im     -0.12022+0.0844762im     0.071378+0.0252397im     0.122943+0.0123317im     -0.193586+0.0267654im    0.0742785-0.0367921im    -0.0627655-0.143509im       -0.111129+0.00811093im    0.127415+0.0679195im     0.100269+0.0903586im    -0.0717248-0.119265im       0.143077+0.0427646im    -0.0104718-0.0992817im
  -0.0704166+0.0760707im   0.0711685+0.0245324im      0.101541-0.0909328im      0.0865995-0.0541718im     0.0142437+0.0169214im      0.155605-0.096745im        0.312545+0.151467im     0.0228326-0.0888316im  0.000921198+0.0904606im      0.447606+0.272291im     0.00311916-0.0500053im      -0.191746+0.102797im     -0.126195-0.103297im    -0.0102947+0.0413659im  -0.0378333+0.0844284im     -0.0879444-0.0825376im     -0.0152975-0.0169376im     0.0297899+0.0382147im    -0.0391299+0.0329154im     0.155232+0.0369074im    0.0234276+0.205823im      0.242638-0.149233im    -0.0635322+0.230937im     2.40675e-5+0.0700883im   -0.0151772-0.00525313im   -0.0794118-0.101056im     -0.00318855-0.129069im    -0.0996279-0.0941122im     0.147586+0.206485im      0.0329782+0.168692im      0.0218569-0.165738im      -0.125515+0.0162206im
   0.0498037-0.143308im     0.088141+0.098616im      -0.159448+0.055943im        0.112472-0.0534933im    -0.0354004+0.171691im      -0.260336+0.000409945im   -0.0726441+0.0246067im    0.0652732-0.0077593im     0.247963-0.00221619im     0.100717+0.053143im      0.0484758+0.174962im       -0.183008-0.0312192im    -0.309659-0.0202571im   -0.0851169-0.125279im    -0.020089+0.0340082im     -0.0653397+0.0303877im     -0.0721617-0.0945511im    0.00374371+0.180778im      0.0470964+0.12823im      0.0433262+0.114788im     0.0233995+0.0900503im    -0.187059+0.122226im    -0.0110118-0.0292254im    -0.0995794+0.00547424im   0.0989961+0.0699026im      0.134409-0.0758303im      0.0547997-0.0169531im     0.218721-0.284521im    -0.0724908-0.168642im     -0.0380162-0.0867579im     -0.157136-0.0536531im     -0.142541+0.357256im
   0.0604386-0.125502im    -0.337351+0.0579707im     0.0223536+0.0821737im      -0.175044-0.0740522im    -0.0279657-0.0429629im      0.121315+0.0565753im      -0.122561-0.0482287im    -0.110113-0.100747im     0.0430778-0.00377394im     0.143461+0.192571im      0.0946348-0.0116412im       0.071915+0.335093im    -0.0176184+0.0442027im    0.0053597-0.0228195im    0.014611-0.0747884im     -0.0388419-0.0487184im       0.150309-0.0344064im    -0.0253775+0.243746im      -0.215786+0.343686im    -0.0709717-0.0631076im   -0.0512891-0.023027im    -0.0657781+0.0745553im   -0.0804511-0.209828im       0.230025+0.0217566im    -0.150774-0.0637153im     -0.127068+0.000456074im    -0.104222-0.218672im    -0.0803147+0.0375978im    -0.131513-0.138416im    -0.00316428-0.125196im       0.026004-0.142855im     -0.0484663-0.0421467im
   -0.130038-0.0930415im   0.0525177-0.092163im      0.0734939+0.163914im      -0.0355678+0.00240604im   -0.0258707-0.0824355im     0.0278152+0.273362im        0.121239+0.137927im     -0.284065-0.0058525im    0.0290343+0.228521im      0.0694486-0.268236im     0.00410972+0.000196952im    0.0655208-0.108821im      0.171664+0.104538im    -0.0859612+0.0358956im   0.0809227-0.0199619im      0.0857503-0.0264419im      0.0573814+0.289553im     -0.0048724+0.0721994im     -0.136325-0.0605566im    -0.240275+0.267531im     0.0306295-0.00652158im  -0.0502891+0.00118463im  -0.0433391+0.15852im        -0.13219+0.122234im     -0.127508-0.166517im      0.0477033-0.00981212im      0.023543-0.118944im      0.068594-0.0215489im    0.0115059-0.033742im      -0.050102-0.00569201im    -0.159829-0.0856047im     -0.330403+0.0567399im
   0.0919385+0.0426848im   0.0988333+0.206445im      0.0254859+0.19429im        0.0656034+0.0984732im     -0.142164-0.110306im     -0.0818741-0.0257107im        0.17539+0.00969812im  -0.0216022-0.0922276im     0.179041-0.0705691im     0.0574559-0.165727im       0.109918-0.0363556im     -0.0839636-0.0179361im    0.0375311-0.0971388im    -0.131012+0.436394im    -0.160298+0.0530394im      -0.100751-0.143461im       -0.068086-0.11707im       -0.078894+0.01432im       -0.223428-0.0410563im    0.0277806-0.139038im     -0.160919-0.119234im      0.219946-0.0735914im   -0.0179398-0.0266351im    -0.0359327+0.0422233im     0.156854+0.0894042im    -0.0441306+0.0410336im      0.0659784-0.0297143im    0.0441437+0.090652im     -0.283012-0.237474im      0.0203584-0.0297011im     -0.127805+0.13941im      -0.0283644-0.136471im
    0.078095+0.0730401im   -0.016883-0.0162315im    -0.0898041+0.150693im      -0.0338345+0.0329621im     0.0166474-0.0906625im    -0.0876407-0.0397267im     -0.0806279-0.0188434im     0.109676-0.0056124im     0.073427-0.0832334im     0.0269704+0.0797639im    -0.0832477+0.150511im       0.0881575-0.0925054im    0.0246863+0.00961922im  -0.0757394+0.0270117im    0.274981+0.315838im     0.000395498-0.174938im      -0.0364569+0.168088im      0.0632771-0.210252im      -0.076986+0.276465im       0.17548+0.0475006im    0.0870762+0.144866im    -0.0779722-0.11166im      -0.122584-0.0359933im      -0.21338+0.0832298im     -0.23338+0.155572im     -0.0697608-0.110586im      -0.0506588-0.0822688im   -0.0051741-0.0227617im    0.0834679+0.122416im      -0.116457-0.23393im       -0.128006+0.252072im      0.0138039-0.234057im
  -0.0455232+0.014659im     -0.13349-0.0708211im      0.220546-0.187624im      -0.0643588-0.177214im       0.113178-0.064534im      -0.100208+0.103267im        0.151253+0.013898im     -0.147225+0.0638748im   0.00120746-0.0318313im     -0.170425+0.171761im      0.0512817+0.0108408im     -0.0571501+0.119679im     0.0311668-0.00655773im    -0.17227-0.0324233im  -0.0751513+0.260126im      -0.0290226+0.313796im       0.0403294-0.0767349im      0.146188+0.0119301im     0.0230096+0.0677756im     -0.04759-0.152156im    -0.0165679-0.0547851im    0.0705131-0.143833im    -0.0742582-0.132659im       -0.39004+0.0262092im    0.0104298+0.0814359im     0.0257125+0.0421325im      -0.169403+0.068303im      0.111355+0.106176im     0.0992466-0.239769im      -0.190509+0.200512im     -0.0146527+0.0332234im    -0.0903977+0.0272794im
  -0.0258926+0.0788448im   0.0751506+0.291801im      0.0166076-0.081944im      -0.0375044-0.10323im      -0.0860895+0.203801im      0.0316738-0.105631im       -0.047654-0.0325393im    0.0777005-0.155812im    -0.0016002-0.00461653im    -0.256488+0.0901838im    -0.0426686-0.0298436im     -0.0369305+0.107931im      0.129843+0.0985437im   -0.0378136-0.0698496im  -0.0184847+0.0465729im     -0.0267936-0.0196217im     -0.0706045+0.432618im      -0.100273-0.0735239im      0.129997+0.119126im    -0.0618691-0.0224416im   -0.0993313+0.00912451im   0.0705102-0.0610555im    -0.134477+0.230219im        0.19922+0.0304739im    0.0614088+0.0429803im     0.0390324+0.0651772im       0.129347-0.277237im     0.0813336+0.0896937im     0.136512-0.229704im     -0.0476457+0.125047im      -0.218956-0.0202724im      0.155782+0.0860666im
    0.131413-0.206732im     0.197425+0.132397im      0.0547605-0.186489im     -0.00393096-0.0751954im    -0.0372192-0.14194im       0.0849711+0.0769678im      -0.267589-0.086637im      0.045754+0.158133im     -0.119414-0.0853304im    -0.0552005-0.0382709im     -0.195668+0.0598797im      0.0467489-0.0965144im    0.0904235+0.111972im     -0.213125+0.22788im     0.0642639+0.100133im      -0.0612707-0.00876786im     -0.135302+0.0369294im     0.0977959+0.356635im    -0.00965089-0.0766129im     0.200616-0.0461138im   -0.0373083+0.168474im      0.125188+0.0779693im     0.180529-0.00497344im     0.110826-0.0124858im    -0.138389-0.0555271im     -0.201036-0.0414736im      0.0255716+0.0335408im    0.0679935-0.129633im      0.172213-0.128092im       0.013141+0.0875848im      0.110566-0.0672765im     -0.145449-0.0542747im
    0.101188+0.279092im   -0.0260569-0.121319im      -0.142518-0.0249616im       0.197355-0.312452im      -0.270694+0.2172im         0.196761+0.0983495im      -0.140381+0.102374im    -0.0267778-0.0112243im    0.0103188+0.178343im       0.124733-0.0971897im     -0.200074-0.154815im       -0.125812+0.164816im      0.115622+0.010356im     -0.129244+0.0310199im  -0.0524586+0.00721928im      0.048492-0.0349478im     -0.0557728-0.0647033im     0.0423768-0.15623im        0.139572+0.0464101im     0.110874-0.0782118im     0.148933-0.0703626im   0.00670128+0.0716324im   -0.0663006+0.0339256im   -0.00397519-0.105072im    -0.0896129-0.193593im     -0.0184567-0.0281773im     -0.0842426+0.0622546im     0.232523+0.00779011im   -0.174374-0.0934809im     -0.118835-0.0941313im       0.14433+0.118898im     -0.0703333-0.0377577im
  -0.0988302-0.147856im     0.091162-0.0535671im     -0.188032-0.0751458im     -0.0956546-0.0226524im   -0.00472025+0.0380953im     0.0997893+0.0428919im      0.0334364-0.151373im    -0.0716769-0.098744im    -0.0631703-0.0418991im     0.0173245+0.0337557im    -0.0228624+0.240161im       0.0026291+0.00218009im    0.307297+0.172991im      0.127277+0.111419im    -0.116388-0.066087im        0.160884-0.0171915im      0.0803393-0.187152im      -0.175752+0.018537im      -0.112761+0.203293im      0.218022+0.0977934im   -0.0759036-0.050304im     -0.049651-0.0902848im   -0.0907986+0.251503im       -0.24328-0.107724im      0.290799-0.0126069im      -0.17289+0.00242383im   -0.00129051+0.0875511im    0.0793561+0.00375745im   0.0697307+0.0208306im     -0.169822-0.160612im      0.0465577-0.184256im       0.137051+0.0582499im
  -0.0649227+0.0475203im   -0.105207+0.063793im       0.191912+0.000787413im   -0.0890569+0.0535356im    -0.0431656+0.0358949im    -0.0680793+0.0244166im       0.219198-0.118301im     0.0306636-0.104394im     0.0728176+0.242793im       -0.13035+0.0304749im   -0.00726941+0.251567im        0.165079+0.0150964im    0.0369061+0.0947635im   0.00427935-0.0158848im    -0.04966+0.0937885im      -0.163008-0.0381369im    -0.00470201-0.056064im     -0.0524021-0.10772im        0.186988-0.253142im      0.177579+0.117109im       0.12634+0.408916im     0.0135584-0.047964im     -0.139354-0.18958im        0.156807+0.088195im     0.0803925-0.222709im     -0.0686872+0.145899im      0.00836011+0.0748993im    -0.041257-0.0569083im     -0.14121-0.1472im       -0.0677768-0.194029im      0.0962501-0.0597379im    -0.0281116-0.0158785im
  -0.0250712+0.0390353im   0.0242315-0.0720809im      0.214605+0.0982363im     -0.0158562+0.0609432im     -0.152289+0.179328im     -0.0801676-0.187707im      -0.0373618-0.0682012im       0.2228+0.0921671im   -0.0794244-0.00940748im    0.0757617+0.00679064im     0.190183+0.0150864im     -0.0620086+0.0547186im    0.0534931+0.122883im     -0.160125+0.200954im   -0.0676522+0.399755im        0.118378+0.194515im         0.20515-0.0119568im    -0.0891061-0.188585im     -0.0512377+0.145423im      -0.12614+0.111065im     0.0201111-0.0510249im   -0.0978289+0.32231im       0.148363+0.0749029im     0.0742278-0.114038im     0.0319559-0.0650714im   -0.00663526+0.158342im        0.073384+0.0710864im    -0.109724-0.0828138im    0.0651765+0.0441561im     0.0678427+0.0212268im     0.0283805-0.129279im       -0.14067-0.0833702im
   0.0334357+0.0980582im   -0.151565-0.075832im      -0.162603-0.0241142im       0.111495-0.00309249im     0.112991-0.109789im     -0.0319782+0.258844im       -0.122786-0.196837im      0.214979+0.0720547im     0.116894+0.0593595im    -0.0155255-0.0417396im      0.093548+0.187088im       0.0458322-0.0136381im   -0.0931462-0.035817im     0.0410559+0.0403852im   -0.139045+0.145445im      0.00971166-0.0744743im       0.101983+0.088002im       0.160598+0.0191974im      0.175714+0.0144764im    -0.244359+0.0357049im    0.0889543-0.0510462im     0.352373-0.0730177im     0.200904+0.175388im       0.136843+0.0611141im      0.14496+0.15964im        0.034475-0.105407im      -0.0942567-0.109982im     0.0705247+0.0967415im   -0.0904434+0.0761647im     -0.208255-0.106954im      0.0979359-0.226855im     -0.0435211-0.0506776im
 -0.00127319+0.0488868im   0.0981639-0.093946im      0.0330569+0.00972599im     -0.132043-0.193906im      -0.307713-0.00814545im    -0.200455-0.0655322im      0.0659972-0.0115136im    0.0279509+0.0869678im    0.0981924+0.0497848im      0.072126+0.0703492im       -0.1504-0.0813448im      -0.157982-0.177281im      0.101018+0.236514im      0.119203-0.0996656im   0.0968648+0.00271788im    -0.0155186+0.0337702im       0.256338-0.181407im     -0.0819818+0.222948im      0.0778509-0.0881853im    -0.230223-0.136999im     -0.050291+0.0176728im      0.13575-0.0304129im   -0.0415914-0.053269im      0.0908705+0.19262im      -0.150046+0.0795641im    -0.0912382-0.0290452im       0.068709+0.133307im     0.0399215-0.062489im    -0.0273695+0.117235im      -0.153071-0.0463702im     -0.277497-0.072659im       0.213813-0.122702im
  -0.0945527-0.167411im    0.0680496+0.0106669im     0.0602053+0.16955im         0.107735-0.319906im     -0.0417132+0.0285802im    -0.0540767-0.0126875im    -0.00742373-0.070691im    -0.0300148-0.0302398im    0.0733292+0.273087im      0.0749646+0.0198358im    0.00386822-0.122433im        0.210746+0.0294591im     0.181235-0.0217956im    -0.035012-0.139005im    0.0212571+0.144025im       0.0535781-0.0496637im     -0.0260499+0.132467im      0.0670105+0.184164im      -0.103216+0.0527075im     0.256861+0.101144im     0.0817431-0.0911963im   -0.0387799-0.0503127im    0.0602312-0.119548im      0.0966141+0.0806323im     0.227133+0.369707im       0.245553+0.0948739im      0.0693032+0.155033im    -0.0435021+0.0430989im   -0.0929978+0.0943462im     0.0793459+0.150707im        0.15235-0.00445396im    0.0737303-0.0914398im
  -0.0574374-0.0985444im    0.123412+0.106053im      -0.151856-0.0176147im      -0.170159+0.0270455im     0.0371211-0.0141529im      0.158808+0.0700315im      -0.196124+0.198943im    -0.0913878+0.167245im      0.173991+0.00723098im    0.0316575-0.113669im      -0.194414-0.0841123im     -0.0545308+0.0214292im    -0.238767+0.0187036im     0.126556-0.110324im    0.0135689+0.155063im     -0.00402262+0.220157im       0.0958612-0.149828im       -0.13037-0.135622im       -0.14517-0.059606im      0.115785+0.0625968im    0.0382027+0.0292225im     0.182275+0.0887079im   0.00122022+0.0304708im    -0.0062384+0.242141im      0.137053-0.0130873im      0.110611+0.380442im      -0.0471838-0.247713im    -0.0603999+0.0372391im     0.101632-0.061262im       -0.07771-0.0770593im     0.0831302+0.0637813im     0.0370808-0.125002im
    0.150814+0.0364103im   0.0345091-0.0283173im   -0.00790583-0.0210073im      -0.116447+0.178972im       0.182834-0.121264im       0.192613-0.249767im       0.0973695-0.0265154im   -0.0670681-0.114173im      0.112372+0.00263558im   -0.0394009+0.0118894im    -0.0985032-0.0693398im      -0.240161-0.016313im     0.0498887+0.11214im       0.262216-0.197179im    0.0601528+0.178343im      -0.0331228+0.016222im       -0.075529+0.154478im       0.119751+0.152976im      0.0532344+0.06812im       -0.02759+0.15066im       0.246132-0.148549im       0.10434+0.269394im    -0.0454038-0.0212666im    -0.0208211-0.00981618im    0.190491-0.00731039im    -0.227737-0.130559im       0.0661447+0.193385im     0.0630348+0.0557207im    -0.163042-0.144949im       0.052802+0.0248619im   -0.00815053+0.0623798im     -0.139175-0.102061im
   -0.104408-0.253969im     0.064283-0.203056im     -0.0653898+0.0650186im       -0.03824-0.232826im       0.278889+0.0948599im   -0.00593417-0.0351337im      0.0866322-0.105439im      0.084227+0.141656im     -0.130701-0.146913im       0.156878+0.1163im         0.131048-0.0713119im    -0.00727422-0.0654472im    0.0230979-0.054957im     0.0491211+0.0279801im   0.0397863+0.0613157im      -0.227379-0.168203im      -0.0685434-0.0184131im     0.0497041-0.171273im     -0.0885915-0.136673im     0.0150392+0.0830349im    -0.125431-0.107651im      0.069247+0.124974im     -0.165349+0.0524231im      0.274683+0.061418im     -0.103391-0.0788988im      0.034943+0.100185im       -0.115142+0.170029im      0.279984+0.203061im      0.098504-0.141228im     -0.0489988-0.130666im      -0.111155+0.0458032im    -0.0425026+0.0534998im
    0.175017+0.227792im   -0.0174802-0.115557im       0.118245-0.0262362im      -0.070848-0.0453879im     0.0394842-0.155284im      -0.200476+0.0133866im    -0.00755039+0.149862im    0.00455167+0.0364857im   0.00425743+0.286963im      -0.121236+0.0819585im      0.154454+0.0963581im       0.154288-0.0758564im    -0.062772+0.266123im      0.148195+0.0636808im   0.0164527-0.0325899im    -0.00457292-0.0924822im      -0.162711-0.182454im        0.13233+0.00773897im   -0.0947201+0.050544im      0.108582-0.0327591im  -0.00275015-0.198503im    -0.0282943+0.0952103im   -0.0779592+0.160387im       0.102648-0.0363438im    0.0612458+0.00135955im    -0.125213+0.18389im        -0.137244-0.259474im      0.272794-0.158287im     0.0657167+0.110343im       0.188353+0.14795im      -0.0246406+0.0740915im     0.0340391+0.018357im
   -0.125131-0.112956im   -0.0394386+0.178513im       0.065125+0.0125244im      0.0732592-0.0712028im    -0.0799574-0.0100637im     -0.235171+0.0564714im      -0.216411-0.0254223im    -0.184182+0.242781im      0.110453+0.0502179im     0.0287177-0.0617998im    0.00287946+0.263227im       -0.122463+0.208244im    -0.0230414+0.0348722im     0.304412-0.0172031im  -0.0318096-0.0394844im      0.0527854-0.187096im       0.0472016+0.0479358im     -0.086438-0.243313im     -0.0837175-0.00642479im   0.0220503-0.0142078im    0.0344584+0.0891028im     0.152772+0.0871962im   -0.0841692+0.0214215im   -0.00575767-0.132672im    -0.0399774-0.0754733im     0.0207884-0.251199im       -0.139708+0.196264im     -0.079413+0.0125041im    0.0461915-0.0808221im      0.117145+0.331932im     -0.0531384+0.0248125im   -0.00704367-0.142566im
  -0.0518964+0.063389im   -0.0429633+0.283575im       0.179765-0.120246im       0.0134273-0.208485im       0.281902+0.0831695im     0.0670158-0.189166im       -0.128683-0.089051im     0.0800553+0.079365im     -0.170405+0.0893061im      0.138251-0.130807im       0.087915+0.105481im       -0.231172-0.263879im     0.0406961+0.11431im     -0.0504464-0.131456im   -0.0606617-0.0103497im       0.199205-0.219432im       0.0854627+0.0239918im    0.00349639+0.0628687im    -0.0903257+0.0135177im    -0.150642-0.0905737im   -0.0111668-0.0758126im    0.0320634-0.211855im    -0.0388939-0.0919516im     -0.054983+0.042373im     0.0750189-0.105102im     0.00212785+0.134944im       -0.110597-0.0476534im    -0.128497-0.167696im     -0.101532+0.002008im     -0.0213298-0.134526im      0.0984916+0.230294im     -0.0842718+0.0709663im
    0.208516+0.0629844im   0.0923935-0.0478767im     0.0858045+0.160004im       -0.209628+0.138881im     -0.0126722+0.135648im     -0.0643062+0.0764779im      -0.169668-0.00267909im  -0.0900635+0.0432503im    -0.100917+0.14214im        0.193642+0.00934709im    0.0215589+0.125169im       -0.157668-0.194641im      0.151219-0.0222978im   -0.0805345-0.12932im    -0.0299494+0.0463725im   -0.000951852+0.213888im       -0.185166+0.055038im      -0.113083-0.137402im     -0.0436041+0.0440061im    0.0928222-0.0230985im    -0.129497+0.104585im      0.106287-0.0225171im      0.11913-0.156071im      0.0468526+0.099741im    -0.0150586+0.0631071im     -0.144127-0.139165im       -0.128698-0.0697776im    0.0376425+0.367365im     -0.151499+0.103428im      0.0740133+0.0707625im      0.049081-0.0700343im     0.0824714+0.321572im

and then generate the state $ψ$

psi = P[:, 3]
32-element Vector{ComplexF64}:
 -0.015606228339675628 - 0.03547706300498433im
  0.020762120417434145 - 0.003953122531412918im
   0.07967200838075088 + 0.1901184598366373im
 0.0005888882289550451 - 0.20969885456831464im
  -0.09380266199309698 + 0.2491680390115249im
  0.033986883213380115 - 0.14905522344253308im
  -0.08762730801665783 - 0.019708721247933873im
 -0.033553710779371394 - 0.09449474962323im
   0.14673638292210334 - 0.07117455706110695im
 -0.019408618091416568 + 0.013473030750715514im
 -0.057306610126620826 + 0.20069063548498212im
   -0.1367308267808887 - 0.12701061664687913im
  -0.29798391723033135 + 0.054894215997236845im
  0.013530429575967388 - 0.08072352547233247im
 -0.027020397702259016 + 0.041896574397700226im
  -0.10701289028056092 + 0.0018570748257273999im
  0.009986412272199846 - 0.00544603148951754im
   0.14441664850516817 - 0.02050481124768798im
    0.3622864072591125 + 0.0im
   0.08249617074582685 - 0.34084146033869345im
   0.12111459758033574 - 0.03545578119752282im
  -0.11980920488346049 - 0.13947786737781692im
  0.011353016184549194 + 0.03729966947276726im
 -0.039162058827262355 - 0.10470047520707211im
 -0.021246281748410718 - 0.09652372086016439im
    0.2048352191152656 + 0.13998882162800932im
    0.0726698314868316 + 0.12958890667152068im
  0.019039425402390828 - 0.1265587636130656im
   0.08150736790820519 - 0.0028032279331350884im
    0.0694348656848195 + 0.0047497294776142375im
  -0.18983149481783934 - 0.2706445823414264im
 -0.031759969923756556 - 0.10131261272390638im

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.