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.128512+0.00520918im   -0.085646+0.294797im     0.0309382+0.209101im      0.140513+0.202705im      0.0541949+0.076448im    -0.0531563+0.073919im     -0.0107745+0.1004im         0.106775-0.254812im      0.0567719+0.182086im       0.183723-0.320302im    -0.0488709-0.102453im       0.143849+0.182178im    -0.122298-0.0390767im    -0.0765569+0.0448716im     0.0762226-0.00441473im  -0.0276755+0.0861869im    -0.0899096-0.0757842im   0.00775786-0.160007im        0.239939-0.0690764im    0.0151106+0.0102816im     -0.124155-0.0507982im    -0.143241-0.150454im    0.0465517-0.112268im      0.059381-0.0208273im      -0.220802-0.00418944im  -0.0781517+0.0651583im    -0.143069-0.0901072im    -0.0311755+0.222964im     -0.127574-0.0735664im     -0.122544-0.0928148im    -0.0156446-0.0847722im     -0.159559-0.0598366im
  -0.0227967+0.185681im     0.0465843+0.0726533im    -0.129331+0.146043im     0.0126014+0.235739im       0.119405-0.0328256im   -0.0925978+0.104205im      -0.142709+0.149097im        0.08129-0.0597695im      -0.08721-0.0413673im    -0.0289078+0.282285im      0.036804+0.0106722im     -0.144822+0.0595587im    0.218479+0.0682057im      0.122566+0.123158im      0.0570272+0.106471im     0.0126341-0.106019im       0.121483+0.0573929im    -0.180866-0.0967397im     0.00467047-0.0724891im    -0.141316+0.0983745im     0.0870532-0.00595512im   -0.147323+0.21215im    -0.0722901-0.0303505im    -0.197988+0.0898292im      0.0280677-0.0198413im    0.0833144+0.167967im      0.169716+0.0540687im     0.0218953-0.0576191im    -0.126327-0.336683im      -0.125798-0.0792339im     -0.251609+0.0358178im     -0.152947+0.133356im
   -0.202653-0.137298im     0.0483582-0.0118432im    0.0616297+0.145329im     0.0686861+0.210778im     -0.0750669-0.0514867im  -0.00832997-0.031322im      -0.297837-0.183373im       0.161214+0.00315514im   -0.0555554+0.00105119im   -0.0259928+0.0453233im    0.0958471-0.0397895im      0.230891-0.185978im    0.0350463-0.0784287im     -0.191876-0.0657081im    0.00429778-0.155606im     0.0278068-0.191101im      -0.243403-0.00988311im   -0.189353+0.00385772im      -0.14826-0.0121826im     0.244128-0.120956im       0.249081+0.0677818im    0.0352769-0.0536273im   0.0759047+0.230091im     0.0671254+0.00434791im     0.0812154+0.089416im      0.152571-0.0355266im   -0.0387956-0.0212884im    -0.0234964+0.0991067im   -0.0258352-0.171392im     -0.0770509+0.0463752im     0.0345491-0.14715im        0.143227+0.18121im
   -0.182077+0.0810024im   -0.0363985+0.00885696im   -0.270251+0.284253im    -0.0217038+0.0350073im     -0.171074-0.162263im      0.215897-0.0233963im   -0.00447246-0.281187im     0.00695872+0.0308816im     0.0359033-0.00122477im     0.121562-0.0183306im    -0.115682-0.00153909im   -0.0150538-0.197279im    0.0133224+0.230949im       0.113808-0.167814im     -0.0240337+0.0754858im    0.0448622-0.0493582im     0.0371052-0.0452302im   -0.0643601+0.0962831im       0.087986-0.02149im     -0.0566846+0.149812im     -0.0288256-0.245112im     -0.104779+0.199348im     0.136674-0.064067im    -0.0777487+0.179819im      -0.0561442+0.0959336im    -0.119785-0.120108im     -0.305293-0.0671289im       0.20146-0.0384653im    0.0791179+0.0333941im     0.0232418+0.0844321im    -0.0305243+0.0831108im     0.0984481-0.0961908im
   -0.159773+0.049218im    -0.0277492-0.0627511im   0.00912243-0.0274866im    -0.158935-0.122358im       0.178984-0.0365194im   -0.0895923-0.160153im       0.154683-0.0147064im     0.0557819-0.2432im       -0.0851682+0.0243711im     -0.132582+0.0338239im   -0.0831515-0.142778im    -0.00143126+0.046014im   -0.0504137+0.156758im       -0.15348+0.10521im       -0.195156-0.154226im     -0.157583-0.145336im      0.0425744-0.0868523im   -0.0289626+0.036489im       0.0547725+0.0233083im     0.170582+0.100002im      0.0537043-0.178146im       0.15519+0.093316im    0.0913835-0.00232928im   0.0319187+0.303597im        -0.30275+0.0793033im     0.203929+0.183516im      0.104547+0.0170907im    -0.0685816-0.156534im     0.0234768+0.140665im       0.127994+0.0458911im    -0.0371244-0.226922im       -0.13491+0.0246149im
 -0.00573589-0.0049374im    0.0815016-0.137317im     0.0159967+0.15812im     -0.0678819+0.0567377im   -0.00880537-0.220484im   -0.00348304-0.281004im       0.137349+0.121148im      0.0407916+0.0713232im       0.09268+0.0179836im    -0.0621064-0.137959im     0.0530553+0.0358685im   -0.00107545-0.024987im    -0.354757+0.188344im         0.1841-0.0507723im      0.148024+0.222225im     0.0840977-0.0434898im     -0.161828-0.0675169im   -0.0702833+0.225951im        -0.07702-0.0198299im    -0.153753-0.00492074im   -0.0182135-0.0635583im     0.163434-0.246034im   -0.0340437+0.0790988im   -0.0336733-0.0364515im     -0.0745544+0.0181167im      0.10787+0.0529277im     0.117892+0.220468im      -0.092011+0.0937061im    -0.178548-0.244658im       0.154918-0.0926256im    -0.0887354+0.0149215im     0.0410583-0.0801183im
   -0.364448-0.0108732im    0.0622814+0.167408im      0.103464-0.201538im     -0.054351-0.17182im     -0.00347749-0.226179im     -0.172946-0.00288033im     0.118285+0.114638im      0.0102551-0.0315269im     -0.190056-0.142393im       0.113877-0.00701064im   0.0654654-0.23588im       -0.145237+0.0234646im    0.182066+0.0111036im    0.00264692-0.196889im      0.0160662+0.274501im      0.113067-0.179269im     -0.0339781-0.11686im     -0.0508072-0.0377351im       -0.11872-0.049668im    -0.0791353-0.136808im      -0.119399+0.152291im    -0.0784061-0.0236337im   0.0426525+0.0528853im     0.190183-0.0105235im     -0.0558536-0.135728im      0.108091+0.0279202im    -0.233375+0.0814305im    -0.0480569-0.0334626im    0.0625978+0.0321882im      -0.16576+0.069267im    -0.00697718+0.123605im      0.0134588-0.0424987im
  -0.0986323+0.104502im     0.0691746+0.115029im     0.0642335+0.0145653im    -0.270442-0.0721142im     0.0567303+0.0100938im   -0.0626043+0.213044im     -0.0689127-0.0501897im      0.205705-0.212123im     -0.0156048-0.254787im      0.0961003-0.0865431im    0.0665572+0.265028im      0.0732577-0.195876im   -0.0950406-0.200534im      0.0255283-0.102355im     -0.0653687+0.0181148im     -0.04053+0.0741117im     0.0194466+0.205683im     -0.123273-0.0576875im      -0.002518+0.0466132im   -0.0013666+0.236933im      -0.140765-0.183313im      0.174239-0.16051im      0.031196+0.163069im     -0.129967-0.146733im      -0.0484937-0.0526628im    0.0987961-0.0704119im    0.0249302+0.100763im       0.101765-0.0747001im    0.0389602+0.128517im     0.00550924-0.180883im     0.00545378+0.195713im      -0.104042+0.132289im
    -0.14431+0.0691833im     0.103195+0.0402194im     0.108273-0.0886088im    -0.147194+0.105725im      -0.255683-0.0724157im   -0.0348308+0.116187im       0.172701+0.05491im      -0.0921335+0.0936757im      0.170103-0.0112408im     0.0617309-0.201945im    0.00112482-0.0726038im     -0.138941-0.094832im    0.0309099+0.00935136im    0.0533838-0.0843997im     -0.234924-0.0593694im   -0.0294228+0.0682933im       0.22654+0.0159467im    0.0822238-0.126065im        0.224844+0.0331196im     0.295638+0.0955872im      0.125949+0.128851im    -0.0424347+0.0867144im  -0.0714572+0.242596im     0.0080287+0.0675772im       0.162402-0.116436im    -0.0739049+0.0222073im  -0.00897417+0.0520479im    -0.0565597+0.14235im      -0.189075-0.178609im       0.312503+0.0216528im     -0.127522-0.0556079im    -0.0112691+0.0399218im
   0.0254083-0.282878im      0.156833+0.0790326im    -0.125458-0.144569im      0.071035+0.131746im      0.0728855+0.0829177im   0.00559024-0.290494im       0.037272-0.0503424im     -0.101045-0.20241im       -0.115574-0.060136im       0.137257-0.184541im     -0.138727-0.0662617im     -0.151201-0.151872im     0.168584-0.0406726im   -0.00373784-0.19848im       0.0479917+0.0707443im     0.138769+0.0340915im     0.0944255+0.039488im      0.111691+0.00528541im    -0.0520003+0.0843232im    0.0558418+0.0568338im      0.114328-0.190249im     0.0655795+0.149212im    -0.143029-0.277146im    -0.0799296-0.264694im      0.00226238+0.0568189im     0.154938-0.15401im      0.0682595+0.0546658im   -0.00912054+0.0510979im   -0.0880751-0.000186204im  0.00419133-0.128296im     -0.0429202-0.206836im      0.0249659+0.14706im
   0.0363167+0.185477im    -0.0426865-0.107158im      0.245926+0.0385212im  -0.00408642-0.00468009im    0.0703878-0.158539im     0.0670782-0.174262im     -0.0810658-0.0211619im    -0.0805995-0.0478448im     0.0193786-0.20306im      -0.0104174+0.106785im     0.0432331+0.0597206im      0.143358+0.245073im   -0.0581938+0.0225255im     0.0362666-0.132612im        0.29954-0.0695064im   -0.0158862+0.00535511im     0.114682+0.058399im     -0.131508-0.0826754im       0.344427+0.102655im      0.137532-0.141037im      0.0738519-0.0525666im    -0.141077+0.109716im   -0.0521768+0.0243255im   -0.0153466-0.255917im       -0.047439-0.159213im      0.222061-0.149411im      -0.13336-0.108959im     -0.0178256-0.153771im      0.133352-0.0142977im      0.115204-0.00458631im    -0.112352-0.10231im       0.0389541-0.157487im
  -0.0114128-0.007829im      0.281081+0.0195739im    0.0957726+0.0410985im    0.0211975-0.166463im     -0.0292965+0.197852im      0.134177+0.0813708im     0.0455422-0.168697im    -0.00474127+0.0773515im     -0.239014-0.0475865im     -0.129638+0.0613158im     0.187905-0.162287im      0.0436138-0.0578595im    0.159219-0.0122521im      0.194792+0.325441im     -0.0127185-0.110503im      0.132767-0.122123im      -0.159706-0.121727im      0.146998-0.109624im        0.165979+0.199979im     0.0871441+0.0483011im    -0.0648465-0.145123im     0.0151457-0.159172im   -0.0478444-0.158632im    -0.0787623-0.0225428im      -0.133138+0.0127987im     0.086134-0.0641712im    -0.133814+0.00238066im   -0.0843666+0.0303744im    -0.111535-0.201574im       0.126543-0.026062im      0.0057244+0.227594im      0.0482233-0.0582636im
   0.0083244-0.171561im     0.0933083-0.260398im    -0.0278991-0.0663553im   -0.0686736+0.209784im       0.221992+0.151319im      0.072996+0.0912064im    -0.0356767+0.0339027im     -0.163492+0.0870146im      0.154896+0.00214359im    0.0650183-0.111883im     0.0578264-0.195057im      0.0841752-0.0515547im    0.105162+0.16196im       0.0024385-0.112772im       0.163515-0.0370839im    -0.212848-0.117981im      -0.032645+0.0611114im    -0.016136-0.0998271im     -0.0193669-0.0203823im       0.0496+0.0260987im     -0.167765-0.196427im      0.127301-0.013168im      0.25427+0.0190123im   -0.0114894-0.114055im        0.132225-0.11638im      -0.013206+0.169484im    -0.0060396+0.0595227im      -0.11196+0.113026im       0.16321+0.0361372im     -0.045478+0.268302im      -0.231392+0.18966im       -0.166394-0.00818213im
  -0.0361866-0.0917077im   -0.0137039-0.0222156im   -0.0341047+0.17746im    -0.00351857+0.0713144im    -0.0269308+0.145385im     -0.283473-0.159258im    -0.00407743-0.0629608im    -0.0658268+0.0682597im      0.165675-0.138646im       0.139291-0.132039im      0.316215-0.156808im      -0.142761+0.117476im    0.0594831-0.134026im        0.19307+0.106206im        -0.1417-0.101105im     -0.135026+0.118605im      0.0504792-0.134556im     -0.159323+0.0262479im      0.0472385-0.0677832im   -0.0697703+0.0389422im      0.161845+0.0444826im    -0.176983-0.026478im    0.0509088+0.0455677im    0.0394371-0.138842im       -0.211543+0.229508im      0.019532-0.0996556im     0.175871+0.19281im        0.139692-0.114399im       0.12507+0.105234im     -0.0141879+0.155413im      0.0122865+0.111704im       0.135123-0.0181268im
  0.00952918+0.0742093im    0.0917657-0.0292404im   -0.0920637-0.0704969im    0.0913933+0.0440421im    -0.0624891-0.167842im     0.0665782+0.107272im      -0.148158+0.144827im     -0.0192471+0.0125614im       0.20784+0.16183im       -0.143463+0.077462im      0.210006-0.211144im      -0.121977-0.0891033im    0.146645-0.234085im      0.0618108-0.175732im       0.136791-0.0910466im      0.14719+0.190603im     0.00412393+0.00666727im    0.190801+0.0368494im     -0.0132324+0.122935im    -0.0677887-0.0532316im    -0.0349838+0.00939804im    0.212481+0.0162035im   0.0850644+0.182412im    -0.0566096+0.00583975im      -0.23819+0.257301im      0.126956+0.141928im     -0.109878-0.0972191im      0.161072+0.00385437im    0.100198+0.032796im      0.0511574-0.173005im     -0.0449232-0.126592im        -0.1675-0.137806im
  -0.0785508+0.202183im      0.144936-0.00253485im  -0.0499897-0.140916im      0.113931+0.151045im      0.0690771+0.209195im     -0.230101-0.225017im      0.0579056-0.100959im       0.123606+0.121977im      0.0687284+0.161696im      0.0933911+0.00884289im  -0.0339493+0.031409im       0.288657-0.133006im   -0.0433346+0.0158371im   -0.00176598-0.0603022im     0.0236115+0.110693im      0.216717+0.094207im       0.237765+0.094055im     0.0593401-0.024945im       0.0544847+0.201467im    -0.0592824-0.193278im      -0.112347-0.0434172im   -0.0295239-0.0642295im  0.00736432+0.0892542im    0.0917061+0.0914595im       -0.05092+0.0503432im   -0.0359344+0.038038im     0.0180679-0.0861341im   -0.00419154-0.338841im     -0.106978-0.0850551im     0.0240685+0.225013im      0.0972366+0.113926im     -0.0896919+0.177966im
   0.0928191+0.0702418im     0.039858-0.104704im    0.00279963+0.0222258im    0.0507762-0.00253323im   -0.0594079-0.191709im     -0.185471-0.122207im    -0.00699016-0.239068im     -0.0308042-0.196974im      -0.198524+0.0260253im   -0.00534646+0.016497im      0.173819-0.113908im       0.147625+0.0476103im  -0.0342905-0.0753359im    -0.0745368-0.00703078im    -0.111092+0.110256im    0.00821116+0.126942im      0.0772568+0.183639im      0.170724-0.0984633im       0.267245-0.173628im     -0.169753+0.0657528im       0.13714+0.0462839im     0.239378-0.0364389im   0.0572763-0.141875im    -0.0605174+0.0534211im       0.254093-0.0609739im     0.104343+0.297641im    -0.0187911+0.0507188im      0.177823+0.190458im     0.0191954-0.00321551im   -0.0734328+0.121792im       0.068295+0.0697425im       0.16126-0.0775351im
    0.087974-0.0844087im      0.11694-0.119305im    -0.0920855+0.134637im     -0.181352-0.0917715im    -0.0222822-0.26547im      0.0202634+0.0550805im     -0.145385+0.0782385im    -0.0187933+0.216711im      -0.238562-0.0768292im      0.128496-0.169979im     0.0209065-0.00274393im     0.124595+0.0410745im   -0.010551-0.0219928im    -0.0326361+0.0522138im    -0.0158238-0.0679685im   -0.0536547+0.114948im      -0.142816-0.0258126im      0.27924-0.138784im      -0.0379381-0.0363509im   -0.0356631-0.0868612im     -0.199502-0.0178759im    -0.193589+0.0926741im    0.196019-0.011636im     0.0867823-0.0720615im     -0.0475318-0.0764618im    -0.022885+0.0988919im      0.10164+0.0183114im      0.179926-0.27219im      -0.258049+0.0447193im     0.0341858-0.026816im      -0.147591-0.217255im      0.0709601+0.204259im
  -0.0639084-0.0274726im     0.228489-0.0911919im     0.111806+0.0924695im    -0.141397+0.0245559im   0.000611582-0.0142671im     0.109474-0.00878386im   -0.0982256+0.00489801im    0.0649073+0.12586im       -0.124441-0.171235im     0.00176905-0.215215im     -0.125181+0.101279im      -0.178728-0.0654369im  -0.0345135-0.00219271im  -0.00799729+0.0276149im     0.0170598-0.120792im     -0.141903-0.117837im       0.277105+0.0959199im     0.118892+0.0444717im   -0.000299124-0.234382im     -0.228668-0.123954im       0.227197+0.0061208im    0.0439664-0.133563im    -0.135545-0.0225779im      0.19328-0.00245096im     -0.105776+0.161789im     0.0378345+0.0381813im   0.00421898-0.427934im     -0.0504705+0.0337111im    0.0153383-0.0737136im     -0.104337+0.0525599im     0.0408377+0.0952587im     -0.173316-0.0851384im
    0.125506+0.0734052im     0.111579+0.16218im      -0.140784+0.0765007im   -0.0558759+0.22905im       0.0941711+0.0424152im  -0.00225136-0.0167935im     -0.071353+0.160696im      0.0925817+0.211651im     0.00700788-0.10434im       0.0267568+0.117336im    0.00485331-0.0978561im     -0.134388+0.0846411im  -0.0493574+0.12399im       -0.270081+0.0729221im     -0.134732+0.0752545im     0.155273+0.0724724im      -0.23849+0.213428im      0.163373+0.114764im        0.110919-0.161168im     0.0356507+0.065302im     -0.0570127-0.0638719im   -0.0471001+0.0494658im   -0.237374+0.169476im    -0.0660671-0.0190064im     -0.0794874-0.0472814im     0.250081-0.107822im     -0.128898+0.00412486im    -0.100598+0.10073im     -0.0238023+0.269272im      0.0887152+0.235002im      0.0714621+0.0610246im     0.0399352-0.00367068im
    0.050227-0.113884im     -0.085491-0.211053im      -0.19015+0.194668im    -0.0689392-0.170934im        0.11259+0.181941im     -0.107486+0.00235991im     0.124241-0.0655296im    0.00847355-0.0693154im    -0.0584009-0.05416im       -0.134515-0.110465im      0.151439-0.0511917im     0.0377943-0.113693im     0.014426-0.149605im     -0.0819808+0.0664336im     0.0816676+0.256572im     -0.132662+0.196756im      0.0028774+0.154951im    -0.0235162+0.199974im      -0.0324192-0.00759892im      0.1483-0.0139278im     0.0482632+0.274158im    -0.0402446+0.100848im    0.0385053+0.0110704im   -0.0122714+0.098507im       0.0482863-0.0361548im    0.0936734-0.218466im     -0.284936-0.0599197im    -0.0522738-0.0616695im    -0.199659-0.0920979im    -0.0556123+0.00351654im    -0.147135-0.0319779im     -0.278998-0.10765im
    0.187304+0.266987im      -0.13471+0.21151im     -0.0237858-0.0653983im    -0.144949+0.118832im       0.141979+0.021288im   -0.00248429-0.220108im      -0.110946-0.0287945im     -0.035766+0.0363576im     0.0415841-0.0584359im     -0.172151-0.293981im     -0.048742-0.145878im      0.0965783+0.0877059im    0.165417-0.168354im       0.255476+0.0119491im    -0.0481941-0.102826im     0.0902218-0.252851im    -0.00917263+0.0536665im    0.0411321+0.0865175im      -0.139361-0.00715485im    -0.11406+0.141547im      0.0302069+0.121411im     0.0658868-0.179761im     0.112979+0.00755353im  -0.0687307+0.177881im       0.0587178-0.202684im     -0.047081-0.14408im      -0.109857-0.131868im      0.0263552-0.00602293im   0.0162221+0.0794096im     0.0295325+0.0155692im      -0.18449-0.120029im       0.110942+0.0756612im
   -0.139181-0.0892013im    -0.013522+0.0906237im   -0.0168914+0.133979im    0.00623763+0.0488288im     0.0135441+0.0241276im    0.0658145-0.133035im      -0.185547+0.0126864im     -0.256645-0.0400181im    -0.0272768+0.109754im     -0.0938536+0.0909737im   0.00984337+0.0194834im      0.150347+0.0214433im   -0.134435-0.0263244im    -0.0584772+0.0459922im     -0.257439+0.0647031im    0.0630437-0.275817im       0.138128-0.14066im       0.107418+0.119893im        0.064666+0.113513im     -0.133447+0.130299im      -0.142846+0.22375im      0.0207214+0.246078im     0.181995+0.109416im     0.0955641-0.278411im       0.0355377-0.0685955im     0.113575-0.0961796im     0.160584-0.0890986im     0.0823259+0.0937569im   -0.0805116+0.057919im      0.0988013-0.101116im      0.0960897+0.193224im      -0.231229-0.0587021im
  0.00145161-0.018276im    -0.0680975-0.130354im     0.0698454-0.261337im     0.0909186+0.0242355im      0.165765-0.0893524im    0.0955539+0.0960933im     -0.024863+0.0242898im      0.203045+0.137968im      -0.110807+0.142664im       0.070266-0.0865521im     0.205557+0.0478519im    -0.0294247+0.0314253im   0.0135725+0.0391827im      -0.17252-0.00117147im   -0.0129193+0.0790366im     0.174305-0.108305im     -0.0953737+0.0138033im    -0.152957+0.149715im        0.238507+0.0160517im    0.0326933+0.265872im       0.106202+0.0508547im    0.0438015-0.0516826im   -0.104291-0.170156im       0.32019+0.000259821im  -0.00563663+0.099072im     -0.158198-0.141112im     0.0866858-0.00452939im     0.307983-0.0250376im    0.0441522+0.00862317im     0.106334+0.0137835im     -0.280376+0.0272764im     -0.105958+0.0503535im
    0.107441+0.0211344im   -0.0326984+0.0226253im     0.066322+0.159484im      0.115294-0.0470388im     -0.178626+0.0592238im    0.0358042-0.028018im       0.153488-0.0126473im    0.00413893+0.0353809im    -0.0884855+0.0754245im     -0.107687-0.12552im       0.176215-0.171693im     -0.0305043-0.176696im   -0.0732867-0.0913834im     0.0103949-0.0687079im     0.0107432+0.0755266im    -0.172699-0.0743373im     -0.120757+0.00149907im  -0.0175723+0.00245277im      0.127393+0.0840674im    -0.242298-0.140779im     -0.0532837-0.196173im     -0.152968+0.124146im    -0.225025+0.104195im     0.0994375+0.155081im       0.0956315-0.216496im     0.0842593-0.0345317im     0.118817-0.037716im     0.00896378+0.064321im      0.357288+0.0324787im     0.0396378-0.12433im       0.0294332-0.0691801im      -0.18252+0.352547im
   0.0935947-0.133863im    -0.0283665+0.211005im     -0.115948+0.111882im      0.048844-0.223908im     -0.0348161+0.186617im    -0.0634402+0.0927098im    -0.0894087+0.0926933im    -0.0649537-0.0309542im     -0.269674+0.23433im      -0.0188902-0.0511835im   -0.0388487+0.122215im      -0.146719+0.192305im    0.0258906+0.262616im        0.13991-0.289808im     -0.0190833-0.0509438im   -0.0300852-0.028185im     -0.0207582+0.137772im     -0.135225+0.0338785im       0.117176+0.00915528im   0.0229159-0.189194im       0.108713+0.132496im     0.0969438-0.179481im     0.143274+0.067241im     -0.126321-0.067618im       0.0200216+0.109421im     0.0940515+0.0878129im   -0.0956636-0.0387252im     0.0867373-0.0596987im    0.0232647+0.0144474im       0.27917+0.0936173im    -0.0550841+0.0705902im    -0.0158026+0.209135im
  -0.0496483+0.0890441im     0.105629-0.0869368im    -0.111133+0.16668im      -0.189182+0.114461im    0.000498398+0.239275im    -0.0198086+0.0905515im      0.109215+0.21892im         0.15587-0.212167im     -0.0739134-0.126019im      0.0157975+0.191792im    -0.0376547-0.195783im       0.199468-0.0935236im  -0.0112139+0.123731im      0.0301017-0.104309im      0.0457206-0.154703im    -0.0493342+0.0322572im      0.102502-0.276519im     0.0415911+0.117397im      -0.0351173-0.0103819im   -0.0162217-0.131873im      -0.134308+0.200421im      0.142537-0.0586065im   -0.289208-0.0734297im    0.0708477-0.0921973im      0.0918521-0.0433146im   -0.0976398-0.0297256im  -0.00830062-0.034722im       0.302126+0.0693108im    0.0489056+0.0613301im      0.085501+0.00831651im     -0.10281-0.0811735im      0.168373-0.0189845im
    0.227919+0.139542im    -0.0259721+0.0535625im    0.0179837+0.107388im     0.0631216-0.0838617im      0.144039-0.162057im     0.0440861+0.17861im     -0.00662012-0.209722im       0.200827+0.108828im        0.11861+0.119692im     0.00681165-0.150042im      0.113081-0.164651im     -0.0369266+0.0888686im  -0.0383202+0.276752im     -0.0529762-0.130007im      -0.323264-0.0406227im    -0.106328-0.0755946im      0.181323+0.0141546im    0.0219392-0.117382im       -0.177105+0.204879im     0.0432443-0.172275im     -0.0166588+0.0171015im     0.165763+0.0371721im   -0.148832-0.0580663im   -0.0420312-0.168466im      -0.0492872-0.0520951im    0.0979766-0.175379im     0.0115075+0.13262im       0.0366093-0.0261006im   -0.0663335-0.107469im      -0.274389-0.00530342im    0.0200954-0.0246271im    -0.0473305-0.0834791im
  -0.0571276+0.0894976im     0.196319-0.104889im     0.0634088-0.111237im      0.129737-0.173359im     -0.0395674+0.0492049im    0.0414236-0.107539im      -0.330291-0.204734im       0.138109-0.0552998im     0.0402617+0.0544131im      0.271577+8.99974e-6im  -0.0714777-0.0959301im   -0.00224011+0.0965653im   -0.188719+0.0581616im    -0.0281541+0.0112772im   0.000495856+0.0177699im   -0.0633625+0.153265im       0.053692-0.133198im      0.136264+0.118815im       -0.192706+0.038299im     0.0371565+0.0828499im     0.0388961+0.210179im     -0.204286-0.0223159im  -0.0786387-0.0285698im    -0.197638+0.115231im      -0.0280223-0.0503434im    0.0716237+0.0947869im   -0.0146442+0.00592243im    -0.139034+0.117056im      0.161757+0.128735im      0.0914631-0.142744im      -0.326105+0.160032im     -0.0360504+0.113648im
    0.125745+0.0455477im    0.0149647-0.128015im     0.0302022+0.109343im    -0.0912854-0.0142582im    -0.0529935-0.0335571im    -0.123595-0.0523235im    -0.0242332-0.00696717im    -0.280635+0.0410295im   -0.00299915-0.121664im        0.13774+0.0445566im    0.0420988-0.25536im        0.033332+0.0851361im  0.00858052+0.0558584im     -0.217984+0.0638848im     -0.067923+0.0511238im    0.0857782-0.0434885im     0.0266486+0.23971im      -0.361339-0.0531399im      -0.207308+0.215485im    -0.0439401+0.0466681im    0.00466154-0.0544419im    0.0237314-0.0314525im   -0.123761-0.0423241im    0.0466525-0.0784132im      -0.117623+0.0616627im    -0.287779+0.212452im     -0.195166-0.1835im      -0.00490012+0.0847893im    -0.100335+0.0501655im       0.17177-0.235004im      0.0934996+0.0250668im  -0.000704294+0.11133im
    -0.22852-0.16164im      0.0196329-0.145922im     -0.111625-0.172939im       0.21027+0.239745im      -0.115915+0.0374527im    0.0471005+0.234409im      -0.146864-0.0525891im     -0.139431-0.135613im      0.0978944-0.209176im     -0.0254479-0.0517539im    0.0625667+0.0368171im      0.084035+0.244598im   -0.0710133+0.135063im       0.162521+0.00656463im   -0.0824847-0.0415075im     -0.12919-0.0504329im    -0.0937024+0.166023im      0.102007+0.0682544im      0.0631391+0.0299945im    -0.224282-0.000336449im   0.0251812+0.107826im      0.172521+0.0160616im   -0.166743-0.0614012im    0.0838164+0.165384im      -0.0814416-0.115195im    0.00579986-0.0792463im    -0.161442+0.151073im     -0.0871971-0.271315im    -0.0616172-0.0074971im     0.0402111-0.111411im       0.112032-0.0729817im    0.00590681+0.0920577im
   -0.020139-0.0293837im     0.153939+0.325297im     -0.136026-0.109637im     0.0412588+0.0562028im      0.135998-0.0786962im    0.0497512-0.145225im     -0.0488646-0.0157749im     0.0151689+0.0871559im     -0.120057-0.00764793im   -0.0169676-0.0691401im    0.0116379-0.161251im     -0.0503799-0.0632775im  -0.0915879+0.159981im     -0.0604411+0.155203im       0.242365-0.135741im     -0.246567+0.216859im    -0.00193415-0.066599im     -0.209402-0.207778im      0.00595407+0.108365im    -0.0931082+0.0671798im     0.0193082+0.0522919im    0.0953258+0.033972im    0.0165007+0.13082im       0.130227+0.145435im        0.357584+0.092571im     0.0453744-0.0988207im    0.0113319+0.0195132im     0.0289435-0.134409im    -0.0849543+0.114702im      0.0678552-0.206319im      0.0673846+0.10218im     -0.00184619-0.201775im

