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.251183+0.0639319im    -0.0997399-0.0426681im      -0.182047-0.124508im     -0.0337297-0.00534328im   -0.0954312+0.0742809im      0.0446907+0.136658im      -0.236477-0.00609901im      0.275604-0.172625im       0.171342+0.0192933im      0.123188-0.149405im       0.0250979-0.19727im     -0.0176902-0.144499im     0.0145263+0.156348im       0.0602758+0.0737297im     -0.262609-0.00753575im   0.0826924-0.113393im    0.00819427+0.0694064im     -0.226094-0.119485im      -0.185252-0.00215681im   -0.0407895+0.0207191im     -0.108619-0.0760287im     0.173216+0.0176649im    -0.0824007-0.0754067im    -0.291775-0.0311156im   -0.0580814-0.0204046im     0.207507-0.0453154im    -0.0448258-0.0532972im   -0.0254057-0.23163im       0.0765223-0.110353im     0.0547424-0.0560895im     -0.0500407+0.184878im    -0.0187613-0.0373248im
  -0.104183+0.19827im       -0.275411+0.0066672im     -0.0385037+0.00475102im  -0.00349477-0.139446im      0.0393446-0.165081im     -0.00114003-0.158643im      0.0194334+0.0524866im     -0.0129566+0.0911969im     0.0690445+0.0812917im      0.145275+0.0831621im      0.0740725+0.00313147im   0.0703223+0.0297267im    -0.130801+0.0363446im     -0.0383746+0.222068im      0.0954717+0.319013im      0.058907+0.0953711im    -0.190948-0.0560187im    0.00173195+0.0854642im    -0.0763824+0.159349im       0.284945+0.127765im       0.151146-0.26647im      -0.153781-0.101731im      -0.107142-0.0799256im    -0.033537+0.0171935im    -0.105055-0.0964348im   -0.0316941-0.0556029im     0.0471888+0.0893234im     0.165455-0.213284im     -0.0467231+0.012785im     -0.089729+0.284494im       0.0798553-0.0728161im    0.0520163-0.0894051im
  0.0993719-0.269492im      -0.023649-0.142609im      -0.0041008+0.291111im     -0.0279777-0.0362781im       0.03424-0.0874639im       0.146897+0.0223361im       0.17012+0.0185293im       0.181513+0.213351im     -0.0111941-0.128583im      0.0847061-0.0808057im       -0.18661-0.0379987im    -0.214235-0.0546941im   -0.0197109+0.0333599im       0.102854+0.0947627im     0.0384041-0.189875im    -0.0688226-0.012297im     -0.151725+0.156162im     0.00487817-0.0387691im      0.104741+0.252008im     -0.0431062+0.235598im        0.18098-0.127171im      0.172873-0.0085074im     0.0216946+0.203284im     0.0918703+0.0627047im     0.140134+0.0215255im      0.20949+0.0669772im     -0.100771+0.0970435im   -0.0838833-0.154605im    -0.00856201-0.107144im     -0.135899+0.0961049im     -0.0508328+0.0861195im   -0.0553665+0.0834352im
 -0.0233488+0.233153im       0.154441-0.0269846im     -0.0596689-0.108854im       -0.46815-0.18465im       0.0277177-0.274491im      -0.0492951+0.0951762im     0.0170554-0.0642627im     -0.0399299-0.0664469im      -0.12135-0.0941945im     0.0635373-0.0360491im      0.0143859+0.167787im       0.01551-0.0300814im    0.0278889+0.0011988im      -0.212694-0.0354833im     0.0431275+0.00183146im   -0.115381+0.107658im    0.00335416+0.11507im       -0.136942-0.302937im     -0.0106792+0.0473498im    -0.0985846-0.191198im      0.0207844-0.0732396im   0.00720492+0.00918359im   -0.0128803+0.116315im     0.0370187+0.0484416im     0.112567-0.0125462im     0.113183+0.0131043im      0.151631-0.0859026im    0.0356926-0.0191888im     -0.161838+0.100945im     -0.234025-0.0506446im       0.213854+0.123687im     0.0372215+0.107799im
   0.172756+0.158799im      -0.288606+0.0280667im       0.174382+0.119748im     -0.0750626-0.0937632im    -0.0760772+0.148242im       0.0376849-0.000221401im   -0.182677-0.137942im      -0.0206525+0.0294244im    0.00847676+0.305175im     -0.0418779+0.166934im       -0.137825-0.154187im    -0.0962245+0.209909im     0.0610578-0.0115456im   -0.000881256+0.0394793im    -0.0460631-0.11502im      -0.132997-0.070509im      0.142721+0.0337081im    -0.0439321-0.011735im      0.0065812-0.03203im        0.168125-0.192757im       0.101131-0.129533im       0.23736-0.0158218im     0.0134435+0.04713im      0.0984773+0.0854108im    -0.192018+0.0977252im   -0.0449104+0.245609im       -0.20184-0.0851027im     0.121526-0.0146805im     0.0631324+0.14718im      -0.117469-0.127121im        0.125873+0.0857654im    -0.107572+0.0360697im
  0.0266736-0.128747im      -0.147936-0.0330099im      0.0603644+0.231093im      0.0481211-0.0591326im    -0.0742932-0.21613im         -0.22775+0.168774im      -0.103485+0.0655401im      0.0619551-0.0295398im     0.0661407+0.0117448im      0.105864-0.03661im        -0.186386+0.206223im        0.1364-0.256522im   -0.00597743-0.137544im       0.0979165-0.0147981im     -0.162713+0.069411im     -0.122707-0.189371im   -0.00960907+0.0021281im     -0.061429-0.0212744im   0.000733618-0.0261991im    -0.0649914-0.0700135im      0.127923+0.0584457im   -0.0163771+0.152348im     -0.0316193-0.0220698im    0.0431524+0.0410252im    -0.429909-0.130594im    0.00992938-0.0699642im      0.201431-0.0104291im    -0.129275+0.217899im        0.14194+0.0154556im    -0.174542+0.0429135im    -0.00750595-0.162133im     0.0407332+0.000612276im
  0.0351223-0.091134im       0.174231+0.119017im      0.00157141-0.052548im     -0.0992555+0.0516095im     0.0921423-0.0472249im      0.0910493+0.0781574im     -0.378045+0.0129507im     -0.0580887+0.105922im       0.171981-0.023261im     -0.0824806-0.000788134im     0.091262+0.101379im     0.0715213+0.0808812im    -0.169748+0.206688im       -0.123572-0.00150615im     0.213463-0.079456im    -0.0167287-0.056441im     0.0518639+0.0106645im      0.021433+0.145666im      0.0139173-0.0147146im     0.0774961+0.0359616im      0.109711-0.0614067im    0.0449178-0.123131im       0.275887+0.151661im     0.0166966+0.23121im      -0.170198-0.333378im    -0.0284613-0.175829im      0.0900519-0.0573972im     0.063906-0.0164372im     0.0148633-0.152943im    -0.0111447-0.0714502im      -0.208949+0.158402im     -0.187316+0.0149922im
  -0.100575+0.25929im      -0.0442936+0.0887273im       0.133533+0.010458im       0.114513+0.054807im        -0.1405-0.323262im      0.00187148-0.19945im       0.0578349+0.168993im       -0.283098+0.0742392im     0.0416218-0.158843im       0.124916+0.1482im         0.0854187+0.0265488im   -0.0411734-0.101384im     0.0517723+0.101996im       0.0234152-0.0179385im     -0.130794-0.25922im      -0.118191-0.0854273im    0.0339889-0.0548998im     -0.159316+0.0182352im     0.0324035-0.14479im         0.04884-0.0587596im     0.0404681+0.0836337im     0.183006-0.00795664im    -0.164353+0.086065im      0.131001+0.0808367im     0.106892-0.153898im      0.220035-0.0171434im    -0.0971875+0.0924861im     0.153237+0.00556976im     0.101966-0.0893462im     0.281285-0.00159539im    -0.0624552-0.0649313im     0.052199+0.0379085im
 -0.0528379+0.183396im       0.116655+0.193303im      -0.0500593+0.220276im     -0.0564854+0.118797im       0.243373+0.0263771im       0.208397+0.0417734im      0.158554+0.133325im        0.243278+0.0615976im     -0.181714+0.15244im       0.0210431-0.174504im        -0.17921+0.104604im      0.270185+0.0442467im   -0.0786532+0.0568553im      -0.169331-0.0174194im    -0.0565228-0.0112999im   -0.0526006-0.0171148im    0.0857574+0.165177im     -0.0197965+0.174705im       0.132551-0.258081im     -0.0334809+0.00903969im    0.0566599-0.0364864im    0.0371162+0.163484im      -0.223922-0.0504434im    0.0417396-0.114216im    -0.0540735-0.0140545im   -0.0636877-0.102738im      -0.117709-0.0179538im     0.156195-0.173906im     -0.0529627+0.010247im    -0.0295307-0.111251im         -0.1418-0.0544563im    0.0678163-0.0435796im
  0.0707914-0.152595im      0.0632051+0.19901im        -0.240512+0.156848im      0.0783813+0.0753893im    -0.0401045+0.000205271im     -0.10482+0.134751im      0.0992748-0.109926im        0.135241-0.0403816im    -0.0519288+0.0439682im     -0.224529+0.127128im       -0.201493+0.0836822im    0.0785443-0.134118im      0.185476+0.13417im          -0.1676+0.0461545im    0.00826224+0.127448im    -0.0621907+0.0248973im   -0.0917787-0.169254im      -0.179628-0.0966888im     -0.104692+0.157931im       0.296363-0.16008im      -0.0591622+0.13093im        0.14758-0.154596im      0.0686182+0.00249447im    0.141599-0.174404im     0.0775301-0.0823169im   0.00554802+0.0578968im    0.00304954-0.13116im       0.195403+0.0385986im    -0.0265737-0.114759im      0.182106+0.178241im      -0.0147531+0.0883013im    0.0605088+0.0417464im
 -0.0854682-0.0596356im      0.131529-0.079902im      0.00907115-0.028911im      -0.120542-0.00167263im    -0.232897-0.0492857im      -0.122245+0.00643341im    0.0139724-0.0602189im     -0.0834269+0.0318374im      0.214896+0.114986im       0.051231+0.296979im        -0.33735-0.00716704im  -0.0607378+0.0117868im   -0.0521582-0.0261975im      -0.172569+0.00469185im   -0.0551213+0.038403im     -0.139208-0.0728973im   -0.0318514+0.158168im     -0.0705801-0.0951183im      0.117929-0.17289im      -0.0858124+0.263198im      -0.164866+0.0108303im    -0.091127-0.0141728im    -0.0661527-0.0247289im    0.0250905+0.0502689im    0.0763659+0.0649961im    -0.398563-0.0781377im    -0.0136873+0.00083621im  -0.0194277-0.209413im       0.043018-0.25326im      0.0723753+0.0361587im        0.11074-0.0405762im    -0.156255-0.0386229im
 -0.0609392+0.00567242im  -0.00400111+0.11398im       -0.0513913-0.113148im       0.106981-0.0226822im      0.291564-0.0860716im      -0.089074+0.0730836im    -0.0159209+0.0801454im      -0.024821+0.297758im     -0.0238669+0.120751im      -0.122897+0.0722691im      0.0351272+0.185255im     -0.371498+0.0667391im   -0.0529818+0.178852im       0.0858661+0.360648im      -0.195298+0.127452im    0.00909516-0.0428126im     0.145924+0.0314018im     0.0468496-0.0172587im     0.0834341+0.157605im      -0.119476-0.106296im      -0.167986-0.140306im     0.0602811+0.144907im     -0.0594217+0.0458214im   -0.0424169-0.0496663im    0.0649643-0.0732123im     -0.15733-0.0312012im     0.0219762-0.0939199im   -0.0963002+0.0949851im      0.119248-0.0617956im    0.0390814-0.126571im       0.0806047-0.00332356im    0.184126+0.0931832im
   0.215767+0.0469689im    -0.0523919+0.0302599im      0.0256139+0.0731689im      0.102507+0.0181242im    -0.0813195-0.0724871im       0.157997+0.119951im       0.126148-0.00734526im      0.164979+0.00732907im    -0.152787-0.210921im      0.0120425+0.160203im       0.0579533+0.124292im    -0.0293202-0.0370681im    -0.509112+0.0776787im      0.0251735-0.180271im     0.00532181-0.015829im      0.160659-0.0605392im      -0.1426+0.0420558im    -0.0111428+0.0545377im     -0.108403-0.112637im      0.0622504-0.0797265im     -0.150429+0.012518im      0.015202-0.197536im      -0.058912-0.134742im     -0.108555-0.018727im     0.0167298-0.0848655im   -0.0561093+0.0621288im    -0.0283314-0.0188945im   -0.0423526+0.0329961im      0.241848-0.0276351im   -0.0557305-0.115296im        0.342983+0.0983228im   -0.0966241+0.0835441im
 0.00347508-0.112675im    -0.00324825-0.00558591im      0.155855-0.0131002im    -0.0400467+0.0101047im     0.0126675-0.270815im      -0.0692119+0.128715im      0.0254247-0.0030318im      0.0675581+0.000301598im   0.0475395-0.279935im     -0.0445279+0.0236635im      -0.108399-0.139298im     0.0150725+0.180669im    -0.0420858+0.016514im       -0.331942+0.145782im       0.027738+0.00701243im    0.131437-0.160307im      0.130645+0.0673706im     -0.159582+0.00429475im    -0.116299+0.123082im      0.0719531+0.121566im     -0.0527868-0.0372652im    -0.128557-0.224523im     -0.0424181+0.0877709im   -0.0876874-0.0346582im    -0.142173+0.227531im    -0.0146663+0.0218025im     -0.159438+0.0920351im   -0.0116928+0.13189im     -0.00777393+0.26883im       0.118069-0.220904im       -0.199802-0.0939121im     0.187904-0.0899927im
   0.113084-0.153761im       0.117043+0.141697im       0.0117872+0.162777im      -0.293912-0.214297im      -0.138157-0.0052757im       0.171295-0.105007im     -0.0275075+0.110143im       -0.137894-0.0421313im      0.121143-0.0117042im     -0.132278-0.131986im        0.130629-0.0450967im    0.0720627+0.151311im    -0.0213828-0.135085im       0.0135386+0.28683im       -0.339227-0.129064im      0.230194+0.150489im     -0.128043+0.0879681im    0.00228352+0.0171949im     0.0139565+0.0437001im      0.161603+0.00107897im    -0.025575+0.172401im     0.0993771+0.0388954im      -0.20522-0.080222im    -0.0730807-0.0862966im   -0.0195522-0.03151im      -0.132507+0.0502088im      0.148276+0.0951383im      0.05856+0.186363im     -0.0126532-0.1122im      -0.0187319-4.77097e-6im    -0.0262715+0.0219273im      -0.1063+0.0161849im
  0.0113983+0.109222im       0.391608-0.118102im       0.0488634+0.201383im       0.169061-0.0304063im    -0.0304872-0.0538273im      -0.235564-0.160516im      -0.332405+0.0700593im     -0.0563496+0.0301565im     -0.126228+0.125416im       0.171323-0.109692im      -0.0216275-0.0506425im     0.107963+0.126754im     -0.177826+0.12416im        0.0408596-0.0191025im    -0.0592751+0.119175im     -0.219483+0.0631724im    -0.109446+0.180845im    -0.00896217+0.0904039im    -0.0316306+0.138183im      0.0610634+0.114875im     -0.0695142-0.0213858im    0.0910703-0.0832168im   -0.00912322-0.100269im     0.0336881-0.120495im      0.135111+0.155499im      0.125097+0.0722361im     0.0249717-0.200467im    -0.0940506+0.163169im      0.0705648+0.124638im     0.0592861+0.0538775im      0.0101251+0.0822981im   -0.0267034-0.1025im
 -0.0003279-0.0865701im   -0.00673411-0.194677im       0.0282395-0.211354im      -0.220643+0.0128166im     0.0782209+0.0340215im      -0.081293-0.0988995im     0.0174855+0.0743954im      0.0890882-0.195925im     -0.0382336-0.00885618im    -0.241285-0.116836im      -0.0143969+0.0785431im    0.0163373+0.0651969im    0.0470566+0.111567im        0.139688+0.0498158im     0.0980535-0.0203583im    -0.201001-0.0975659im    -0.470427-0.0930825im      -0.19198+0.136329im      -0.103396-0.091067im     -0.0321987-0.000241542im    0.123089-0.247237im      0.127058+0.0093397im    -0.0495127-0.0722981im      0.12209-0.0291451im    0.0501612-0.0865371im     -0.13717+0.0943472im    -0.0304212+0.0589191im   -0.0449499+0.0447743im       0.10311+0.00756056im    0.133496-0.241802im      0.00500743-0.221149im    0.00865899-0.00277459im
 -0.0359668-0.22794im      -0.0430495+0.136531im        -0.08583+0.0444319im      0.128849+0.0298585im    -0.0548162-0.138511im       -0.103083-0.249488im      0.0545435+0.135404im      -0.0659686+0.156125im      0.0208804+0.125589im     -0.0675598-0.172125im      0.00724961+0.23208im      -0.127408+0.105017im     0.0324206-0.0136542im       0.174936-0.147812im      0.0981431-0.0851974im    0.0955678-0.0331538im     0.129248+0.101556im      -0.381417-0.130673im      -0.274109-0.0504869im     0.0490463-0.108753im      0.0961466-0.0233434im    -0.197693+0.00735966im   0.00883383-0.105388im    -0.0788704-0.00918592im   0.0811791+0.0943546im   -0.0491306-0.0537557im     -0.105475-0.0852487im    0.0657953-0.0622965im     -0.123264+0.00148307im   -0.177126-0.103925im    -0.000397258+0.027912im     -0.240766-0.174687im
  -0.150012+0.0755204im     -0.126773+0.0189651im        0.22395+0.117438im      0.0818956-0.0174179im     0.0522137-0.095095im         0.12648+0.182153im     0.00945843-0.0348955im    -0.00128871+0.158786im     -0.0716869-0.0256497im    -0.0987523-0.0108619im      -0.226766-0.0793692im     0.125496+0.148401im      0.136113+0.119054im       0.0462343+0.1124im        -0.101358-0.0478032im    0.0576378+0.19133im      -0.241211+0.0202944im     0.0601366+0.0798244im     -0.382603-0.158153im        -0.2677-0.0663508im     -0.113226+0.0155837im   -0.0933538+0.06035im        0.157939+0.160451im    -0.0810223+0.182535im      0.058394+0.0106869im     0.027167-0.00235437im     0.128487-0.125805im     0.0319396+0.0727308im      -0.10436+0.0466687im     0.150307+0.160924im        0.106621-0.0430189im    -0.172687-0.079169im
 0.00531134-0.064173im      -0.150576+0.000984704im    -0.169119+0.191471im      0.0602688-0.0942894im   -0.00092352+0.079301im       -0.190112-0.128971im      -0.229339+0.161703im        0.245163-0.254505im      -0.165863-0.147776im     -0.0102117+0.212773im        0.164329-0.0122754im   0.00048983-0.0192805im   -0.0969351-0.0701303im     -0.0393621+0.180248im      0.0461306+0.103541im       0.10641+0.0866957im     0.151421+0.0487814im     0.0331796-0.0874145im    -0.0262643-0.108324im      -0.211814+0.0139234im     -0.012608-0.10074im     0.00462706+0.0602961im    -0.0457921+0.285097im      0.283228-0.0488737im    0.0934193+0.0388197im   0.00107168-0.106617im    -0.00904295+0.113491im      0.159197+0.0611946im    -0.0575919-0.0217033im     0.103765-0.0792869im      0.0308796-0.0562244im     -0.26364-0.0285894im
 -0.0142842-0.223467im     -0.0879622-0.0730514im       0.215264-0.197026im     -0.0310426+0.140594im      0.0950734-0.0260365im      0.0121355-0.0552583im    -0.0510228+0.115345im         0.12794+0.100988im      -0.223764+0.193236im       0.149071+0.0513064im       0.029897-0.00451829im  -0.0118271+0.0254946im   -0.0239477-0.22446im        -0.062272+0.0167953im      0.181709-0.0529167im    -0.114246+0.0106404im   -0.0857423-0.17043im      -0.0795975+0.0267549im    -0.0468751+0.133868im      0.0543539+0.022011im      -0.345823+0.213147im      0.166091-0.0136694im     -0.388619+0.0716736im   0.00267885+0.112663im     -0.132866-0.0453345im     0.034555-0.139601im       0.116563-0.0428801im   -0.0124304-0.0401394im     -0.184236+0.0379911im    0.0306504-0.00953917im    0.00447416+0.157858im    -0.0958964+0.0252067im
   0.138681+0.102981im       0.032386-0.0102579im      0.0666469-0.09056im      -0.0546627+0.0403471im      0.142885-0.15454im       -0.0535894-0.0761389im    -0.0931701+0.0577396im       0.127442-0.0240389im    -0.0219555+0.0337625im     -0.144944-0.0412067im      0.0091247-0.0605356im    -0.240125+0.075341im      0.101678-0.145743im      -0.0867647-0.053722im      0.0216387+0.109334im     0.0132689-0.0642998im   -0.0749058+0.0840418im     -0.130952+0.195071im      0.0133335-0.147234im      0.0931081+0.14032im       0.0152869+0.182227im     -0.334699+0.258294im       0.106639+0.138338im    -0.0264517-0.204082im     -0.155469+0.0681427im     0.237006+0.212116im      0.0511078+0.040434im     0.0862279-0.0456395im      0.178457-0.202685im     0.0839002+0.0945174im       0.100936+0.191934im    -0.0442222+0.187225im
   0.200252+0.160032im      0.0285481+0.0120458im      0.0450886-0.0704495im     0.0876386+0.0561011im     -0.116703+0.184676im      -0.0378525-0.0142299im    -0.0132371+0.113021im       0.0480289-0.133819im      0.0925306+0.0601595im   -0.00863883+0.257747im       -0.200886+0.201756im     0.0209954+0.116387im     0.0167722+0.231442im       0.0660691-0.092857im    -0.00197957-0.239512im      0.241482+0.0375546im   -0.0780241-0.142439im      -0.109508-0.029023im      0.0863956+0.102586im      -0.132626+0.187266im       0.169264-0.173683im     -0.128535+0.068804im      -0.240088+0.126623im     -0.106899-0.0867399im   -0.0513193+0.0152691im    0.0481103-0.0191481im      0.178557-0.0797282im   0.00970991+0.179868im      -0.183653+0.00521385im  -0.0264208+0.0375856im     -0.0504768+0.216853im      0.172295-0.0374433im
  0.0853231+0.0105785im    -0.0508619+0.299415im       0.0262601+0.00999304im    0.0542231-0.0627339im    -0.0543648+0.0794073im     -0.0889025-0.0416155im     0.0424003+0.00401572im      0.102995+0.079712im     -0.0589642+0.0011174im     -0.135116+0.0830492im        0.17671-0.0774573im     0.169764-0.134829im     0.0632599-0.128653im       0.0233659+0.265241im      0.0533787-0.0510797im    -0.311465-0.0126756im    -0.060676+0.0209497im    -0.0411325-0.12859im       0.0996781-0.206648im     0.00522609+0.228901im      0.0808877-0.0729988im    -0.169527-0.175443im     -0.0397758-0.0193728im    -0.336668+0.109485im     0.0874145-0.0234811im     0.106257-0.0293483im     -0.119561-0.252465im     -0.138136+0.122644im     -0.0662486+0.00279556im  -0.0356853-0.0423585im     -0.0189412-0.0303578im   -0.0305178+0.282539im
 -0.0309721+0.0484758im       0.12031+0.0698528im      0.0238645-0.0673009im     0.0576367+0.149959im        0.10869-0.0540028im      -0.339218+0.0300471im    -0.0394225-0.175517im      -0.0570926-0.136734im      -0.247923-0.217977im     -0.0205653-0.159053im       -0.121934+0.133312im    -0.0456587+0.0949545im    0.0291196+0.00896543im     0.0562688+0.0613853im    -0.0835702-0.145755im      0.115571+0.268035im     0.0224677-0.15883im        0.107303-0.0745151im      0.143178+0.103619im      0.0192473+0.13574im       0.0664832+0.00645805im    0.112266-0.029722im     -0.0680792-0.0676078im    -0.198462+0.153325im     -0.263223+0.0436334im  -0.00839473+0.0840417im     -0.162469-0.0356081im     0.188128-0.179246im      0.0798698-0.129945im    -0.0241774+0.0105967im      0.0988516-0.165778im     -0.209934+0.000423702im
  0.0620066+0.0105004im      -0.12871+0.00838083im   -0.00614035+0.00721534im   -0.0883025+0.0498813im      0.139726-0.0758925im     0.00764529-0.0562594im     -0.194469-0.0138135im      0.0587692+0.178449im      -0.194506-0.0112977im      0.105795+0.103im           0.099136-0.0444532im     0.211272-0.151634im      0.111275+0.0588402im      0.0614258-0.19605im       0.0017473-0.0466549im   -0.0488855+0.144747im      0.037379+0.0819771im     -0.197473+0.0319046im     0.0188617+0.128587im     -0.0142663-0.0298319im      0.183176+0.0409635im     0.136774+0.0351469im       0.12968+0.0991641im     -0.32903-0.0642187im    0.0460462+0.206553im      -0.40175-0.0374849im   -0.00176685+0.322797im    -0.0549332+0.0998769im     0.0284419-0.113487im      0.152357+0.062677im       0.0656658+0.0643042im    0.0857112+0.0521246im
  -0.128461-0.0665809im    -0.0174175+0.104324im       -0.151744-0.0134706im     -0.187314+0.0316715im     -0.235941-0.0502513im     -0.0279641-0.0421587im    -0.0478374+0.133668im       -0.130511+0.0198472im     -0.170323+0.150253im      0.0562681-0.133977im       -0.122719+0.125547im    0.00308742-0.0129242im   -0.0774365-0.0838746im     -0.0664226-0.0480598im     0.0129905+0.0702606im    0.0472981-0.14921im     -0.0803474-0.0982217im       0.29185-0.0147286im     -0.077608-0.00896135im    -0.123638-0.00333484im   -0.0480243-0.127528im    -0.0354917+0.0112802im     0.0320541+0.137102im     -0.125245-0.0727052im   -0.0835157-0.191163im      0.010029+0.184407im      -0.487387+0.144974im    -0.0836551+0.195354im      -0.126354-0.027818im       0.13145+0.108228im       0.0403786+0.205331im     0.0431502-0.0283013im
 -0.0414214-0.138619im     0.00722151+0.0193786im      -0.136038-0.102661im      -0.144637-0.168907im       0.095328-0.0385748im      0.0835154-0.0139718im      0.260976-0.0461459im      -0.138217+0.0460753im    -0.0731758+0.129929im    -0.00542047+0.203836im      -0.0263253-0.0672383im     0.108084-0.129421im     -0.112374+0.195099im       0.0110571+0.00389789im   -0.0628752+0.114752im      0.011863+0.232274im      0.177913-0.106286im      -0.194248+0.13379im        0.135165-0.00938698im   -0.0344684+0.102396im      0.0665504-0.0305446im    0.0138049+0.0485932im     0.0481712-0.081448im     0.0681135-0.00784909im   -0.235004+0.0715511im     0.276357+0.0956233im    0.00114218-0.0147255im    -0.301415+0.0687585im    -0.0259098+0.037614im      0.213332-0.106741im       0.0521394+0.0324946im    -0.295884-0.171109im
  0.0886297+0.103622im      -0.111111-0.0399229im      0.0601787-0.00901752im   -0.0424697-0.0962647im     0.0781058-0.0840003im      -0.031532-6.01767e-5im    -0.175643-0.186811im      -0.0038149+0.0830893im     0.0893896-0.024532im      -0.188596-0.101459im      -0.0218588-0.0451945im    0.0695269-0.28934im      -0.258002+0.0193408im       0.132926-0.00165887im    -0.113697-0.184269im    -0.0753398-0.137571im    0.00840487-0.136927im     -0.0203933+0.164688im       0.095093+0.110999im    0.000305735+0.0731704im     -0.220334+0.0477845im    -0.107786+0.0143962im     0.0902307+0.0118843im    0.0725122-0.173793im      0.058604+0.0797034im    0.0360075+0.0116851im     -0.104824-0.0292914im     0.169933+0.00558253im     -0.48221-0.168699im    -0.0708655-0.0961828im       0.114854-0.144424im     0.0398639-0.148011im
 -0.0790135+0.0729541im     0.0175884+0.0569022im       0.258626+0.00541777im     0.171854+0.17872im       -0.064693+0.0237062im      0.0568354-0.119762im      0.0247087+0.0999212im      0.0192275-0.018195im      0.0550033-0.0494509im     0.0142434+0.0497123im      0.0164174-0.151419im     0.0650643-0.0454483im   -0.0339007-0.0017666im      -0.253261-0.0312088im    -0.0340355+0.187452im       0.13036+0.168356im     -0.273697-0.0596453im     -0.156448-0.201423im        0.19118+0.111924im       0.100765-0.15381im      -0.0864473-0.0648594im     0.057304+0.298im          0.186345+0.128806im    -0.0127438-0.0280399im     0.011753-0.0711353im  -0.00299484+0.00332593im    -0.188469-0.0635754im    -0.186385+0.0865476im    -0.0281498-0.181295im     -0.277011-0.180923im      -0.0714087-0.094702im    -0.0703845-0.0757771im
    0.12661+0.0671961im     -0.179922-0.253237im       -0.107816+0.185665im      -0.146679-0.0705713im     0.0543534+0.0159428im     -0.0950882-0.267756im       0.168164+0.00120307im     0.0616017-0.0872527im      0.024257+0.0769472im     0.0879002+0.0295126im    -0.00747581+0.184245im    -0.0297096+0.0987242im     -0.20025+0.0196338im     -0.0613961-0.00507947im    -0.157601-0.0027797im   -0.0523499+0.0602731im   -0.0757294-0.123105im     -0.0360016+0.0101797im     0.0494653+0.0493654im      -0.11229-0.170802im      -0.191701+0.100528im    -0.0972283-0.0163543im      0.243194-0.0676639im    -0.164913+0.25353im     -0.0219003+0.117868im   -1.88111e-5-0.0166784im    -0.0365352-0.114986im     0.0901893-0.0368242im      0.020344-0.046357im      0.120716-0.00408864im     -0.419486+0.055233im     0.0586867+0.180147im
    0.22375+0.025446im      0.0269991-0.0459062im     -0.0037558-0.116269im       0.126446+0.2821im         0.103946-0.196284im        0.125756+0.203288im       0.125415-0.116383im    -0.000331359-0.193731im       0.104534+0.0601727im      0.202742-0.0815192im      0.0427505-0.146226im    -0.0178025+0.130747im    -0.0599689-0.0405205im      0.0757598+0.0322812im     -0.186324+0.100142im     -0.204762-0.0810209im    0.0286129+0.0371602im  -0.000630027-0.115067im      0.0375024+0.14155im      -0.0386428-0.128033im        0.14622-0.16324im       -0.15814+0.0198436im    -0.0816754-0.095131im     0.0187054-0.056602im       0.06271-0.0929491im   -0.0940483-0.0488688im    -0.0314761+0.0867061im     0.114059+0.204816im      -0.188043-0.0209821im     0.152861+0.0584354im     -0.0704576+0.0580063im    -0.366279+0.126799im

