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.275109-0.307557im      -0.122797+0.0400439im   -0.022713-0.0642879im   0.0425184+0.0385463im      0.108333+0.0458832im     -0.156257+0.0886815im     0.112831-0.00051013im   -0.0146596-0.141698im      -0.120256-0.0137786im    -0.0878995+0.0434356im    -0.0599196-0.0880626im     0.131865+0.163747im    -0.00509207+0.0465695im      0.185179-0.158763im     -0.0187722+0.1749im        0.105704-0.129625im    -0.0279678-0.123108im      5.85348e-5-0.0952165im     0.0333342+0.144832im    0.0642987+0.312028im     -0.075431-0.157255im     -0.151258+0.129521im      -0.147447+0.116254im      0.0566302+0.0357698im     0.0815815+0.0407966im    -0.0294459-0.0660425im    -0.123614+0.076542im      -0.0772107-0.0108104im    -0.184618-0.135468im     -0.0956767-0.10158im       -0.374944-0.0916564im     -0.0683627+0.0282316im
  -0.0698784+0.146021im      -0.211849-0.103874im    0.0761941+0.0473379im   0.0254765-0.0366066im      0.112557+0.0381767im      0.112767-0.0316376im    -0.127351+0.215837im     -0.0224657+0.0158935im    -0.0698196-0.140345im       0.111466+0.045781im       0.024583-0.159061im      0.080488-0.166443im      -0.246988+0.161707im     -0.0324592+0.0226193im      -0.16298+0.102948im    -0.0763939+0.11556im     -0.0629487+0.0818148im     0.00889757+0.0263481im      0.102047-0.296212im   -0.0841186-0.00676247im   0.0081611+0.170475im     -0.168556+0.106717im       -0.19272-0.259331im       0.215652+0.0556499im      0.167129-0.176029im       0.083305+0.131405im    -0.0625927-0.0412872im       0.117723+0.00307215im   -0.301287-0.0442101im     0.0226568-0.126106im     -0.0367563+0.00487027im      0.124504+0.0645797im
    0.132591+0.0626573im     0.0325003+0.0188578im    -0.21959+0.117574im    0.0986358-0.212643im      -0.107179-0.0949557im    -0.0216805+0.0187146im   -0.0386701+0.157553im       0.182503-0.0398284im      0.070315+0.192957im     -0.0305623+0.240683im       0.110615+0.0181452im   0.00164078-0.0597088im    -0.0340287-0.0709871im    -0.0887623-0.129366im      0.0409782+0.135473im      0.186468-0.163046im    -0.0278981+0.0913443im       0.129992+0.170967im     -0.0701677+0.204782im    -0.080539+0.275873im     -0.102388+0.172118im     -0.118588+0.0708286im     0.0524485-0.167768im       0.138064-0.168584im       0.041433-0.215122im      -0.210178+0.00760759im   0.0488962-0.0463591im      -0.200398+0.0758028im    0.0696371-0.0366675im     0.0668963+0.0335188im     0.0302315-0.0234601im      0.0921779-0.247976im
    0.160854+0.0674774im     0.0712887-0.0114168im   -0.194091+0.0700315im   -0.393205+0.107198im       0.156503-0.0596096im     -0.135024-0.0323292im   -0.0205085-0.029403im     -0.0661665+0.108537im     -0.0710953-0.233939im       0.167924-0.0818134im     0.0478647+0.0321616im   -0.0128014+0.162293im     -0.0408835-0.0431395im      0.152474-0.134548im     -0.0763161-0.138349im     0.0111684+0.0951374im   -0.0079728+0.0552785im      -0.109849-0.225512im      0.0287664-0.0369732im    0.131782+0.103888im     -0.135028-0.068078im    -0.0515904-0.0375448im   -0.00488949-0.179272im     -0.0399412+0.0336155im     0.0214254-0.0603802im    -0.0981417-0.191394im     0.0240985-0.243509im       -0.153996+0.0365904im    -0.191303+0.175286im     -0.0481612+0.18934im      -0.0183861+0.0860045im      0.0303866-0.282348im
   0.0810623+0.0505532im     0.0945776+0.0365655im  -0.0667556-0.257604im   0.00176716-0.220074im      -0.412265-0.00983576im   -0.0377744-0.00467631im   -0.161517+0.0429185im    -0.0928382-0.179779im      -0.193776+0.0320505im     0.0995366+0.0932401im      0.211696-0.166432im      0.147785-0.224252im     -0.0932233-0.11191im        0.141698-0.000300884im  -0.0283891-0.0196376im     0.118061-0.0326639im   -0.0827194-0.0431485im     -0.0896588+0.0696261im     0.0243869-0.026883im    0.0594448-0.10831im       0.204772-0.156083im    0.00653895+0.1049im       -0.0885421-0.0500058im     -0.114903+0.192115im     -0.0809787+0.0594406im     0.0652101-0.155367im    -0.0612015-0.0274432im     -0.0785708+0.204043im      -0.01806+0.242173im     -0.0614587+0.0607986im    -0.0958433-0.107848im      -0.0292799+0.0823236im
   -0.131034+0.0148831im     0.0838695-0.167622im    -0.156137-0.0307362im   0.0600727-0.0140236im     0.0529251-0.228404im      -0.145584-0.184289im    -0.0820945+0.16167im       -0.106336+0.153234im    -0.00682216+0.0995054im    -0.0449234+0.0681674im    -0.0187468-0.0501403im     0.116996-0.048478im     -0.0189012-0.108465im    -0.00837489+0.117398im        0.10165-0.07422im      0.0807698+0.148657im     0.0831676+0.375202im       -0.045531-0.14153im      -0.0395074-0.0915353im     0.12024+0.273917im      0.130821-0.0739296im     0.253445+0.0865947im    -0.0746027-0.0139923im     -0.122785+0.0414422im     0.0954371+0.102736im      -0.152432+0.235955im     -0.159841-0.0177415im       0.126657-0.149811im      0.113524-0.15415im      -0.0874362+0.168855im    -0.00881214-0.0785852im   -0.000723671+0.0807899im
  -0.0123683+0.0513776im     -0.110636-0.0305868im  -0.0285334-0.10673im    -0.0188082+0.142263im    -0.00987676+0.0595429im     0.0657322-0.109424im    -0.0311316-0.0824984im     0.0328343+0.0684815im      0.175904-0.0538817im     0.0521493+0.166642im       0.031027+0.355984im     0.0674618-0.0556408im     -0.187073+0.214252im      -0.264491-0.0188337im      0.277563-0.226671im      0.240787-0.0391918im   -0.0355901-0.207607im       0.0533335+0.0151643im    -0.0855852-0.218594im     0.101624+0.0262721im   -0.0779899-0.219046im     -0.148677+0.136837im       -0.13255-0.063181im       0.151133+0.0783966im    -0.0376441+0.0764757im    -0.0337402+0.00743739im   0.0980484-0.048096im      -0.0137491-0.0636082im      0.15926+0.038057im     -0.0793421+0.0114288im    -0.0700992-0.181402im       -0.153078-0.0285954im
   0.0413269-0.0365556im    -0.0810488-0.0293291im   -0.129389+0.243383im     0.178487-0.0439811im     0.0192273-0.273292im        0.01439+0.0433523im    0.0669265+0.0650182im     -0.290001-0.113337im     0.00356698+0.0414342im     0.0368764-0.183713im     -0.0701734-0.0709556im   -0.0976253+0.0188904im     -0.119173+0.0759736im    -0.0309291+0.0426491im     0.0179764-0.219417im      0.185575+0.138244im     -0.237014-0.187055im      -0.0651102+0.13928im      -0.0141718+0.0496003im    0.058013+0.125183im      0.188066-0.0487797im   -0.0520319-0.115136im       0.247974+0.0826095im     0.0272691-0.0128606im      0.189249-0.0305765im      0.220835+0.00159124im  -0.0229983-0.17444im         0.166757+0.178161im     0.0749653-0.035489im       -0.12128-0.143294im     -0.0485855+0.081331im      -0.0585015-0.159758im
  -0.0892496-0.0855474im     -0.134842+0.0326416im   0.0606131+0.200323im    -0.104364-0.0690041im    -0.0179442+0.108852im     -0.0227944-0.0442732im   0.00837827+0.221262im      0.0225844-0.0240213im     -0.111102+0.172636im       0.015535-0.0208281im    -0.0385163+0.157375im     0.0512574+0.213133im      -0.136714-0.247973im     -0.0276124-0.0636049im     -0.158352-0.307677im     -0.127011-0.012175im     0.0976228-0.100758im       0.0388899+0.209406im      -0.142943-0.210586im     0.110378+0.142272im      0.171496+0.213623im     0.0882647+0.197869im       0.103356+0.0323367im     0.0372333-0.0801312im    -0.0643824+0.12611im      -0.0479816-0.278489im     0.0671013-0.0333881im     -0.0750784-0.10229im     -0.0337409+0.0637429im     0.0835099+0.00247217im   -0.0197483-0.0263816im      0.0795403+0.241079im
   -0.207307-0.0150258im     0.0469976+0.0980933im    -0.14287+0.22039im    -0.0150069+0.147286im      -0.150032+0.228531im     0.00605861+0.0537023im    -0.074388+0.197368im      0.0462548-0.0640229im       0.24009-0.183544im       -0.25187+0.158129im      0.0640863+0.174774im     0.0752557-0.0165359im      0.226931+0.0338609im      0.107476+0.0471676im    -0.0843176-0.0590235im    0.0687805+0.0528457im    -0.106736+0.0666813im      -0.120679-0.226832im      0.0815103+0.0905073im  0.00392803+0.135981im      0.199244-0.0422055im    0.0157217+0.00702788im   -0.0842057+0.049693im       0.193225-0.00679565im    0.0371057+0.0355502im      0.159272+0.00838038im  -0.0141011+0.0540655im       0.113881+0.110702im     0.0319182+0.278732im       0.143549-0.0607758im      0.196605+0.0161342im       0.135273-0.0147548im
   0.0440377+0.045143im     -0.0519467+0.072041im    0.0637385+0.0954783im  -0.0611576+0.0581942im     -0.192184-0.0625881im      0.315933+0.288235im    -0.0737817+0.118104im      0.0405269+0.0342289im     -0.268923-0.150882im    -0.00538948+0.102021im      -0.177151+0.00866772im  -0.0185547-0.156526im      -0.138806+0.00274157im     0.105639-0.0332629im    -0.0558167-0.192914im      0.031214+0.273004im    -0.0616436-0.00335756im      0.205783-0.16537im       0.0566556+0.077377im    -0.127627+0.113625im      -0.17741-0.106928im     0.0525575-0.0232413im     0.0197214+0.00051928im   -0.0590634-0.244216im      -0.167767+0.175805im     -0.0305385+0.135975im    -0.0836796+0.0895868im      -0.216732-0.0599923im     0.136236-0.0567833im    -0.0784205-0.0637671im    -0.0822325+0.0793367im    -0.00234105+0.0436766im
   0.0148481+0.0160644im      -0.23178+0.195362im    0.0314802-0.0681832im     0.15215+0.163836im     -0.0177629-0.0852041im     0.0106832+0.137173im      -0.08066+0.0806877im     -0.126439-0.12032im      -0.0467035+0.0901204im     -0.100272+0.0632494im      0.234557-0.0850844im    -0.186043+0.138794im      -0.202334+0.0370985im      0.182004+0.276326im       0.162789-0.049076im    -0.0303752-0.0788523im     0.217544+0.206499im        0.164795-0.0367476im    -0.0026648-0.0450253im    0.164752+0.0523548im    -0.144896-0.0496591im     -0.20427-0.156326im     -0.0500248+0.0516311im    -0.0475613+0.0220928im     0.0306899+0.0904367im     -0.222967-0.130177im      0.187609+0.0540413im       0.181804+0.070868im    -0.0468401+0.116885im      0.0180803-0.0307936im      0.149205+0.116259im       0.0292787+0.00143214im
   0.0700254-0.188835im       0.167822+0.221672im   -0.0287303+0.140746im    0.0578877-0.0458512im     0.0674793-0.0584613im     0.0507953+0.00627552im   0.0712811+0.129742im    -0.00812764+0.169068im       0.106081+0.0821228im    -0.0159808+0.0488509im     0.0890416+0.198667im     0.0178717-0.0379314im     -0.258219-0.17623im       0.0891554-0.0318507im     0.0776723+0.0273796im    -0.317977-0.0873373im    -0.195794+0.0144637im      -0.216608+0.170364im      -0.155721-0.0262658im   -0.130991-0.0499835im   -0.0836733-0.199171im     -0.127623-0.0659694im     -0.249841+0.0949534im     -0.079712-0.0925386im    -0.0589352+0.107064im       0.129056+0.175519im    -0.0802519+0.000297475im  -0.00245518+0.0800655im    -0.212698-0.0508307im      -0.18149+0.128263im       0.119531-0.0248923im      0.0405391-0.0333673im
   -0.218227-0.0519762im     0.0123773+0.158606im   -0.0895763-0.0408414im    0.104605-0.157786im      0.0818687-0.0131667im    -0.0522404-0.0395154im    0.0472699-0.0324949im     0.0613622-0.109887im      -0.171096+0.0116007im      0.127419+0.0617339im    -0.0801943-0.0661183im    0.0818701+0.112904im     -0.0650535+0.0304695im     -0.297303+0.111099im      -0.282709-0.180351im    -0.0651172-0.125073im     0.0179596+0.0415782im      0.0503455-0.118097im        0.11097-0.18865im     -0.214273+0.0272419im     0.162946-0.143704im     -0.189638-0.198627im      0.0227579+0.100942im    -0.00557682+0.0901642im     -0.148513-0.0775027im   -0.00748313+0.0920789im   -0.0122855+0.193227im      -0.0384777-0.0797492im     0.106431+0.0797846im      0.126516+0.250535im    -0.00699056+0.0908044im     -0.0157168-0.298484im
    0.208604+0.00343736im    0.0113973+0.0255986im  -0.0508494+0.127956im   0.00242146-0.0346055im      0.144306+0.151899im      0.0167247+0.0653831im    -0.149652-0.183278im      0.0929567-0.062106im       0.246196+0.213502im      -0.017337+0.181637im      -0.101603+0.071309im     0.0439681-0.131379im      0.0142302+0.137864im      0.0498124+0.1759im        -0.155067-0.0781551im    0.0794729+0.192647im     0.0694445+0.141638im       -0.228992+0.0617852im      0.103964-0.0624327im   0.0185406-0.00301399im   0.0199484+0.057299im     -0.195611-0.0695425im     0.0666594+0.225683im      -0.209649-0.0355865im     -0.175383-0.122619im      -0.196738-0.0889932im    -0.206236-0.0982231im      0.0421496-0.027256im    -0.0744452+0.0514577im    -0.0838648-0.104367im      -0.300019-0.028361im       0.0536448+0.0882107im
    0.165542+0.098383im    -0.00477323+0.0575071im   -0.112493-0.0373713im    0.252221-0.126127im      -0.185501-0.0724594im    -0.0677088+0.00462398im   0.0505507-0.0437374im    -0.0899601-0.0202297im      0.199337-0.149026im   -0.000834475-0.112799im      0.0679484+0.113116im     -0.169402+0.164595im     -0.0718038-0.0551072im     -0.106828-0.226074im      0.0498589+0.101785im     -0.101708+0.147323im    -0.0342549+0.0684271im    -0.00139271-0.232286im       0.010268-0.25022im     0.0364373-0.103972im     0.0122547-0.0109288im    -0.044625+0.150376im    -0.00421325+0.0593192im    -0.0114664-0.0902247im     0.0584475+0.137066im     -0.0802973-0.203241im     -0.333172+0.214821im      -0.0472769+0.0512893im   0.00418605-0.16962im        0.277992-0.121581im     -0.0938216+0.0242731im      0.0730505-0.0799554im
    0.106941+0.123052im      -0.163856-0.229892im    -0.161973+0.219152im     0.259003+0.0959815im     0.0717687-0.0718242im      0.126552-0.177001im     0.0468806-0.0929539im     0.0797443+0.240195im      0.0447417+0.041551im       -0.15045+0.136966im     -0.0074893-0.229873im    -0.0951975+0.037374im     0.00859231-0.0590797im    -0.0216807+0.0081733im     -0.204895+0.0136812im   -0.0106674-0.028896im    -0.0455363-0.141763im         0.10132-0.0300544im     0.0970435+0.0909159im   -0.025081-0.0364656im    0.0519045-0.232501im      0.103001+0.308862im     -0.0659062+0.0502592im     -0.149017+0.119461im      -0.216173+0.132194im     -0.0275745-0.0416741im     0.250454+0.0448624im     -0.0116394+0.0504195im    -0.225973+0.0627718im     0.0276745-0.014573im     0.00402549+0.0167072im    -0.00193573-0.0737163im
   -0.257167-0.0726003im     -0.124469+0.21274im     0.0875316+0.0425257im    0.104118+0.0143628im      0.121305+0.0822307im     0.0934702+0.0423687im   -0.0991024-0.164808im      -0.233432+0.106689im       0.186975-0.0192977im      0.201547-0.119823im     -0.0955852-0.224767im    -0.0453105-0.0652333im    -0.0953829-0.0540696im      0.048039-0.00141741im     0.102137-0.0718844im     0.283704-0.00706946im   -0.154092+0.199355im       -0.151056+0.0136058im     -0.130932+0.0656143im  -0.0195355+0.00292983im  -0.0353061+0.118453im      0.120375-0.0214948im    0.00828322-0.054815im      0.0241661+0.0434471im     -0.243233+0.016744im     -0.0194875-0.0535078im     0.022389+0.0426269im      -0.270775+0.0342791im   -0.0947648-0.0279893im       0.22569+0.0142642im      0.147888-0.277499im       0.0393433-0.0280841im
    0.133867+0.0407831im     -0.249422-0.0364217im   0.0962137+0.0421254im   -0.072452-0.23895im        0.165646+0.0754179im    -0.0254174+0.300157im    -0.0964572-0.0124758im     -0.221286+0.099036im      0.0108145-0.0516148im     -0.195864+0.0201216im    0.00235509+0.00104388im     0.10916-0.081167im        0.27563+0.0508382im    -0.0570104-0.123273im      -0.023867+0.0383931im    0.0401544-0.00781279im  -0.0252336-0.0387025im       0.143003+0.0779584im    -0.0378123-0.146568im    0.0168414+0.0360263im    0.0592358+0.0700883im    -0.108113-0.0403681im     -0.205217+0.122617im      -0.294949-0.0636251im      0.251236+0.188387im      0.0524475+0.056515im      0.119168-0.0593894im     -0.0582993+0.102509im     0.0716342+0.00499752im      0.12965+0.298996im     0.00777695-0.127016im      0.00155147-0.0615098im
    0.110958+0.20694im       0.0920977+0.089649im     0.180177+0.0687772im    -0.14037+0.0782118im     0.0638381-0.000393937im   -0.313477-0.0356406im    -0.030864+0.156758im       -0.19432+0.00973545im   -0.0211475+0.0476705im     -0.291684+0.108344im      0.0496766-0.0299121im     -0.04998+0.166977im        -0.2067-0.083316im     -0.0147829+0.0641683im    -0.0124621+0.059403im      0.135668-0.0173004im    -0.135128-0.0947531im      0.0497455-0.164326im      0.0214518-0.0363095im  -0.0565812-0.09547im      -0.191527+0.233751im     0.0215918+0.0896852im      0.135377+0.0782193im     0.0130658+0.10973im       -0.239827-0.112088im       0.189204+0.161517im     0.0173944+0.169735im       0.0622955+0.107859im      0.111045+0.00773161im   -0.0702475+0.110952im       -0.20603-0.165758im       0.0716061-0.00922448im
  -0.0271364+0.19116im       0.0369823-0.124459im     0.178366+0.140307im   -0.0615593-0.100564im       0.013746-0.0285025im     0.0061669-0.0122903im   -0.0172404-0.316972im      0.0132373-0.178653im     -0.0427085+0.162101im      0.0217849+0.0835448im     0.0954741-0.0146949im   -0.0722555-0.0120423im     0.0766706-0.186116im      0.0677829-0.315532im     -0.0244191-0.197538im     0.0863185-0.0258543im   -0.0478323+0.114104im       0.0894824-0.17471im       -0.391132+0.0720694im  -0.0732757+0.00116445im   0.0627344+0.0528937im    -0.142776-0.112425im       -0.19849-0.024381im       0.154034+0.118786im     -0.0853558+0.156207im     0.00121181+0.141951im    -0.0376074-0.0328603im        0.24954-0.0688612im   -0.0838541+0.0106494im   -0.00266756-0.120465im     -0.0531559+0.148193im      -0.0272599-0.0153805im
 -0.00902674+0.0523521im     0.0159829+0.20781im     0.0991013+0.191016im    0.0828843+0.0273315im      0.101535+0.235303im      -0.334674-0.0102919im    -0.156361-0.0910845im      0.327881+0.162122im      -0.171429+0.0308984im     0.0571238-0.13417im      -0.0334642-0.104148im     0.0242354-0.123849im      -0.113291+0.0273522im     0.0472131-0.033959im       0.267921-0.0238497im    0.0521074+0.0627054im     0.024283+0.0344449im      0.0526334-0.0846902im     0.0395565+0.0834584im   0.0387471-0.0534044im     0.226149-0.104932im     -0.252011+0.252206im       0.104941-0.0542456im    -0.0969093-0.00292375im    0.0799803+0.0374113im      0.114334-0.0177656im   0.00902713-0.0388356im     -0.0411372+0.0766753im     0.131317-0.162119im      -0.024174+0.045541im       0.100421+0.20717im         0.108357+0.0390005im
    0.138329+0.0277689im     0.0435172+0.074073im   -0.0679836-0.228339im     0.170292-0.0403595im  -0.000619116+0.165962im     -0.0912409+0.152778im      0.324413-0.021246im     -0.0563519-0.0609988im    -0.0353691-0.182343im      0.0803241-0.0445216im     -0.222095+0.16049im     0.00784005+0.138605im      0.0202857-0.271755im      -0.121421+0.13459im       -0.126607-0.0374219im     0.180414+0.237805im    -0.0229741+0.174662im       0.0585704+0.203989im      0.0412691+0.175213im    0.0993407-0.00185493im  -0.0908444-0.00719419im   -0.119339+0.183265im      -0.140165-0.0283916im     0.0796275+0.118088im     -0.0622297-0.00516868im   -0.0134883+0.20872im       0.109028-0.153856im       0.0918269+0.0827169im   -0.0545703+0.0164007im     0.0698847+0.0581401im    0.00720464+0.112384im       0.0723934+0.139462im
   -0.143425+0.248471im     -0.0625716-0.0647829im  -0.0875204-0.0296272im   -0.156711+0.0802813im     -0.147588+0.0661505im     0.0461129+0.119242im     0.0758571+0.00848481im     0.185201-0.0500713im    -0.0109575-0.0299874im     0.0172216-0.0200136im     -0.156109-0.0781669im   -0.0442136+0.0884948im    -0.0268602-0.0637535im     0.0211678+0.28049im       0.0609267+0.0240089im    0.0101927-0.17133im       -0.25988-0.0801154im      -0.094207+0.134801im     -0.0550456+0.0127247im   0.0437676-0.0227844im   -0.0460137+0.231608im    -0.0726797+0.123351im     -0.0834751+0.0459924im     -0.241937+0.157079im       0.121552+0.238328im     -0.0614147-0.0224577im    -0.237829+0.0141022im       0.048139-0.24573im      0.0327024-0.0101804im     -0.108498-0.0954915im     0.0976194-0.0381229im       0.115742-0.329138im
  -0.0603962+0.0545909im     0.0283015-0.171509im   -0.0392519+0.0326441im    0.147716-0.0936885im     0.0266972+0.186152im       0.175072+0.145625im     -0.138126+0.0588242im   -0.00838148-0.0799926im     -0.151956-0.0604255im     -0.127244-0.000779703im   0.0672075+0.0637588im    -0.249892+0.292601im      -0.109017+0.206776im      -0.099237-0.0553837im      0.106657+0.190043im     -0.131591-0.0889747im   -0.0682126+0.109873im       -0.110065-0.0283749im     -0.213912+0.0405653im    0.135073+0.0460404im    0.0975398-0.141251im     0.0295003-0.0369343im      0.117442-0.0819896im     -0.152748+0.123973im      -0.133259-0.127321im        0.10663+0.173103im    -0.0533257-0.299529im       -0.179228-0.150201im     0.0619095+0.132118im      0.0924017+0.0403405im     -0.106326+0.0249574im       0.053891+0.129235im
   0.0221156+0.175674im      0.0673403-0.0870189im    0.170344+0.0194169im  -0.0107712+0.0076303im    -0.0553254+0.127406im      0.0366611-0.199417im      0.109697+0.215352im      -0.116257-0.0794623im    -0.0590963-0.108435im      -0.109468-0.0120007im    -0.0109446-0.00627655im    0.146237-0.060073im      -0.048379+0.0339713im      0.014802+0.0549207im       0.20809+0.0251303im     0.204833-0.0994862im    0.0212567-0.0977037im   -0.000604126-0.00440581im    0.0310815+0.030144im    -0.213784-0.0380657im    0.0600273-0.0620324im   -0.0343152-0.0607104im      0.156139+0.30346im       0.0707463-0.0955741im    -0.0507373+0.0918849im     -0.245146-0.00816736im   -0.149611-0.26182im       -0.0263919-0.0527118im    -0.343159-0.103909im       0.225581+0.18277im       0.0810828+0.168702im       -0.133302+0.00875895im
    0.133426+0.00844348im     0.249335+0.232172im   -0.0283127-0.0604251im    -0.10815+0.0658932im     0.0319349+0.0434069im     0.0807495-0.110932im     -0.118529-0.259297im      0.0730354-0.049526im     -0.0107211-0.0832472im     -0.237241+0.208738im     -0.0376557-0.358198im     -0.135078+0.106077im     -0.0162249+0.0206898im    -0.0442314+0.0325155im    -0.0407474+0.00614539im   0.0376511+0.0815364im   -0.0516458-0.157944im       0.0225655+0.279373im      0.0063093-0.199306im     0.300026+0.200724im     0.0528805-0.0319941im    0.0904912-0.109671im      -0.077642-0.0222929im      0.213118-0.0985988im     0.0476462+0.0890999im      0.065851+0.0668614im     -0.12214+0.036081im      -0.0535055-0.0156315im   -0.0477923-0.123717im      0.0910976+0.104934im      0.0727464+0.0995424im     -0.0167015+0.0500518im
   -0.278619-0.0405859im     -0.124022-0.171725im    0.0549692-0.220327im   -0.0186192-0.0522611im    -0.0495372+0.101609im      -0.162579+0.0758256im   -0.0205295-0.0609129im    -0.0367836+0.187392im    -0.00919346+0.0280441im    -0.0711507+0.286217im     -0.0109018+0.0563585im    -0.270326+0.0310022im     -0.020993-0.00981553im    0.0825473+0.0244772im     -0.144856-0.0364492im   -0.0567731+0.10511im       0.125397+0.0541166im     -0.0185803+0.028428im     -0.0876485-0.103596im   -0.0454944-0.123483im     0.0561842+0.0674024im    0.0504163+0.100128im      0.0545653+0.161511im       0.138557-0.0671425im   -0.00793595-0.03661im     -0.00528744+0.0283397im    -0.122368-0.194406im        -0.19017+0.342735im     0.0183259-0.100792im      -0.219364-0.0729975im      0.164472+0.105288im       -0.202786-0.213352im
   0.0273861-0.0790857im   -0.00359234+0.166642im    -0.095824+0.0581379im    0.183258+0.170626im     -0.0829182+0.18968im      -0.0251386-0.00439219im  -0.0663598-0.00885501im    -0.134766-0.102443im     -0.0788194-0.0566943im     -0.103532+0.0248107im    -0.0929304-0.00142355im     0.11145-0.277687im      0.0978825-0.03839im       -0.260811-0.0200907im    -0.0354072+0.0612953im    -0.169377+0.0161935im     0.289422+0.0390053im       0.128843-0.0222241im     -0.237411+0.0256992im   0.0711199+0.0210443im    -0.142657+0.0477865im    0.0538476+0.00722204im     0.260435-0.17468im     -0.00615129+0.0704849im    -0.0729765+0.170205im       0.159891-0.0855455im    -0.122686-0.126984im        0.139605-0.0242225im    -0.213799-0.029535im       -0.15121+0.0606513im    -0.0574919-0.14673im       0.00203259-0.265901im
   0.0160099-0.0527566im    -0.0449652-0.0849367im  -0.0922129-0.210017im    0.0546617-0.128143im       0.208541+0.133203im       0.120312+0.00552927im   0.0785519+0.239073im       0.290926-0.0195512im      0.262322+0.040676im      -0.201347-0.231189im      0.0623508-0.227047im      0.153494-0.0529017im     -0.080991-0.221196im      0.0447271-0.0364815im    -0.0133535-0.0423102im      0.12875+0.0136589im   -0.0924378+0.110017im         0.07632-0.133752im     -0.0850717-0.149413im     0.176275-0.11328im     -0.0960702+0.0207616im    -0.068278-0.0853213im      0.120294-0.0235399im    0.00756411-0.138791im      -0.040299+0.0649542im      0.168389+0.00679095im   0.0126039+0.00289382im    -0.0710192-0.0625631im    0.0319717+0.162687im     -0.0936496-0.0464047im    -0.0520235+0.12642im        -0.301711-0.050405im
  -0.0210352-0.143578im      -0.143392-0.0608431im   0.0153655+0.0147698im   -0.176894-0.0481734im    -0.0467872-0.104576im       0.128878-0.0155678im    0.0761127-0.0631527im      0.115645-0.0907223im     -0.136253+0.101686im     -0.0691322-0.0312652im     0.0137043-0.00425308im   -0.152952+0.00501082im    0.0853316-0.0116345im    0.00328775+0.102005im      0.0628023+0.0363063im   -0.0213739+0.0783759im   -0.0779032+0.122704im       -0.186983-0.0546113im     0.0498344+0.0377978im    0.140781-0.287859im      0.132271-0.0810618im    -0.161262+0.134677im       0.240389-0.0659048im      0.293981-0.251465im      0.0506267+0.200817im       -0.12772+0.183302im       0.10534+0.0455336im      0.0702391+0.0396745im   -0.0954577+0.0219282im     0.0342741+0.238871im      -0.171741-0.288229im        0.154745-0.0937047im
 -0.00423974-0.0593807im     -0.234215+0.0414701im  -0.0687006-0.223586im    -0.025652-0.15941im       0.0779379+0.0549283im    -0.0746868-0.213525im     -0.182305+0.0544066im    0.00617054-0.0367129im     -0.123208-0.0888603im     -0.111689+0.0202575im     -0.031721+0.195863im     0.0164522-0.157386im      -0.137534+0.113159im       0.193945-0.168738im     -0.0685849-0.0401021im    -0.119188+0.118032im     -0.151393-0.0923374im      -0.120454+0.102643im    -0.00136543+0.237669im     0.226916-0.00327726im  -0.0214217+0.0780694im     0.082392-0.0199747im    -0.0138861+0.0114795im     -0.105118-0.0401017im     -0.232247-0.0645897im    -0.0526207+0.028534im     0.0819016+0.0801323im       0.291563-0.113163im      0.062011-0.158468im       0.262979-0.0120338im     0.0636955+0.0844707im     -0.0782981-0.221817im