and then generate the state $ψ$

psi = P[:, 3]
32-element Vector{ComplexF64}:
   0.19768935524043568 - 0.05692424382701615im
  -0.16383162616015243 + 0.06081581218510722im
   0.15422450773675783 - 0.2113327599362498im
    -0.241476251917698 - 0.04960709834689124im
   -0.1100365803055136 + 0.11124621904622978im
   -0.1570669692481297 - 0.07663651923281255im
   0.09487021329286682 - 0.0538725105293933im
   0.07519910521790885 + 0.017356575035298513im
   0.04652354053669653 - 0.1378562594985452im
   0.09458950321849326 - 0.23985808453603752im
   -0.0314207250471142 - 0.020703523096147616im
  -0.11929139055421789 - 0.1395006706013636im
   0.11024453152031105 - 0.1481783645648881im
  0.025863761338185395 - 0.14586765050860157im
   0.00833364756855583 + 0.0555902922045056im
   0.05539949960941555 - 0.06354726618708703im
   -0.0503892119423614 + 0.008132168265888265im
  -0.09063387925682097 - 0.06594913679353843im
 -0.003894839045911081 - 0.04828072354605776im
 -0.015832262038872016 + 0.07950938040886393im
   -0.1378578586757397 + 0.015349772881363015im
    0.2434258053779146 - 0.1402135165740311im
  -0.10817829028897136 + 0.02410919383099171im
  0.027431789838578094 - 0.12872959493732888im
    0.1557107230619434 + 0.0700184292996899im
 0.0053143507944165246 - 0.054828762340187576im
 -0.032260680547421455 + 0.074863628626124im
  0.005927727154739944 + 0.14127888441853467im
  -0.03502741836569727 - 0.22819276170902805im
  -0.12408065481482378 + 0.20182634336387897im
   0.34758642017282815 + 0.0im
   -0.2928679488551512 + 0.09625538616021387im

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.