and then generate the state $ψ$

psi = P[:, 3]
32-element Vector{ComplexF64}:
  -0.10721816639006093 + 0.0514186915424686im
   0.02419268179197217 + 0.020486750919100703im
 -0.032019880179134624 - 0.03301318266805241im
    0.3925168658362853 + 0.0im
    0.1578394524291722 - 0.002180318063799258im
   0.03574304261649211 + 0.07774172580575123im
 0.0018178927239469317 - 0.11327658871930531im
    0.1658840908766079 + 0.06046966564296116im
  -0.05448072310395736 + 0.1815979668125477im
    0.0793333123909469 + 0.15926797428665884im
  -0.08917738915385981 - 0.17610300725563427im
   0.10777473273517857 + 0.02785589691410832im
     0.076472157892276 + 0.035997960456810196im
  -0.13070134690945312 + 0.12075171756718739im
 -0.010376879346565365 - 0.15765524403991954im
  -0.11304388563075919 + 0.1572288824200687im
   0.15804242656764808 - 0.06674718791181707im
  0.005570462284371677 + 0.2260913124803392im
 -0.043505393286047085 - 0.11745570634846227im
   0.30469590109847516 + 0.14587317755987383im
   0.05992064092697398 + 0.11476540326584589im
  0.038641735205743766 - 0.14131531748427023im
  -0.28151936003589345 - 0.028587763861988663im
  0.008583759464578594 - 0.10438322770275778im
   0.10838034558097831 + 0.008597226674466184im
  -0.04315573745603832 - 0.008941724945669244im
 -0.058473832414834684 + 0.00513014310848986im
   0.11238555779267147 - 0.13083164888252824im
  0.028541261201680435 - 0.19226860425444633im
     0.097686915884037 + 0.09249569948646857im
   0.06803835053998572 - 0.17468777801544091im
  -0.11101008348656423 + 0.2055070967369334im

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.