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.177768+0.138816im     0.0892114-0.409738im     -0.0753016+0.0690777im  -0.0240301+0.268223im     0.0558305+0.172155im     0.0729981-0.0022039im   0.00406304-0.125134im    -0.111954-0.0123581im     0.0159666+0.0743665im     -0.243976+0.06208im      -0.0716354-0.117215im      -0.37775+0.0861374im     -0.0615479-0.0716733im     0.0234715+0.0193306im    0.0480832-0.136761im     -0.0922323-0.0555855im    -0.0442727-0.0113343im     0.0875048-0.0513992im    0.00177035-0.207163im      0.0875981-0.0837902im     -0.157686+0.0295883im    0.0623948+0.121727im       0.0408723+0.119891im    -0.0930732-0.139578im         0.1373-0.0412435im      0.142292-0.120014im       0.140242-0.0139645im         0.15812+0.0497411im    -0.0716007+0.0598385im     0.0999862+0.0396586im      0.131622-0.0808395im        0.17928+0.0761633im
   -0.298433+0.0486494im   -0.0926351-0.223558im      0.0395578-0.0660927im   0.0189103-0.0686454im     0.221582-0.0632873im    -0.154145+0.189422im    -0.0303727-0.0534296im    0.048341-0.0698503im     0.0241437+0.0880493im      0.191897-0.0207326im    -0.0117565+0.360065im      0.100605+0.121984im        0.182756+0.0206179im    -0.0436811+0.0860968im     0.218125+0.189607im    -0.00410149-0.021506im      -0.017945-0.124757im     -0.0751432+0.122563im      -0.273727+0.096367im      0.0270444+0.0963533im   -0.00834644+0.120393im     -0.176079+0.104575im      -0.0261381+0.0689539im    0.0401973-0.22014im       0.0744035+0.141253im       0.131923+0.0348083im    -0.0812989-0.0411879im    -0.000103578-0.0435935im     -0.201356-0.093114im    -0.00144941-0.102952im       0.128333+0.0755349im     -0.0262953+0.0891359im
   -0.106615+0.0700619im     0.112372+0.0390501im     -0.128189-0.151898im   -0.0547898+0.0882876im      0.10483-0.00542118im  -0.0845446+0.336199im      0.104902+0.157692im     0.128598-0.108251im      -0.198721+0.18423im        0.110112+0.0181912im    -0.0114209-0.0629962im    0.0278195-0.146858im      -0.0628677+0.128886im       0.137807+0.0129597im   -0.0120354+0.0501408im     -0.102568+0.142713im      -0.105959+0.0062028im     -0.144806-0.0856273im        0.1477-0.109561im      -0.071081-0.117497im     -0.0245309+0.0528918im   -0.0685448-0.146459im       0.0502186-0.277067im      -0.16465-0.00162577im    0.0459639+0.000405719im  -0.0571207+0.162742im      0.0374067-0.144596im        0.0100434-0.233116im      0.0781595+0.249542im      0.0264436-0.0387744im      0.195343+0.0442688im       0.229803-0.195034im
    0.120804-0.0915359im    -0.127753-0.0252411im     -0.171759+0.0756362im   -0.246866-0.0192926im   -0.0995412-0.0318876im   -0.0650381+0.0490953im   -0.0216574+0.0866421im   -0.203613+0.235483im     -0.0159652+0.060605im     -0.0566959-0.0171786im     0.0619915+0.137513im     -0.118068+0.108194im        0.154838+0.0133128im      0.223025+0.163297im      0.259622-0.12262im      -0.0472178-0.0516944im    -0.0267532-0.0606538im   -0.00395082-0.245321im      0.0224511-0.0634838im     -0.318676-0.00245932im    -0.159796-0.00358444im  -0.0401963-1.15154e-5im     0.0770225+0.00159048im   -0.279037+0.111474im      -0.153975+0.118685im      0.0201999+0.108978im      -0.115383-0.000191914im    -0.0646019-0.0779965im      0.102169-0.155571im       0.143985+0.0307265im     -0.113348+0.181696im      -0.0662772+0.151829im
    0.070603-0.0622162im    -0.150458-0.0499923im     0.0945307-0.191415im     0.207538+0.0917263im    -0.170169-0.270021im     0.0645338+0.152976im     0.0697688+0.028826im    -0.108771+0.0339735im     -0.145366-0.0279054im     -0.176791+0.12894im       0.0334109+0.0908324im   -0.0266771-0.0266123im      -0.136949-0.132127im      -0.103207-0.0309837im    0.0248319+0.0496408im      0.182334+0.125846im       0.278222-0.200283im      -0.120086+0.123071im       0.252845-0.19992im       -0.177912-0.0632181im     0.0381781+0.198509im    -0.0397033+0.154088im      -0.0193197-0.0303353im    0.0470824-0.00880715im    0.0932862+0.116373im        -0.1209+0.119736im      0.0275091+0.108264im          0.21063-0.074313im     -0.0696826-0.17762im      -0.0990541+0.0438353im   -0.00188846-0.097109im       0.0429225+0.104299im
    -0.09446-0.0496429im   -0.0431714-0.0961496im    -0.0354225+0.239224im      0.13858-0.137412im    -0.0688413-0.262594im     -0.110748+0.0708593im    0.0284039-0.0575041im   0.0328782+0.0396344im     -0.154005+0.180624im      -0.134304-0.0232367im     0.0149784+0.00489409im   0.0605228+0.0216136im      -0.233245+0.133737im       0.155268-0.20534im       -0.11256-0.0228159im      0.142415-0.160931im        0.20065-0.0463799im     0.0151461-0.00861628im    -0.133491+0.0451496im      0.242575-0.228461im      0.0416903-0.148977im    -0.0676856+0.17335im        0.0209005+0.021675im    -0.0447508+0.0517979im     -0.099377-0.158474im      0.0953768+0.0618699im     -0.183503+0.0608026im        -0.11235+0.0706123im      0.116079+0.0608285im     0.0349185+0.0720597im      0.040912+0.308437im        0.192469+0.0886568im
   -0.221086-0.208945im     0.0538692-0.149229im       0.165909-0.0354605im  -0.0901973-0.0624969im   -0.0312684-0.0248511im     0.203874-0.0201305im     0.107432-0.180349im    0.0997661-0.237543im      -0.131489-0.121179im     -0.0394165+0.126236im     -0.0786636+0.0952811im     0.280513+0.0281539im        0.27601-0.0322589im      0.103354-0.117056im     0.0482661-0.229577im     -0.0196353+0.014752im      0.0834715-0.0626231im      0.158736-0.210704im      0.0422195-0.00802149im   -0.0603978-0.076825im       -0.10901+0.0178194im    0.0446161-0.0380641im      -0.232948-0.0378645im    -0.110971+0.10561im       0.0535777-0.323164im     -0.0325152+0.0229703im     0.0623725+0.089119im        0.0520262-0.158773im      -0.114784+0.0772075im    -0.0504611-0.032376im      -0.135525+0.0228669im     -0.0944512-0.0115943im
    0.101508-0.0347036im     0.152218+0.000472711im    0.135475+0.111099im   -0.0176696-0.189275im      0.145034-0.00965098im    0.109601-0.103184im    -0.0959653-0.311012im    -0.172203+0.174703im      0.0889245+0.227426im      -0.121802-0.0795555im      0.126389+0.261828im     0.0451428-0.131324im      -0.0410122-0.105099im       0.231268-0.049102im    -0.0404181+0.0961283im   -0.00507162+0.0561954im   0.000997254+0.147419im       0.157384-0.13409im      -0.0568959-0.075206im     -0.0196375-0.00776417im   -0.0388424-0.103311im    0.00856048-0.0975597im    -0.00842608-0.0400413im     0.152416-0.00235724im   -0.0141943+0.221714im      -0.187306+0.154115im     -0.0242039-0.0204012im        0.101652-0.108348im      -0.204572+0.0260907im     -0.103693-0.00204327im    0.0517406-0.153902im        0.268002-0.134347im
   -0.020969+0.150347im      0.026613+0.0497939im    -0.0936667+0.0308191im    0.248213-0.171804im     0.0583204-0.0937322im    0.0555031+0.21162im      -0.183703-0.27645im    -0.0463084-0.100095im      -0.248486-0.321641im      0.0442217+0.0142153im   -0.00199105-0.0682788im    -0.228256+0.00980697im      -0.10861+0.0233194im     0.0565769-0.083155im     0.0114998-0.0028569im    -0.0960767-0.199101im      -0.172416-0.0645955im     -0.054439-0.0270028im     0.0368975+0.147514im      0.0230048+0.0897036im     -0.293712+0.0125888im    0.0348161-0.197173im     -0.00633717-0.0138712im     0.130499+0.175486im       0.152735+0.133939im     -0.0203133+0.0379456im     -0.127379+0.158858im       -0.0305437-0.160681im      0.0172806-0.0576036im      0.111284+0.0755121im     0.0151955-0.0174147im      -0.128867+0.028417im
    0.174745+0.387336im     0.0493856+0.102892im      0.0583653-0.0697979im  -0.0606827+0.091604im    -0.0787483+0.00470334im     0.12694-0.218412im      0.176148-0.0187234im    0.209675-0.00393851im  -0.00349693-0.000319164im   -0.248458+0.07729im        -0.14017+0.117229im    -0.0261376+0.0136739im      0.0617118-0.0401697im      0.131355-0.246289im     0.0704258+0.09855im       0.0511367-0.234398im     -0.0679795-0.00311493im    -0.290108+0.067513im      0.0224768+0.0835318im      0.037877-0.0380567im    0.00436949-0.132079im    -0.0503078-0.030299im      -0.0489489-0.129371im    -0.0813319-0.268117im     -0.0883857-0.00302624im   -0.0943295+0.0354259im     0.0129243-0.110325im       -0.0568602-0.192636im      -0.165171-0.0461554im      0.135418-0.0606619im    -0.0650744+0.0502617im     -0.0605065+0.16836im
   0.0831233-0.0565975im   -0.0376423-0.0950284im     0.0607451+0.169092im    0.0122683+0.219141im     0.0322451-0.218203im     0.0747474+0.0942866im     -0.18831+0.0767217im  -0.0711743+0.0628824im      0.131158+0.0528267im    -0.0358926+0.214856im      -0.140526-0.0382781im     0.173701-0.186882im      -0.0590868+0.130392im      -0.157874+0.101144im      0.167933-0.113862im       0.028366-0.00527143im    -0.139607+0.0845395im     0.0565409+0.0771243im     0.0178518-0.00812947im    0.0778516+0.13173im       -0.129348-0.0858106im    0.0452539-0.102324im       0.0373944-0.162777im      0.115149+0.0480682im     -0.128319-0.182141im     -0.0456172+0.119127im    -0.00125035-0.216241im       -0.0345312-0.0154615im     -0.242968-0.0362073im    -0.0234444+0.331936im       0.253464+0.0544932im      -0.152528+0.137006im
   0.0060927+0.182925im      0.260003-0.0060395im       0.03218+0.0822179im   -0.153492-0.145064im     0.0071991-0.207425im     0.0583945-0.0801651im     -0.20552+0.0471059im    0.244958-0.143881im      -0.125779-0.129477im       0.128291+0.130722im      0.0598338-0.00317244im   0.0256697-0.0599764im     -0.0296026+0.00290152im    -0.116157+0.107595im      0.145657-0.115318im      0.0731984-0.0947802im     0.0483606+0.103211im     -0.0824268-0.130116im    -0.00717486-0.22211im      -0.0266742+0.11638im        0.133405-0.0415689im   -0.0170032+0.254219im       -0.023361+0.158266im    -0.0317502+0.164238im    -0.00910706+0.0441507im     -0.107528-0.114446im      -0.146544-0.259494im         0.199528+0.0391373im     0.0535118-0.194766im       0.176189-0.0774219im     0.0290877-0.0310084im       0.178957-0.112749im
    0.142798-0.0421043im    0.0660592-0.0432786im      0.219454-0.170878im    -0.111696-0.256842im       0.17417+0.0246052im    -0.034728+0.0153634im   -0.0681449+0.249576im   -0.0138233-0.142035im       0.102591-0.0974808im    -0.0782268+0.0393257im    -0.0910347+0.0276137im    -0.102157-0.0946301im       0.022959-0.0698503im      0.259619-0.141375im   -0.00665823+0.0513283im      0.282528+0.0360114im     -0.275129-0.0170042im    -0.0023373+0.200047im      -0.233277-0.233892im      -0.109616-0.0735164im    -0.0622203+0.146287im     0.0800852+0.0268591im      0.0845585+0.0102273im   -0.0244217+0.156323im      0.0478409-0.0592056im    -0.0580093-0.140091im     -0.0292266+0.139169im       0.00442217+0.0848283im     0.0603422+0.160953im     -0.0455351+0.10024im        0.112566+0.0818237im    -0.00370196+0.197156im
  -0.0634437+0.020459im     0.0343597-0.0486289im     -0.033203-0.0929661im    0.020137-0.0433274im    0.0939377+0.0483998im   -0.0310326-0.250775im   -0.00884824+0.135146im   -0.0380626+0.0107059im       0.09645+0.0635536im     0.0246277-0.234654im     -0.0711488-0.349921im      0.269507-0.0061454im      -0.209659-0.0277293im       0.13159-0.109764im     0.0630068-0.0355862im    -0.0875941-0.0976537im     0.0975621-0.147265im       0.209286+0.1708im       0.00286449+0.081688im     -0.0280578-0.0755216im     -0.074384+0.272129im      -0.13776-0.0873806im      -0.188395+0.125351im     -0.160251+0.0737989im    -0.0621923+0.111523im     -0.0172522-0.00723136im   -0.0772862-0.0677898im       0.0478882-0.239063im     -0.0682575-0.247401im       0.143555+0.106768im       0.148341-0.0782463im      0.0164643-0.0226056im
  -0.0385958-0.0171728im    -0.122611+0.0749833im     -0.027794-0.218367im   -0.0293647+0.141518im     -0.110076-0.0711777im    -0.062714-0.192872im     -0.219032-0.127774im      0.15782-0.136427im      -0.147722+0.108023im     -0.0683595-0.116866im      -0.100261-0.0579727im    -0.202529+0.268514im        0.250965+0.233962im      0.0546395+0.0249523im    -0.160895-0.0816283im      0.219665+0.0263876im    -0.0835562+0.0927616im      0.159431+0.00170069im    0.0849097+0.124125im     -0.0472306+0.0242825im      0.043319-0.0220665im    -0.141601+0.127491im      -0.0270659-0.0577911im   -0.0248981+0.114564im     -0.0149797+0.245063im     -0.0334306-0.0518892im    -0.0381828-0.0880939im       0.0144785-0.0261212im     -0.131426+0.0513218im     -0.259827+0.230331im       0.109968+0.0808865im      0.0400809-0.0552665im
    0.044677-0.0232594im    -0.011394-0.0929798im      0.146498-0.0927302im    0.125829+0.0128232im    -0.254952+0.0636694im    0.0750194+0.181498im    -0.0515158-0.0474182im   -0.125927-0.262914im       0.207671-0.151948im     -0.0853892-0.111061im      0.0223943-0.0012867im    0.0369248+0.15496im        -0.202415+0.188093im       0.307665-0.0610205im     0.152063+0.0676372im     -0.210057-0.0427227im     0.0364459+0.060113im     -0.0122422-0.068236im      0.0681321-0.0241274im     -0.054475+0.21199im        0.199171+0.108444im    -0.0204353+0.00834164im    -0.0491023+0.146238im      0.110091-0.0396076im     -0.144442+0.0561558im    -0.0948945+0.0748069im      0.132417-0.2249im          0.0419242+0.16096im      -0.0064653+0.178556im      0.0403649-0.0493813im   -0.00945421+0.240641im      -0.0456484-0.0476521im
    0.100225+0.142839im    0.00561835-0.327696im     -0.0487603-0.0553314im  -0.0248841-0.0372742im    -0.147934+0.167916im     -0.108724-0.0297287im    0.0146384+0.0413646im    0.051868+0.170176im     -0.0451788-0.091467im      0.0957901+0.132043im     -0.0255093+0.202487im     0.0455357-0.0706466im    -0.00594997-0.0585209im      0.159404+0.0177348im    0.0395601+0.0706459im      -0.12317+0.00325149im    -0.224947+0.00293129im    -0.065933+0.00570695im     0.115396+0.0820992im      0.296903-0.136263im       0.241613+0.0967542im    -0.025359+0.0102466im       -0.18507-0.161531im    -0.0161896+0.246695im     -0.0100473+0.0230525im      0.145667+0.068646im      0.0254072+0.0879874im        0.158117+0.124439im      0.0288878-0.187492im      -0.131795+0.282654im      -0.119345+0.000774983im  -0.00196237-0.164384im
 -0.00311077-0.101212im     -0.088957-0.181891im     -0.0113041+0.200875im    -0.210317-0.112981im      -0.19748+0.0252713im     0.157526-0.0278168im    0.0872008-0.113589im     0.106024-0.0108723im      0.100455+0.117766im     -0.0395332-0.0340414im     -0.129835+0.00250207im   0.0135743-0.0323958im     -0.0594045-0.119018im       -0.18471+0.0766804im    -0.121726+0.204779im      0.0356954+0.0426366im    -0.0179084+0.0132689im    -0.0608407+0.123535im       0.078449+0.223661im     -0.0429806+0.0897038im     0.0389887+0.077581im    -0.0406606-0.132649im        0.110722+0.0557618im   -0.0491674+0.197475im       0.210036+0.0966562im     0.0359131-0.0136941im     -0.193593-0.174155im         0.317878-0.172787im       0.117098+0.308286im      0.0954715+0.0111792im    -0.0558026+0.0965557im     -0.0255307+0.195038im
  -0.0551353+0.141612im    -0.0410555+0.102423im      0.0235735-0.0663799im   0.0183968+0.0858187im    -0.238885+0.173931im     -0.016563+0.0442819im    -0.079359+0.0316496im  -0.0121761-0.0332776im     -0.140868+0.169144im      0.0116801+0.116046im       -0.11593+0.0219205im    0.0622028-0.048882im       -0.208488-0.132887im    -0.00973652-0.056349im      0.317692-0.0845384im     0.0600686-0.00126535im     0.161903-0.016589im       0.128056-0.100228im      -0.265392-0.0264087im    -0.0536701-0.111367im     -0.0188175-0.146062im     -0.337142-0.269691im       0.0449179-0.127925im     0.0299363+0.140829im       0.151596+0.10447im      -0.0504469-0.244741im      -0.063531+0.000161394im    0.00749499+0.250837im     -0.0608841+0.0913434im    -0.0711575-0.0800964im    -0.0402843-0.0859561im      -0.114902+0.00223023im
  0.00512882-0.119642im     -0.118658-0.290525im     0.00193692+0.0465605im     0.12079+0.0201137im     -0.11909+0.0580331im    0.0747481-0.132064im     0.0080823-0.0501926im    0.126086+0.0894141im    -0.0791419-0.118407im       0.296726-0.230096im      -0.141989-0.0670323im     0.168123-0.0028845im     -0.0317847-0.0083924im     0.0632864-0.0587897im     0.101722+0.114888im       0.109295-0.0739855im     -0.126026+0.0652358im     -0.219944-0.0693468im     0.0944883-0.0123476im     -0.198554+0.0203607im    -0.0776023-0.244007im    -0.0962338+0.0615273im       0.178753+0.160697im     -0.127665-0.0573861im      0.117381-0.0632732im     -0.207725+0.135933im       0.106158+0.109571im        -0.163255+0.161987im      0.0235246+0.018714im     -0.0429766+0.0892322im      0.144702-0.224282im        0.147513+0.0416564im
    0.145006+0.129923im     0.0824459+0.0147718im     0.0661063-0.0475112im   0.0943534-0.0115921im    -0.129399+0.0438194im    -0.132554-0.0335103im     0.264065-0.0825601im   0.0439149-0.0959861im     0.0476331+0.0526395im    -0.0848993-0.111468im       0.331785+0.0121712im   -0.0424416+0.115063im        0.167557+0.149568im      -0.190063-0.0156707im      0.11664+0.0584472im      0.133353+0.256771im     -0.0130051-0.0613477im     -0.034999-0.164927im     -0.0926217-0.0289696im      0.200611+0.0779106im    -0.0911273+0.147654im     -0.128787-0.271134im        0.169087+0.196347im    -0.0329855+0.117636im    -0.00934877-0.232103im      -0.118369+0.034694im     -0.0405704+0.0728546im       0.0302808+0.00815539im   -0.0706292-0.0894407im      0.170461+0.222134im      0.0783408+0.00958719im      0.107293-0.016362im
    0.030269+0.00788241im   0.0114376+0.0185522im    0.00679766-0.0843972im   0.0778989-0.0511583im   0.00700802-0.13554im     -0.0450826-0.011086im    0.00458181+0.0580321im    0.051659-0.114596im      0.0253889+0.184111im       0.104071+0.302985im      0.0082099-0.079341im     -0.066805+0.018701im      -0.0201545-0.119438im       0.272609-0.119743im     -0.113951+0.114318im     -0.0922094+0.141347im      -0.074584+0.00895792im     0.208232+0.0239227im       0.14025+0.0994785im    -0.0498133+0.303521im     -0.0298918-0.264719im     -0.253477+0.053028im        0.239389+0.110987im     -0.068707-0.027435im      -0.156857-0.163648im       0.254432+0.058984im     0.00809271+0.137336im         0.244602-0.0127948im   -0.00949345-0.109256im      0.0608682-0.0758851im    0.00205248-0.141087im      -0.0993118+0.00753813im
   -0.110516+0.0233439im    0.0519632+0.370195im      0.0566854+0.178922im     -0.18183+0.0459247im    -0.120617-0.0528954im    -0.028779+0.0115586im    0.0603665-0.0195897im   -0.304326-0.0479188im     0.0811676-0.256433im      0.0792893+0.0551352im     -0.203885+0.0927563im    -0.017029+0.076524im      -0.0943012-0.00790934im   0.00704364+0.062025im    -0.0782798-0.0329898im    -0.0387573+0.0560655im    0.00738566+0.180822im      -0.214389+0.139613im      -0.145717-0.0174488im   -0.00119069-0.164064im     -0.0446362-0.0313973im    -0.237313+0.0542156im    -0.00222217+0.228073im     -0.185518+0.00211468im    0.0840784-0.0481294im      0.111751+0.110201im       0.114351+0.10731im          0.127887-0.11568im       -0.167814+0.0174623im    -0.0639711+0.178627im      0.0466946+0.0517777im      0.0640984-0.200063im
   -0.057445+0.112977im      0.148179+0.0222771im    -0.0372519-0.0288788im  -0.0260284+0.0990841im   -0.0796456-0.0349144im    -0.150038+0.0248086im    -0.205072-0.314684im     0.100629+0.011506im       0.116019+0.0920586im      0.142726-0.129646im      -0.100308+0.0343586im    0.0965331+0.0105276im     -0.0906247+0.0759441im    -0.0540225-0.106762im    -0.0183767-0.198292im     -0.0001701+0.115394im     0.00390449+0.172082im      0.0142965+0.0345982im    -0.0606107-0.156537im     -0.0999272+0.0176009im      0.255963+0.114907im      0.179503-0.0798014im      0.0507195-0.153298im     -0.166711-0.224123im     -0.0583073+0.0137138im    -0.0526982+0.0993207im     -0.118369+0.385823im         0.195836+0.0136886im      0.110504-0.00253649im     0.151438+0.0641578im    0.00637178+0.0117362im      -0.177043+0.162308im
   -0.144254+0.0401863im    0.0454534-0.0751094im     -0.168524+0.147901im      0.10929-0.0338478im    -0.153665+0.27007im      0.0608978+0.17408im      -0.125182+0.124006im     0.102239-0.0222242im    -0.0391204-0.0830051im     -0.109938+0.142419im     -0.0209454-0.135556im    -0.0501133-0.145443im          0.1033-0.0856271im   -0.00800413-0.0925986im    0.0757305+0.105266im   -0.000229335+0.239934im      0.0559611+0.239586im      0.0675051+0.129575im      -0.118052+0.186157im      -0.189658+0.039416im     -0.0436834+0.116191im     0.0400909+0.102695im       0.0359705+0.0497132im    0.0264762-0.156337im      -0.203127-0.0500433im     -0.186138-0.034602im       -0.21499+0.0690298im       -0.104177-0.114447im      -0.106196-0.101956im      -0.117316+0.118183im      -0.237222+0.0839889im       0.236633-0.0437612im
   -0.266491-0.0104815im   -0.0496125-0.0483313im    -0.0112309-0.0526008im   0.0220904-0.214437im    -0.0624017+0.0620544im   -0.0403996+0.0333906im     0.104504+0.0447013im    0.144595+0.100986im      0.0552297+0.125966im      -0.158994+0.178082im       0.136272+0.0438658im   -0.0745099+0.0201973im     -0.0908626+0.0415513im    -0.0121178+0.14807im     -0.0237376-0.062923im     -0.0946343-0.0666908im     0.0167033+0.284678im     -0.0302451+0.102528im      0.0177768-0.0686759im      0.210998-2.76706e-5im    -0.032965-0.0257487im   -0.0473443+0.0938509im    0.000767144+0.152989im     -0.160517+0.148209im     -0.0784367+0.109859im      -0.400356+0.0355125im      0.156468+0.0956304im       -0.107587-0.144331im      0.0710245+0.0150173im    -0.0928117-0.0822767im      0.171427-0.0994932im      -0.366093+0.0429874im
  -0.0875507+0.0124029im     0.151109+0.118629im       0.180303-0.157893im     0.248316+0.0721861im     0.123264-0.034877im       0.12172+0.029137im    -0.0467277+0.154472im    0.0523462+0.163606im      0.0697063+0.139465im      0.0376718-0.15347im       -0.135618-0.10777im      -0.147919+0.153556im         0.10176-0.124191im      -0.193787-0.0566372im     0.319612+0.0401927im     -0.138963-0.109177im     -0.0593515+0.07935im      -0.0399488-0.0800806im    0.00141232+0.0104758im     0.0107267-0.168888im        0.14305-0.101071im      0.100843+0.00424305im      0.027721+0.167955im     0.0555051+0.283635im      -0.121925-0.0685414im      0.109935+0.251409im     -0.0831659+0.084645im         0.123356-0.120118im       -0.02961+0.11663im       -0.166997-0.0722771im    -0.0997881+0.0659124im      0.0662615+0.110606im
    0.114393+0.196724im     -0.101167-0.038091im       0.145523-0.193907im    -0.170742-0.263784im    -0.0510657+0.115626im     -0.262224+0.218516im     0.0769248-0.140219im   -0.0602078+0.253577im     -0.0323239-0.0406569im      0.010097-0.0690847im     -0.146542-0.191868im    -0.0681425+0.0970497im     -0.0359107-0.0961163im    -0.0488964+0.0678469im     -0.06406+0.0100159im     0.0243639+0.011299im       0.204106+0.126129im      -0.029815-0.0532643im     0.0453488-0.0245911im    -0.0783698+0.247091im     -0.0374628-0.118692im      0.050169+0.032973im       -0.337377-0.0468346im   -0.0076754+0.0035729im    -0.0102254-0.274115im      0.0730383-0.0209314im     -0.158646-0.0674654im      -0.0329497-0.00275556im    -0.116978+0.0405639im    -0.0928349-0.0252785im      0.195475-0.038918im       0.0671496+0.0605757im
  -0.0848925+0.103673im    -0.0225385-0.0307204im     -0.334071-0.217686im    0.0380669+0.0052234im    0.0233439-0.153108im     0.0558636-0.169013im    -0.0602688-0.0583272im  -0.0881455+0.197835im       0.195393+0.0105161im      0.119454+0.0834549im    -0.0819589-0.0275791im   -0.0100217-0.151885im        0.205363+0.170885im       0.141571+0.0335545im    0.0654213+0.0799032im     0.0491321+0.00410907im     0.217846+0.0748479im    -0.0588396+0.215585im       0.134201-0.0100115im     0.0354367+0.00163183im    -0.129552-0.00758047im   0.0484214-0.0979674im    -0.00157312+0.0259605im    0.0763102+0.176376im       0.132676-0.127799im      -0.144068-0.0916145im      0.060414+0.135071im         0.101476+0.169022im      -0.157783+0.07206im        0.148162-0.215007im     -0.0330952+0.287661im       0.0934891-0.106048im
   -0.125966-0.0815277im    0.0916728-0.045555im      -0.112557+0.161486im    -0.029164-0.100417im       0.14995+0.0794659im   -0.0376749-0.0471644im  -0.00762568+0.0652889im  -0.0814656-0.0894495im     0.0503976-0.0270266im     0.0243655+0.0249998im      0.186362+0.0710364im    -0.103566+0.0532693im   -0.000130429+0.20565im       0.0472558-0.0750364im   0.00450784-0.0080727im     -0.019334-0.275873im       0.230097-0.0207461im     -0.254767+0.0341022im      0.228101-0.0409541im     -0.151901+0.0191687im      0.243358+0.060256im    -0.0429774-0.227653im        0.138062-0.0831304im   -0.0407919+0.0651743im     -0.157894-0.112767im      0.0973929-0.249744im      -0.138568+0.0343541im       0.0233565-0.0140515im     -0.236673+0.0751371im     -0.226338+0.111463im      0.0153327-0.259782im     -0.00354253+0.112668im
    0.059253+0.0275067im    0.0322148-0.00427042im     0.197446+0.102601im    0.0490352-0.00100003im  -0.0533759-0.0208676im    -0.261345+0.157837im       0.03742-0.060207im    -0.073638+0.0601213im    -0.0105164+0.204228im       0.107488+0.134634im      -0.121165-0.0640803im     0.044223-0.122124im        0.197145+0.0993334im      0.130653-0.0929369im     0.159406-0.288783im       0.229796-0.127757im     0.00802664+0.0676377im    -0.0521847+0.136169im       0.149318+0.0968114im     0.0731839+0.0711095im   -0.00234771+0.0564555im    0.0933717-0.186394im    -0.000596772+0.310607im     0.0651442-0.112968im       0.100226+0.135243im      0.0472795-0.10918im        0.197282-0.107993im      0.000228534-0.151546im       0.250602-0.0331666im     -0.111025+0.00904274im    -0.184326-0.0713767im       0.114535-0.00265883im
   0.0305842+0.2671im      -0.0491724-0.105467im      0.0100474+0.025056im    -0.015552+0.11678im      0.0403373+0.0668338im    0.0702166+0.082663im      0.126106+0.0990806im   0.0123588+0.0771303im    -0.0398822-0.107323im     -0.0447973+0.00975696im     0.177282-0.0397548im     0.312202+0.0335875im      -0.033725+0.177466im      -0.117288+0.0487901im    -0.180629+0.056136im       0.191574-0.284839im       -0.15441+0.23257im        0.212441-0.0267214im     0.0873655-0.251671im       -0.10747-0.00367772im    -0.196085+0.0737874im    -0.146795-0.0708591im      0.0209311+0.109895im     0.0454732-0.0559432im    -0.0478603+0.0995399im      0.165898+0.119969im      -0.145517+0.129358im         0.123689+0.0433148im    -0.0317385+0.0748089im     -0.184861-0.149062im      -0.133374+0.113451im      -0.0437302-0.0379767im