and then generate the state $ψ$

psi = P[:, 3]
32-element Vector{ComplexF64}:
   0.05861774142786644 + 0.15303407942259734im
  -0.15347674058491173 - 0.07531381013062619im
  -0.09280826926991304 + 0.08801666059451434im
   0.06913896597772773 + 0.016872585513585444im
   -0.1058394856767451 + 0.13165251562338953im
   0.13352065884903128 + 0.16001266010657186im
  -0.06405607819944795 + 0.2076673704124252im
  -0.11213785729942491 + 0.2628147039729549im
  0.014462151492666483 - 0.18627594154965005im
    0.1764600339161313 - 0.06662115004395977im
   -0.2570993080267284 + 0.14924758554745515im
  -0.18826649317208158 + 0.09320935075077388im
   0.07386393043876421 - 0.23480493362874044im
   0.08338661950606888 + 0.03931546816930931im
 -0.007060085744992381 + 0.12863230792226352im
    0.3067891864103167 + 0.0im
  -0.18354494590646214 - 0.01723227382272574im
   0.17883418420865344 + 0.20005842285205416im
   0.02039450569900278 + 0.019638933037598002im
   0.19030201038953948 - 0.17040458202239617im
  -0.03985269445981397 + 0.11202004000509988im
  -0.08094792115159133 - 0.043706700151629044im
 -0.018220330267416412 - 0.013496241907286342im
  0.005304509087531691 + 0.022222487148900252im
   0.05840754541773147 - 0.0354337391967368im
    -0.117605084789912 - 0.06890150066070522im
  -0.16398230530619462 + 0.1616526400189266im
 0.0022449026371031203 - 0.026759537326638688im
   0.10648315700677019 - 0.007077768061450829im
  -0.09476153655186774 - 0.09736260642228184im
   0.08568949492176728 + 0.15830216491938198im
   0.06200103417993232 - 0.009575859817679375im

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.