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.233621-0.0376041im     -0.109274-0.112993im    -0.0482543+0.0448902im   -0.00216562-0.0805704im       0.0207598+0.10745im     -0.0419655-0.0703554im    -0.133634-0.000458988im   -0.0274941+0.31407im      -0.050143-0.0166944im      -0.093832-0.127835im     -0.0718003-0.0432546im     0.132965+0.126885im     -0.156807-0.0719998im      0.116852+0.0521678im      0.155709+0.118966im       0.127251+0.0344027im    0.0552494+0.0516917im  -0.0374263-0.12862im      -0.151876+0.00361947im    -0.112368-0.135274im    -0.0991356+0.160726im      0.275355-0.0656404im     0.00964523-0.0982829im     0.0116629-0.231016im      0.0101848+0.0309227im       0.283913+0.272969im     0.0358588+0.0700202im      0.208081-0.00139082im   -0.0248441-0.262525im     -0.0913583-0.116122im      0.0693525-0.15427im       -0.136283-0.030213im
    0.116651+0.167786im     -0.0378146-0.041147im     0.0272683-0.112346im       0.100328+0.277953im        -0.123953+0.0289632im     0.176153-0.184756im      0.084931-0.0343415im       0.125901+0.0886075im     0.203346+0.0546789im      0.0239854+0.0243722im    -0.0616676-0.188035im    -0.0155755+0.0569704im     0.085118+0.0413081im    -0.0194073-0.116218im       0.168543+0.198719im     -0.0376208-0.0986601im   -0.0493003-0.121069im     0.106831-0.341243im      0.125569+0.00515092im    -0.024488-0.219633im       0.17413+0.0798835im    0.0570687-0.139065im        0.149342+0.148059im      0.0240578+0.0531497im      0.174307+0.115925im        0.155566+0.0441634im     0.048589-0.104219im      -0.189245-0.0959724im      0.134538+0.138191im      0.0323709+0.0830352im    -0.0896823+0.167957im      0.0418246+0.151858im
   0.0609335+0.0027465im      0.240802+0.0945315im      0.19632+0.0219012im     0.0236947+0.195971im        0.0388575-0.149812im     -0.151738-0.199303im      0.160439-0.115569im       -0.214063-0.227186im     -0.102312-0.0149706im       0.103489-0.222865im       0.115281+0.0597563im     0.159174-0.109813im      0.212761+0.047016im      0.0771772+0.0252495im     0.0817047+0.124279im     -0.0455197+0.0293436im    -0.216261-0.112211im    -0.038867+0.0203776im   -0.0338922+0.256362im      0.0732771+0.0643531im    -0.233989+0.0602014im    0.0469494-0.0476881im       0.013223-0.192464im       0.128291-0.104947im      0.0689836+0.0580463im       0.202189-0.0488705im    0.0462516+0.0675323im    -0.0866722+0.0341087im     -0.095434-0.0200917im     0.0545859+0.155447im    0.000800865-0.214121im      0.0110904+0.0952777im
   0.0361522+0.24223im       -0.178001+0.192489im    0.00589052-0.357673im       0.178605+0.102611im        0.0664575-0.249014im    -0.0235934+0.143563im    -0.0893747+0.133419im      -0.0324082+0.0959409im    -0.140491-0.116021im       -0.046519+0.125253im     -0.0331624-0.114962im     0.0834012+0.019582im     0.0446256+0.109137im      0.0398655-0.0989203im     0.0777768+0.0116103im      -0.27696-0.0553629im    0.0987371-0.0140706im  -0.0463467+0.163609im     0.0427694-0.00987342im   -0.0877591+0.239282im     -0.144749-0.0455407im      0.22992-0.0775379im    -0.00263281-0.120456im     -0.0239533-0.00528588im    -0.225003+0.0827607im      0.0250942+0.0166572im   -0.0580915-0.0885646im    -0.0397424+0.0696046im      0.280224+0.0337623im    -0.0688438-0.0992956im     -0.122111-0.06833im       0.0252266+0.00637028im
    0.156295+0.186813im      0.0668531+0.104659im      0.185822-0.0527779im     0.0181815-0.091472im        0.0932939-0.0864057im    0.0133626-0.0569909im     0.028356-0.0132759im      0.0313748-0.0546957im     0.340228+0.0627536im     -0.0503242-0.0872143im     0.0351481-0.056428im     0.0757509+0.11743im     -0.0512531-0.0638418im     0.0490499-0.154757im    -0.00633083-0.149856im    -0.00109623+0.133787im    -0.0594088-0.0877579im   0.0931932-0.189612im    -0.0236984-0.197899im     -0.0623115+0.113504im      -0.17958+0.174869im    -0.0614453+0.0619602im      0.0832364+0.165697im       -0.29035+0.140269im      -0.129454-0.166172im      -0.0983394+0.0348701im   -0.0287143-0.0189823im     0.0541619+0.288995im      -0.272768-0.0402463im     -0.175136+0.0101972im    -0.0552366-0.17791im        0.130732+0.0692666im
     -0.1187+0.13414im       0.0235823+0.0219616im     0.115578+0.16132im     -0.00147508-0.0582662im       0.0911368-0.0647755im    0.0130726+0.39448im       0.175394+0.0680227im       0.128593+0.0747657im    -0.118938-0.232801im         -0.2637-0.200749im     -0.0915019-0.0853134im   -0.0781196+0.0875217im      0.15693-0.0312157im     -0.180699-0.0405785im     0.0471905+0.202295im     0.00311602-0.0280969im    -0.131906+0.0255664im   -0.118645-0.0925554im  -0.00583815-0.164346im        0.14571+0.258279im      -0.08808+0.0897715im    -0.223848-0.0243961im      0.0500699+0.0205015im     0.0879308+0.0118465im      0.218277+0.000335929im     0.125236+0.127062im     0.0751466-0.0588228im   -0.00689101-0.0525005im    -0.0844317-0.00926153im    0.0118951-0.191214im      0.0700902+0.085473im      -0.054214+0.0582504im
    0.210966+0.0813555im     0.0893411-0.110809im      0.111995-0.0121555im     -0.307917-0.0452743im       0.0840312+0.0563825im   -0.0285023+0.0267222im     0.096532+0.0571086im      0.0140789+0.0570589im   -0.0595656-0.00348619im     0.0379065+0.0212982im      0.205978+0.0869322im    -0.102985-0.00416789im  -0.0872903-0.162014im      -0.217671+0.121657im     -0.0707801+0.0385583im     0.0175254-0.25086im       0.181096-0.0500063im    -0.17072-0.265782im     0.0223628-0.0185899im    -0.0861234+0.0966396im    -0.182422+0.0337545im     0.154063-0.113735im       -0.313105-0.0757308im     0.0109113-0.0776397im     0.0832828+0.109789im      -0.0979324-0.151707im     -0.251737-0.149783im     -0.0571145+0.155708im      0.0600575+0.0177066im    -0.0391451+0.15917im      -0.0191082+0.153433im      0.0747235+0.0233068im
     0.12338+0.0482047im      -0.30313+0.0548491im     -0.23373+0.147028im       0.123303-0.0213303im      -0.0890365-0.0737323im   -0.0338482-0.139731im     0.0046913-0.290117im        0.175955-0.171477im      0.121386-0.0251583im      -0.165365+0.12165im        0.112524+0.0880366im    0.0581366+0.0693394im     0.131306-0.171697im       0.192278-0.0472113im    -0.0804003+0.158068im      0.0666866-0.0658121im   -0.0675664+0.0919583im   0.0786522-0.0999004im   -0.0441994+0.0398726im     0.0416878+0.359418im     0.0921716-0.0616094im    0.0564016+0.0564535im      -0.356283+0.0966684im      0.111551-0.0985394im     -0.100724+0.0243776im     -0.0160087+0.0625142im    0.0368206-0.0708893im      0.025531+0.0106441im    -0.0597384+0.0808599im      0.154311+0.012638im      0.0136606-0.0382602im    -0.0643819+0.046181im
   0.0253719-0.0812078im       0.10115+0.095789im     -0.225846+0.0663889im     -0.106582+0.321547im       -0.0908996-0.0478503im   -0.0389568+0.217225im     -0.124604+0.066033im        0.153982-0.0821891im   -0.0869159+0.0593927im       -0.13766-0.00865764im    -0.143764-0.14479im      0.0171549-0.190863im      0.136611+0.118105im    -0.00669136-0.00144923im   -0.0465408+0.174031im       0.128827-0.0847525im    -0.078667+0.0743174im   -0.129777-0.188745im    -0.0041701-0.0671889im   -0.00576171-0.188235im    -0.0680037-0.130717im    -0.0686026+0.194921im      -0.0220098+0.0209525im     -0.227313-0.207344im      -0.218646+0.0052983im     -0.0730429+0.0405812im    0.0698314-0.0642544im    -0.0986377+0.194503im      0.0189437-0.14701im      -0.0702396+0.229921im    -0.00260463-0.101543im      0.0403706-0.170165im
  -0.0644207+0.0763686im    -0.0137843-0.311367im      0.184629+0.0655089im     -0.183958-0.0356605im      -0.0524704-0.23256im      0.0204855+0.0699117im    -0.283318-0.0269305im       0.185869-0.144361im     0.0554676-0.012432im          0.3821+0.05927im       -0.304779-0.039818im    -0.0489948-0.0234742im    0.0496926+0.0346618im      0.107033-0.0248389im      0.137576+0.029667im       0.123317+0.0744626im   -0.0100488-0.0576283im   0.0593603-0.043662im    0.00851157+0.0899359im     0.0128951+0.23851im      0.0676624+0.0791679im   -0.0109232+0.0272911im        0.08011-0.149715im     -0.0370852-0.21621im       0.0642567+0.0160735im     -0.0951112-0.0657341im    0.0607422+0.00935677im     0.239523+0.149546im        0.12841-0.0148575im      0.032779-0.00400396im   -0.0148725+0.114913im    -0.00596191+0.1383im
  -0.0475775-0.100535im      -0.170035-0.058234im    -0.0557149-0.06534im      -0.0806692-0.0044002im      -0.0908932-0.0309612im    -0.104623+0.131736im     0.0861059-0.405719im        0.155632-0.033606im     0.0828165-0.0876604im    -0.00184088+0.0683024im      0.229975+0.0509571im    -0.234093-0.146222im    0.00614826-0.132521im      0.0711511-0.0570214im      0.233953+0.0261935im     0.0535164+0.0736274im   -0.0540699-0.208772im   -0.0221021+0.0298572im    0.0114099-0.0769621im    -0.0130539-0.147848im      -0.31208-0.0299397im   -0.0758316+0.00232593im      0.171533-0.187874im      -0.134694+0.122138im       -0.10081+0.139258im      -0.0635133+0.0226112im    -0.126913-0.0745791im     0.0663929-0.279647im      0.0872745-0.0520262im      -0.17701-0.0175481im      0.044308-0.0194148im    -0.0507529+0.0545623im
    -0.11416+0.11497im       -0.128162+0.00947026im   0.0881181+0.00802001im     0.284641-0.0565459im       0.0319462-0.111268im     -0.242028+0.124019im      0.100997+0.168404im      0.00941426-0.240633im      0.155629-0.0431573im      0.0290531+0.124187im       0.128228-0.0437662im     0.158769-0.0785111im   -0.0968272+0.0168063im    -0.0791858+0.321757im      0.0424007-0.0258353im      0.177319+0.167366im     0.0429138-0.216889im   -0.0568135-0.0682711im   -0.0428694+0.0409316im      0.107231-0.138425im      0.159726+0.205722im     0.0974375+0.0478984im      -0.091353-0.0630645im     -0.027961-0.10125im       0.0962337-0.0685287im     -0.0956612+0.127092im    -0.0140055-0.163826im      -0.157463-0.0318835im    0.00294725-0.0939839im    -0.0510034-0.00332989im    -0.152586+0.0889259im     -0.207614-0.189851im
   0.0130597-0.0248279im      0.119284+0.132081im     0.0480926-0.00545025im   -0.0662854-0.026338im        0.0851061-0.251987im    -0.0167303+0.211588im    -0.0401177-0.153532im       0.0334446+0.14419im      0.0104567-0.0194854im        0.18534-0.127263im      -0.105542+0.211583im    -0.0313199+0.119459im      0.151907-0.159275im     0.00848314-0.0110912im     -0.017673-0.00519298im  -0.00733125+0.0726022im     0.128679-0.143398im    0.0424211+0.019202im     -0.247396-0.0897605im     -0.147317-0.12021im       0.201251+0.00753081im   0.0423144+0.0132085im     -0.0197351+0.156678im     -0.0214285-0.110417im     -0.0489981-0.0283876im      0.0841295+0.0479872im    -0.197999-0.136841im       -0.12225-0.234969im     -0.0151168-0.030171im       0.356552+0.0135109im     -0.124342-0.157392im       0.260784-0.136203im
  0.00404669+0.156902im       0.180785+0.149623im      0.126689-0.168603im      0.0803597-0.0547494im      -0.0287052+0.0518834im  -0.00486297+0.0867756im     -0.14611-0.0435725im    -0.00834777-0.108099im      0.145826+0.0722078im      -0.176492+0.210176im     -0.0330729+0.15402im      -0.246116-0.0712468im    0.0942002+0.145568im        0.11465-0.0681222im     -0.141915+0.165245im       0.210016+0.107354im      0.140209-0.0742879im   -0.141412-0.132274im    -0.0396546+0.0814049im    -0.0451245-0.00923873im  -0.0342605+0.0471304im    0.0744386-0.173574im       -0.137486-0.00555132im   -0.0172888+0.100137im       0.160221-0.0964087im      0.0701619-0.0871969im     0.123395+0.303001im      0.0693812-0.0810343im      0.163818+0.00626286im  -0.00899652-0.0905092im      0.280211-0.0703158im      0.116349-0.194231im
  -0.0171085-0.19287im        0.137998+0.104445im    -0.0366807+0.0534714im    -0.0961963+0.13754im          0.119037-0.138529im    -0.0209685-0.0628623im    0.0748539-0.0644605im     -0.0428967-0.0592159im    -0.115318+0.06149im       0.00394239-0.0265988im      0.242973+0.0960218im   -0.0862971+0.0639251im   0.00550091+0.200529im      0.0885556-0.179844im     0.00754467-0.00185103im   0.00552068+0.0410359im   -0.0559637+0.11052im    -0.0243145-0.106329im     -0.128054-0.116389im     -0.0243675-0.0110401im     0.121623+0.224456im      0.200325+0.15793im       -0.0227654+0.0159308im     -0.022066+0.157402im      -0.077442-0.169327im       0.0281004-0.141875im       0.13215-0.179865im      0.0572119+0.060547im       0.206988-0.293156im      0.0538476-0.26929im      -0.0369219+0.326501im      -0.103076+0.134957im
    0.238914-0.0128646im    -0.0425115+0.137897im     -0.159209+0.0264663im     0.0436577+0.156278im        0.0255124+0.114634im    -0.0186686+0.113865im      0.154372-0.0209314im      0.0581824+0.160236im      0.171796+0.150456im        0.131567-0.0396591im     -0.156363-0.183181im    -0.0475155-0.113062im     -0.044493-0.0329534im     -0.118679+0.0259085im    -0.0743237-0.0993639im      0.325841-0.0979448im     0.132307-0.0405156im   -0.113517+0.125503im    -0.0124819+0.33022im        0.110711+0.154576im     -0.134864+0.0599208im    0.0991754+0.230053im        0.123444-0.0551971im     0.0379342+0.0858893im     0.0527109-0.138259im      -0.0832131-0.0504935im   -0.0384592-0.0187858im     -0.110116-0.0395929im     0.0126798+0.00943913im     0.148084-0.259475im     0.00377868-0.0964561im     0.0620774+0.204231im
   -0.128657+0.127936im     -0.0167623-0.189993im     -0.103799-0.0577015im     -0.125943-0.0118541im      -0.0952139-0.01635im     -0.0795832-0.0414998im     0.157072-0.115023im       0.0052278-0.171259im   -0.00186981-0.0791144im   -0.000218258+0.114502im     -0.0432063+0.0220565im     0.278974-0.0692385im     0.227755+0.0775208im    -0.0309696-0.198927im     -0.0899723-0.189723im      0.0881194-0.243614im      0.132975+0.119295im   -0.0139668+0.0720831im     0.188511-0.178826im     -0.0841763-0.00674514im   -0.140723+0.1699im        0.132182+0.10554im         0.113092+0.223459im      0.0421947-0.129672im       0.170693-0.0543069im      0.0920948+0.0193637im    -0.216754+0.269318im     -0.0284811-0.108534im    0.000890255-0.172851im     -0.0227986-0.0596774im     -0.108406+0.018435im      -0.012807-0.110338im
   -0.281451-0.0494863im      0.181165-0.0363377im   -0.0988118-0.106229im     -0.0578134-0.0416831im       -0.159336+0.31269im     -0.0302345+0.135617im     0.0663933+0.125493im        0.051658-0.148964im     0.0865103+0.217162im       0.0810325+0.0891234im     0.0644228-0.14385im       0.160049-0.0621456im   -0.0619785-0.177002im      0.0650544+0.114076im     -0.0373098+0.0401396im     -0.124414-0.169337im     -0.172083-0.0592295im    0.129944-0.0841258im    -0.113078-0.0706962im    -0.0276105+0.161208im    -0.0440964+0.0804008im   0.00685538-0.111863im      0.00337035-0.122703im      0.0204669+0.0189067im     -0.142699-0.260036im        0.255902+0.121346im    -0.0367566-0.163327im       0.145034-0.0659918im      0.171867+0.0243883im     0.0944809-0.043831im      0.0392528-0.0618981im      0.201998+0.0184023im
  -0.0573663-0.242296im      -0.103102-0.145831im      0.059086+0.0497562im    -0.0732079+0.0071622im       -0.268112-0.167482im    -0.0212648-0.0997805im     0.245338+0.111854im      -0.0144596-0.0106732im    0.0322375-0.152062im        0.174174+0.0508887im     0.0100998-0.120463im     -0.177475+0.0165244im    -0.134501-0.00604009im    -0.022018-0.0807566im    -0.0287051+0.217476im       0.062035+0.213238im      0.197687+0.213141im   0.00612892+0.0806966im    0.0855365-0.163081im      0.0224909+0.108848im     0.0691791+0.0264464im    0.0710106-0.0189799im     -0.0907957-0.120213im      -0.156106+0.11594im     -0.00696614-0.0746107im       0.247718+0.0517374im    -0.040856+0.0399674im     -0.341984+0.1371im        0.0033886+0.0328397im     -0.018478-0.0083283im      0.104906-0.214258im      0.0882257-0.0415755im
   -0.088241+0.31174im       0.0499257+0.130691im     -0.150588+0.104807im      -0.110131+0.153928im        0.0198023-0.046185im     0.0191295-0.194406im     -0.171722+0.019717im        0.156388+0.0918333im   -0.0628623-0.0190897im       0.112609+0.0255348im      0.120011+0.0409486im   -0.0670918-0.00515516im    0.030652+0.0144135im     0.0409996+0.284828im     -0.0288546+0.00206142im     0.214947+0.138251im     -0.146645+0.182519im    -0.194988+0.0769655im     0.235897-0.254249im       0.136432-0.0434023im   -0.0464513-0.0191329im     0.138498-0.311086im        0.133538-0.0432337im     0.0130158+0.0765724im    -0.0425599-0.117726im       0.0321363-0.0668721im    -0.101674-0.0910461im      0.104268-0.0226595im     -0.162831+0.0794018im      0.136968-0.0883176im     -0.117881-0.0755849im     -0.014636-0.00231299im
  -0.0389302+0.120217im     -0.0945617-0.0554456im     0.113127+0.0928842im     0.0533039-0.146164im        -0.146992-0.0837127im   -0.0585262-0.0590514im    -0.135962+0.00647756im      0.131282+0.123607im    -0.0381215+0.338152im        0.139825-0.128778im      0.0067339+0.142916im     0.0171341-0.230614im    -0.0550019-0.00277642im   -0.0774433-0.147177im     -0.0784005+0.0963795im     -0.110056+0.00565871im  -0.0718789-0.134991im    -0.417844+0.0361253im    0.0923202-0.0474006im    -0.0384888-0.0823651im    0.0294838+0.0549414im    -0.133493+0.190563im       -0.171215+0.102736im       0.271097+0.17688im       -0.151466-0.0449873im       0.141313+0.176165im     -0.012031+0.0750201im    -0.0452002+0.0405157im     0.0817673-0.00280537im    -0.125083-0.00904395im    -0.124727-0.0293411im     -0.014998+0.100888im
    0.105513-0.0479597im    -0.0120289-0.165717im     0.0358492+0.126657im       0.146983+0.0449376im       -0.127795-0.0471016im     0.150172+0.285446im     0.0603832+0.0642097im     -0.0020187-0.11366im     -0.0217302-0.0112347im      -0.143032+0.018178im      0.0383968+0.0915539im   -0.0273037+0.0187914im    -0.277401+0.13007im        0.041014-0.177301im    -0.00467392-0.107459im     -0.0153659+0.128726im     0.0833549-0.0467825im   0.0125256-0.168826im     0.0574288-0.0800014im     0.0520105-0.0273971im    -0.140635-0.126139im      0.140936-0.190102im        0.140402-0.0135206im      0.353604-0.103125im      -0.141565-0.262366im       -0.114568-0.0754226im  -0.00305494+0.0781556im    -0.0308121-0.0693595im    -0.0285094-0.0846285im      0.226643+0.234475im     -0.0917358-0.0916562im    -0.0510649+0.188445im
   -0.171555-0.210188im     -0.0832653-0.0919028im   -0.0284498-0.0265772im     0.0984497-0.0459859im       0.0572446-0.0176633im    0.0804916-0.0841359im   -0.0796066+0.139208im        -0.20006+0.0936259im  -0.00670878+0.0602313im      -0.109161-0.0816218im    -0.0929972+0.0612882im   -0.0486193-0.0181228im      0.13419-0.155093im       0.321405+0.217032im      -0.103295-0.087604im       0.218489-0.00896839im    -0.02266-0.117855im    -0.156375-0.103766im     -0.132711-0.205356im       0.128257+0.227604im    -0.0675623+0.0794504im     0.075138+0.000110385im     0.197341+0.209445im      0.0471428-0.0254962im     -0.032698+0.180067im     -0.00522702-0.169853im    0.00320087-0.00675645im      -0.2342-0.0441652im      0.184732+0.00754271im    -0.191355+0.121501im     -0.0185642-0.011638im      0.0649283+0.143908im
   -0.124153+0.00283938im    0.0520785+0.184759im      0.101038-0.0254092im    -0.0527248+0.0733965im      -0.0386596-0.104696im      0.303777-0.164342im     0.0263643-0.0740717im     -0.0215423-0.0423803im    0.0790825-0.214848im        -0.08205-0.117597im      0.0286661-0.136832im     0.0576371-0.371949im     -0.125949-0.217816im      0.0250285+0.102974im      0.0284539-9.5587e-6im     0.0690478-0.00466147im    0.256099+0.134292im   -0.0191758+0.0554188im   -0.0218825+0.0244985im     -0.232009+0.0466396im   0.00830431-0.0488142im     -0.16199-0.109094im      -0.0680188+0.0525159im      0.133079+0.0156572im       0.12188-0.0492166im      -0.146598+0.136747im      0.215619-0.0778426im      0.115514-0.0376515im      0.113371-0.274123im     -0.0407143+0.0169205im      -0.18635-0.0362934im      0.104872+0.0485775im
  -0.0249568-0.0947727im    -0.0848728+0.0138745im    0.0676678+0.0188835im     -0.128249+0.217904im     -0.000597336-0.0467143im    0.0452203-0.0373391im   -0.0870492+0.0362364im     -0.0785386+0.0811762im     0.156122-0.0764841im     -0.0398827+0.0645643im      -0.25124+0.110666im      0.115799-0.196209im    -0.0246197-0.0864395im    -0.0477237-0.210189im     -0.0242949-0.102793im      0.0900426+0.0558918im    -0.141245-0.0996274im    0.119064+0.193219im    -0.0957337-0.055801im      -0.011453-0.110541im     -0.242582+0.142305im    -0.0179513-0.20341im         -0.15832+0.115607im       0.197651-0.00204758im   -0.0321047-0.0855898im      0.0413875-0.0178993im   -0.0630045-0.296442im      -0.090007+0.140382im    0.000488544+0.156697im      0.0201644-0.0616041im      0.296039+0.128265im      -0.219853-0.176478im
   -0.197993-0.103564im      0.0536152+0.107643im     -0.124151-0.301842im      -0.116584+0.0147403im       0.0869642-0.0113452im   -0.0558051-0.0864887im   -0.0576462+0.157579im         0.05947-0.121586im      0.138175-0.11694im        -0.070328-0.00713273im    -0.158317-0.0581459im     -0.08413+0.161809im      0.131205-0.310144im      0.0169187-0.0312679im     -0.080912+0.118388im      -0.107847+0.124981im      0.183441-0.0503554im  -0.0988773-0.0653346im   0.00720983+0.0697564im      0.087076-0.228178im    -0.0750938-0.00740188im  -0.0541783+0.0404771im      -0.117773-0.0980718im     0.0644298-0.0737419im     -0.135847-0.0872812im      0.0540331-0.0284139im    -0.117677+0.219815im     0.00103695+0.0373667im     -0.166835-0.0216339im     0.0816506-0.0640752im     -0.113457+0.139051im      -0.234872+0.332593im
   -0.104471-0.0930966im     0.0231747+0.147573im     -0.229992-0.132184im     -0.0359892+0.000245056im     -0.135932-0.0973417im    0.0286272+0.0862456im    0.0209176+0.0466667im      -0.112676+0.088678im      0.198771+0.0822078im       0.184573+0.000792834im   0.0243746+0.185999im    -0.0688638-0.102722im    -0.0440924+0.213569im       0.114146+0.0579762im      0.332808+0.0374291im     -0.166775-0.114683im     0.0378859+0.181145im   -0.0598753-0.197797im     -0.186172-0.107483im     -0.0241722+0.0609534im   -0.0708143+0.0144881im    0.0211844+0.0694977im     -0.0188647-0.0553441im      0.207479-0.143901im        0.20608-0.0306904im       -0.16905+0.0485373im    0.0155687+0.0429781im    -0.0418612+0.0180011im     -0.294666+0.232768im      -0.157858-0.150571im     -0.0472697-0.00296295im    0.0184028-0.0657346im
  -0.0309565-0.027722im      -0.213262-0.180419im     -0.225236-0.0362349im      0.217566-0.184505im         0.218059-0.177227im      0.116896-0.0622324im   -0.0937613+0.0831335im      0.0470171-0.15464im      -0.142015-0.0278617im      0.0997963-0.148421im      0.0919864-0.142685im     -0.135457-0.0988067im    0.0379852+0.0608063im     -0.131313-0.0631031im    -0.0853551+0.188375im      0.0727815-0.0354938im   -0.0569575+0.027913im     0.101881+0.0315834im    -0.249751+0.134417im    -0.00405891-0.179652im     -0.260001-0.0701705im    0.0724977-0.0536892im     -0.0296951+0.175988im     -0.0515525+0.0412762im      0.167253-0.252872im        0.120584-0.102396im    -0.0621548-0.0592004im      0.122013+0.0244899im    -0.0409117+0.101164im      -0.089452+0.0422682im    -0.0939139+0.0605345im      0.209038-0.0158469im
  -0.0909834-0.0703641im      0.123479+0.152694im      0.184702-0.115213im       0.226235-0.0219402im        0.135527+0.133314im      0.095836-0.0636338im    0.0800668-0.0426661im       0.139001+0.197535im    -0.0827334-0.00208768im      0.213884-0.0607449im    -0.0174234-0.0257083im     0.146767-0.0284452im   -0.0719623-0.115595im     -0.0602226-0.155255im       0.176038+0.221822im       0.205519+0.0273956im    -0.114555+0.11688im    0.00661159+0.0354318im    0.0409307-0.108324im      0.0141898+0.178466im    -0.0467971-0.0137814im     0.142404+0.0869031im     -0.0870359+0.000499035im  -0.0947709-0.0903457im     -0.156921-0.178346im       -0.171813-0.024755im    -0.0530758+0.215269im     -0.0351067-0.230655im     -0.0213337+0.0495784im    -0.0315032+0.261542im      0.0626816+0.256852im     -0.0889045-0.124135im
 -0.00356712-0.0190736im     -0.086842-0.0354606im    0.0463707+0.0256949im     0.0531582+0.182153im         0.103611-0.122948im    -0.0839963+0.142128im    -0.0536923-0.0211783im     -0.0907443+0.177552im      0.158391+0.00103061im     0.0825817+0.214419im       0.121013+0.222588im   -0.00198128+0.0895432im    0.0721002-0.021934im     -0.0619765+0.182642im       0.114543-0.139636im       0.116391-0.0700919im    0.0519509+0.195218im     0.115113-0.031503im     0.0146228+0.169241im       0.114113+0.0401096im    -0.134464-0.113931im     -0.230714-0.0698556im      0.0146209+0.0529935im     0.0271237+0.111685im       -0.15051-0.0734703im       0.314279+0.211417im     0.0693227+0.18431im      -0.0409358+0.133881im     0.00304213-0.159049im     -0.0239007+0.146523im     -0.0620468+0.308636im       0.177236+0.00758008im
   0.0714212+0.0517058im    -0.0212814-0.134706im      0.107995+0.0397005im    -0.0633369-0.0787424im       -0.173915+0.268454im    -0.0747958-0.00337345im   -0.124609+0.148623im        0.184057+0.136629im    -0.0951217-0.329907im        -0.03514+0.0730187im     0.0166968+0.085021im      0.130155-0.173677im       0.22817+0.133288im       0.167375+0.168714im       0.133458+0.138724im      -0.157877+0.0989408im   -0.0199648+0.0290686im    0.111299+0.0207713im    -0.116817+0.141401im     0.00379853-0.0681553im   -0.0931019+0.158786im     0.0754132+0.0676173im     -0.0768647+0.132696im     0.00837246+0.236191im     -0.0840663-0.0833449im      -0.228075-0.0492406im   -0.0316029+0.0197985im     -0.191031-0.014043im      -0.095973-0.125919im       0.101837-0.0452061im     0.0197777+0.0154108im      0.183012+0.144708im
  -0.0115771+0.0111904im   -0.00108745+0.00165918im    0.196488-0.0422308im     0.0229411+0.0397491im       -0.185417-0.0641146im    -0.170468-0.0389925im     0.236761-0.048745im        0.169433+0.0315028im   -0.0826882-0.0462773im         0.1649+0.117258im      -0.215313-0.0906914im    -0.202897+0.129025im    -0.0593504-0.123705im     -0.0214417+0.0968345im      -0.21694-0.250257im      -0.129292-0.0316927im    -0.293435+0.169632im   -0.0813548-0.122782im     -0.188425+0.0788102im    -0.0341023-0.0960931im    -0.176075-0.111532im      0.154798-0.0984158im      -0.100297+0.18891im      0.00479316-0.0585725im    -0.0425965+0.0355887im     -0.0651333-0.0326639im     0.304251+0.0528794im   -0.00926717-0.132145im     -0.0114074-0.044445im      -0.101193-0.114125im      -0.118733-0.0217894im     -0.034387-0.0651188im