and then generate the state $ψ$

psi = P[:, 3]
32-element Vector{ComplexF64}:
 -0.011890986924981396 + 0.10702529586024936im
   0.00715568510825525 + 0.18002737801196692im
 -0.008359064586976318 - 0.15084375190792432im
  -0.08707891105771468 + 0.09625851645178747im
   0.12480632854419907 - 0.28925450618038295im
 -0.006095958726917399 - 0.0784941367492614im
  0.041659567613199416 + 0.21565619577285725im
   0.12203925957726429 - 0.03433349307757902im
   0.05108523006548741 - 0.013688362614934104im
  -0.05824049668969814 - 0.14242207376568503im
   0.09187260012639732 - 0.10357132307134403im
  0.033515207349003935 - 0.069807468441493im
   0.35958375806302656 + 0.0im
 -0.004055200970803363 - 0.2895419146692615im
  -0.03022210337055086 - 0.024453265446670043im
  -0.11636092048244659 - 0.21217988992626083im
 -0.021895181677657544 + 0.10359312892447092im
  -0.12010199017606098 + 0.1326139719851962im
  -0.04101327325260209 - 0.04141152031583504im
   0.25090658809673894 + 0.004218068035609049im
  -0.07204493995376773 + 0.1574930473796715im
 -0.019374967319141075 - 0.07225114566653021im
  -0.01980204786738128 - 0.1292758095514282im
  -0.07809489163689667 - 0.15418305006692892im
   0.08937891725600229 + 0.0021430632461348874im
 -0.036695632223304804 + 0.31127725158576im
 -0.030338351597274632 - 0.11701042957728025im
  -0.18350681479314038 + 0.05275991937028946im
   0.09458630800774857 - 0.042513359915326746im
  -0.10190490468161116 + 0.03700894798326941im
   0.04491264471907415 + 0.01403337337882133im
  -0.14326153124208577 - 0.1641524969136779im

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.