and then generate the state $ψ$

psi = P[:, 3]
32-element Vector{ComplexF64}:
   -0.2311148235962317 + 0.1983311727989536im
   -0.1262636893701064 - 0.013312852486524265im
   0.09532111801377789 + 0.05475553409253421im
 -0.010513500174883384 + 0.05794144031072059im
  0.043561576495286664 - 0.06488967608433334im
  0.014630730662881713 + 0.02614756187733438im
   0.04852086285082801 + 0.05952747260419668im
   0.21791461179873584 + 0.0014684275164793675im
 -0.005367616924767208 - 0.03325463642091637im
  0.007645142446486078 + 0.2345893036284322im
   -0.1253114605496747 + 0.16361814435737865im
 -0.025949013617048867 - 0.016684009969513188im
   0.07974659017721804 - 0.01098207598863584im
    0.4074523664088899 + 0.0im
  0.014518935740976631 + 0.11855217730433061im
   0.00437478580316172 - 0.07713776956361476im
   0.15547214735851897 + 0.022636219767308098im
  -0.08361439403311585 + 0.13254399709407289im
  -0.16914010578518157 + 0.1033082171437345im
  -0.06661032377360351 - 0.1469771146124518im
 -0.016087869691022872 - 0.030298470297647716im
    0.1263876611128246 - 0.10271836751864151im
 -0.054698212626608636 + 0.3365511160134843im
 -0.004547764827322271 + 0.05026717974190102im
    0.1679566645808949 - 0.12200391068913058im
    0.2597197141692137 + 0.1374058218056236im
  -0.16919467497852664 + 0.033458195234947384im
   0.09380613071292634 + 0.008796701618861882im
   0.13831789793375132 + 0.07710232164932757im
  -0.17762015391023125 - 0.14697484514332226im
  -0.02933440665331713 - 0.1130679996483937im
  -0.01516698174667129 - 0.03971627797640719im

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.