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.328001-0.0888676im  -0.0349269+0.136368im      0.0991045-0.163618im   -0.00669345-0.0951453im     0.0125462+0.0162356im    0.0153946-0.117795im    -0.0241907+0.0798139im      0.150289-0.0228178im     0.0186069+0.13915im       0.139436+0.182571im    -0.00620656+0.0927217im     -0.148061-0.10982im      0.0268158-0.192265im       -0.172516-0.173976im      -0.189366-0.166343im      0.0539684-0.0766665im   -0.0670082+0.20002im     -0.0205912-0.140921im     0.0608417+0.016326im      -0.0630286-0.131851im       0.151332+0.00574927im      0.09818-0.00939326im     -0.024026-0.0667353im   -0.0361247-0.276019im        0.150966-0.10699im      -0.190652-0.0767897im     0.0649115+0.0430982im       0.203844+0.0130295im     0.0882291+0.281498im      -0.213207-0.00597672im    0.092229+0.0609077im      0.098747+0.0722968im
  -0.186312-0.187687im    -0.336094-0.102151im      0.0355753-0.0279857im    0.0850026+0.0296596im      0.220469-0.0943988im    0.0023339+0.0871522im     0.128608+0.0740362im    -0.0467962-0.0067027im     0.0208411+0.0051128im     0.031258-0.0385657im     0.0858995+0.0168277im      0.246946-0.035252im     -0.117503+0.0626446im        -0.1521-0.0328031im      0.217196+0.0783232im     0.0381101-0.171335im     0.0992638-0.0577749im    0.0716838-0.0633057im    -0.124284+0.00404328im    -0.0177083-0.343696im      0.0763781-0.0819081im      0.108562-0.051502im       -0.257363+0.133359im    -0.0525065-0.029106im      -0.0233782-0.102672im      0.152817-0.0908828im    -0.0100064-0.289655im       0.0615987-0.0708958im     0.0928661-0.00486986im     0.143804-0.0341811im    -0.233533+0.0173842im    0.00229821-0.128685im
   0.211811+0.0944537im     0.25375+0.046171im       -0.21373-0.0410109im      0.09045+0.00572123im    0.0687371-0.100363im    -0.0317298+0.0177287im   -0.0212051-0.00652417im    -0.134164+0.0601868im      0.115544-0.155707im      0.119134+0.168545im      0.0837169+0.160093im     -0.0300474-0.0587402im    0.0032159-0.0418962im      0.0353917-0.238172im      0.0230838+0.0480112im     -0.024693+0.00636616im   -0.115663+0.0817232im    0.0866634-0.084354im     0.0896129-0.196844im       -0.223626-0.125053im      -0.182034-0.177435im     0.00707793-0.0746546im      -0.143884+0.0559249im     0.193792+0.030555im        0.304361+0.144936im     0.0808286+0.0166261im    -0.0900198-0.195612im      -0.0380998+0.212046im      0.0815548+0.119815im     0.00164167+0.0285363im     0.117348-0.00445909im    -0.137778-0.240756im
   0.076245+0.13093im    -0.0861417-0.142762im      0.0774668+0.10561im      0.0675351-0.198086im      -0.120316+0.112151im    -0.0383592-0.0829451im     0.161621+0.085819im      -0.181622-0.125992im       -0.18804-0.0667558im      0.15206-0.143793im     -0.0689076+0.209618im     -0.0197092+0.169434im    -0.0320351+0.0559239im       0.105463-0.177202im       0.072462-0.176439im     0.00143611-0.174139im    -0.0385064-0.167976im      0.103198-0.217223im    -0.0937476-0.00301489im    -0.0426065+0.0755784im      0.099711+0.156175im        0.10063+0.0673844im     0.00059372-0.0506597im   -0.0878949+0.023288im    -0.000653063-0.0232033im    -0.168968-0.0231046im    -0.0492447-0.130341im       -0.348323+0.126028im       0.241467-0.0477673im      -0.15173-0.139438im      0.095785+0.0653601im      0.170368+0.0169341im
  0.0405134-0.0301306im    0.200666-0.055659im      -0.134827+0.022474im     -0.148194+0.0104403im     -0.353603-0.17375im      -0.224619-0.159422im    0.00109467+0.0871877im    -0.0076411-0.0838215im   -0.00570773+0.173509im     -0.147964+0.073404im       0.249827+0.116644im        0.13536-0.077717im    -0.0750071+0.0609138im      -0.065805+0.0835604im     0.0751996-0.0944977im      0.013071+0.00657556im   -0.213995-0.204933im    -0.0604674-0.0833085im     0.189258+0.0576595im     -0.0203857-0.020971im       0.011903-0.0758334im      0.121233-0.00848184im     -0.179389-0.132127im      0.100495-0.107107im      -0.0916489-0.0631335im     0.161952-0.194371im      0.0832492+0.22085im       -0.0821194-0.0252325im      0.196559+0.0317801im     0.0849203+0.0605755im    -0.205211-0.0327815im     0.0301226+0.0997249im
 -0.0541899+0.135098im    -0.190092-0.0210681im       0.16942-0.0631501im    0.0252576+0.0744882im     -0.182525-0.13123im      -0.361804+0.209396im     -0.110387+0.121548im       0.281663-0.125488im     -0.0445919-0.124108im     -0.157454-0.0259177im    -0.0473216+0.0708434im     0.0797015-0.046756im      0.123862+0.0383058im    0.000384906-0.06876im       -0.119846-0.101733im     0.00631048+0.144076im    -0.0701142+0.190309im      0.218668-0.011212im    -0.0555085+0.0618917im      0.0869844+0.186752im       0.108049-0.0388216im      0.013551+0.0490983im     -0.0367321-0.0600297im    0.0727099-0.00097172im      0.061056+0.119845im    -0.0279087+0.0743962im      -0.15558-0.265399im     -0.00500418-0.126585im       0.168649-0.0673404im     0.0796558+0.176769im     0.0307159-0.0290113im      -0.24067+0.022638im
 -0.0882373+0.0137145im    0.107995-0.00621571im   -0.0762314+0.0953827im   -0.0165452-0.00659487im     0.114382+0.00520243im   -0.183928+0.141103im    -0.0806481-0.0411338im     -0.156101+0.149953im      0.0675402+0.0159305im    0.0553009+0.191773im       0.148965-0.0709584im     -0.191383-0.0454961im    -0.271884+0.165445im      -0.0758748-0.0792408im    -0.0703827-0.0589341im    -0.0335854-0.296643im     -0.171733+0.108391im     0.0994164-0.0466933im   -0.0946169+0.179425im        0.184703+0.0960609im     0.0290434+0.0121616im     0.0747554+0.13817im         0.316535-0.0476351im    0.0637788+0.128657im       0.0883255-0.00116989im   0.0654953-0.0723343im     -0.212141-0.0408512im     -0.0563655-0.247829im       -0.10215+0.037859im      0.0509973-0.00376536im   -0.130714-0.127391im       0.224339-0.0920715im
  -0.206497-0.0908296im   0.0854216+0.0578542im     0.0183963+0.0947283im    -0.255508-0.0570836im     0.0246593-0.0668774im   -0.0299443+0.185471im     -0.139427+0.00994811im    -0.380825-0.0119207im     -0.119373-0.0597487im     0.104719+0.148502im      -0.129129-0.0126009im      0.129831-0.0387839im    0.0824713+0.248337im        0.030963-0.0313458im    -0.0183551+0.0223844im      0.239868-0.0105844im     0.213758-0.00303789im   -0.133304+0.0223644im     0.206372+0.0682418im      -0.175452+0.138374im      0.0354785+0.157805im      0.0914055+0.0500414im      -0.100812+0.00353567im   0.0659075-0.0768674im      -0.243776+0.138762im       -0.1596+0.101518im     -0.0633002-0.0982427im      0.0646212+0.108831im    0.000100917+0.174932im       0.114232+0.0873278im    0.0140066-0.147891im     -0.0570488+0.0354759im
  -0.115048-0.0428328im    0.175972-0.0832293im       0.09969-0.234443im     0.0225762-0.078362im     -0.0311312-0.0768674im    -0.284138-0.0373747im    0.0780477+0.0978419im     0.0472803+0.166097im      -0.342376-0.0166606im      0.10118-0.205976im       0.139814+0.0396673im    -0.0872424-0.183926im      -0.11855-0.0235981im       0.262469+0.0116978im    -0.0186984+0.107469im      -0.111758+0.159237im     0.0508676+0.146443im     0.0715042-0.00612348im   0.0732018-0.105636im       0.0797003-0.172682im     -0.0966497+0.13448im      -0.0849893-0.0302778im      -0.140312+0.147601im     0.0351295+0.00642188im     -0.194507-0.0386267im    0.0277507+0.1279im        -0.198667+0.0343916im     -0.0237779+0.0104325im     -0.189909+0.080188im      0.0404205-0.0299326im    0.0325577+0.10042im        0.246025-0.0146826im
 -0.0437276+0.0324432im  -0.0547134-0.256282im      0.0237486+0.0753384im   -0.0989513-0.205046im     -0.0757134-0.0203066im   -0.0328622+0.141523im    -0.0398059-0.0742584im     -0.138724-0.0207056im       0.15911+0.0626932im      -0.3026-0.0838678im    -0.0724647+0.202354im     -0.0281739-0.165027im     0.0730015-0.105172im        0.072762+0.238522im     -0.0139753+0.107308im     -0.0313757-0.244426im     0.0963814+0.171704im     -0.133055-0.0154934im    -0.118018-0.118794im        -0.12507-0.105678im     -0.0862386-0.0210638im     -0.237701+0.0656581im     -0.0776629-0.253926im      0.159971+0.162891im         0.10455+0.0195544im   -0.0715072+0.0841694im     -0.105048-0.000591433im    0.0909731-0.0395434im     0.0565058+0.0956793im     -0.217514-0.108702im     -0.157607+0.0715316im     0.0414809+0.112869im
  0.0831012-0.0143211im   0.0191853+0.136325im      0.0862783-0.0570832im   -0.0912099-0.173963im    -0.00769665-0.040611im    -0.0938032-0.0165733im   -0.0721363-0.173142im     -0.0218935+0.00432333im    0.0827356-0.160138im     0.0506776-0.0718032im     -0.374358-0.0662908im     -0.199148-0.0118681im    0.0255452-0.0772243im      0.0275769-0.0875559im     0.0534668+0.166659im       0.149452-0.0970498im    -0.193773-0.0227054im   -0.0569043-0.110145im     -0.114244-0.000677091im     0.152296-0.01219im        0.081896+0.0870143im     -0.106135-0.195068im       -0.300954+0.163419im     0.0750631-0.193046im      -0.0776567+0.0916607im    0.0365714-0.166019im     -0.0527348+0.185066im      -0.0705063-0.187649im      0.0318566-0.15045im       -0.153371+0.0772176im    -0.152622-0.190851im     -0.0342728-0.167421im
 -0.0310036+0.0562069im    0.140242-0.00396716im    0.0930166+0.0723814im   2.90229e-5+0.0839164im     0.0670512+0.0325315im   -0.0540355-0.115768im     0.0649397-0.21185im      -0.0329078+0.0118077im     -0.122907+0.0392023im    -0.131009+0.0582755im     -0.174501-0.175942im      -0.300154-0.0189315im    -0.251794-0.0425633im      -0.210673-0.112362im    -0.00694207-0.249278im      0.0343842-0.0890507im     0.158177+0.0069607im     0.251092+0.0384858im   -0.0254152-0.06834im        0.0179971-0.0708237im   -0.00174087-0.0227762im      0.109039+0.0213319im      -0.256098-0.0652891im     0.047398+0.235994im      -0.0666373+0.00686053im  -0.0602275+0.179336im      0.0137993+0.13489im        0.0421211+0.173792im      0.0744769-0.0768577im      0.141853+0.0525457im    -0.158598+0.214343im      -0.216326+0.129262im
  0.0103164+0.022208im   -0.0324723+0.10816im       0.0274609+0.208791im    -0.0315499+0.173119im      -0.214585-0.00384046im   -0.163059+0.172414im     -0.115691+0.154494im      0.0666356+0.0152133im     -0.180004+0.049687im      0.241289-0.0183707im     -0.099479-0.137229im      0.0712045+0.103454im     -0.214807-0.272104im        0.151067-0.222118im     -0.0560799+0.0446767im     0.0438592-0.0459956im    0.0162169-0.171848im      -0.28107+0.0885512im   -0.0764132+0.227098im      -0.0750404-0.103667im      0.0234715-0.242486im      -0.108724-0.0938746im     -0.0226124-0.0652783im     0.150113+0.216125im     -0.00259148-0.0645451im   -0.0226797-0.0190399im     0.0107124-0.0276665im       0.151006+0.00434476im   -0.0187725+0.00692931im   -0.0903995-0.204718im    0.00669904+0.0490734im     -0.033838-0.0180346im
  0.0894692+0.040107im    -0.130352+0.113979im     -0.0445715+0.0470129im  -0.00991069+0.130375im     -0.0432489-0.167289im     -0.178214+0.0312673im      0.24707+0.0473336im     -0.303163+0.0219806im     0.0794104-0.235894im     0.0931508-0.16856im       0.0998574-0.00504539im    0.0154229+0.0521374im     0.119445+0.100401im       -0.107208-0.0485947im     -0.197941+0.150167im       0.125144+0.135567im    -0.0512284-0.0457827im     0.258535+0.0801752im    -0.123699-0.110869im       -0.123294-0.055977im       0.215558-0.134919im      0.0214789+0.213212im       0.0394909+0.0251919im    0.0476373-0.0443436im      0.0418117-0.0496673im   -0.0899123-0.00555316im    0.0973401+0.251961im       0.0876551-0.0494651im     -0.218251+0.0765094im     -0.185212-0.0184274im    -0.132386+0.12228im     0.000286158+0.133828im
   0.172352+0.0389338im   0.0461248-0.0500261im     -0.116291+0.112608im     0.0554493-0.357086im      0.0976352-0.0199636im   -0.0975816+0.0797152im    0.0890056+0.187056im       0.192284+0.0926306im     0.0679333-0.219497im     -0.146105+0.0504745im     -0.272068+0.00821879im     0.121609-0.148862im    -0.0658135-0.103742im       -0.125546-0.164331im      -0.205092-0.0187799im     -0.135535+0.018327im      0.123527-0.147362im     -0.194189+0.0927361im   -0.0209847-0.0665926im     -0.0167723+0.0373739im      -0.04798-0.0718233im      0.210976+0.108234im       0.0996692+0.0150187im    -0.130865-0.134595im       -0.118754+0.151215im     0.0378891-0.0905391im     -0.045485+0.0155755im       0.097131+0.0823539im    -0.0304723+0.00542205im      0.13374+0.0840373im    -0.129686+0.178605im       0.217692+0.0176491im
   0.201982+0.143361im    -0.044523+0.0954818im      0.115967-0.129332im      0.054508+0.0459429im     0.0571189+0.170563im    -0.0879925-0.129419im     -0.115074+0.252121im    -0.00481543-0.0821459im     -0.218681-0.199193im     -0.218476+0.136327im       0.132576-0.124269im      0.0318982-0.0483762im   -0.0810518+0.281413im       0.0104055+0.0779547im      0.076197-0.048721im      0.0723109-0.154884im      0.119259-0.105162im     0.0435606-0.0184278im     -0.11685-0.0574174im     0.00532873-0.071604im     -0.0812154-0.0358093im     -0.139499-0.340101im        0.190433-0.0545953im    0.0426291-0.185263im       0.0192559+0.0332314im    -0.163598+0.107099im      0.0525721+0.0965922im       0.188695+0.052243im      0.0839393+0.10772im       -0.113305-0.0221265im    -0.146883-0.0557748im     0.0230284-0.130317im
  -0.191928-0.211491im    -0.012629+0.012135im     -0.0310536-0.076297im      -0.10759+0.191447im      -0.144744+0.182777im     -0.133108+0.106881im     0.0766104-0.0747512im      0.128088-0.0415524im      0.159585-0.216651im     0.0929791+0.0798175im     -0.144148+0.130358im       0.168287-0.0616415im   -0.0272915-0.0136828im     -0.0555616-0.0708918im      0.027188-0.158677im      -0.107687-0.199456im      0.103311-0.0937903im     0.104684-0.115778im    -0.0248258-0.2557im         -0.122401+0.119731im     -0.0217909-0.0281584im    -0.0936795-0.165215im       0.0799588-0.184577im    -0.0828429-0.0028765im      -0.151505-0.132996im      0.287783+0.130217im     -0.0512146+0.16837im        -0.155019+0.0397403im     -0.238212+0.0348525im    -0.0613448-0.00284968im    0.109468-0.0598871im    -0.0402674-0.0814089im
  0.0873615-0.0836823im   0.0362768-0.0355675im      0.269306-0.0343433im     0.224372+0.246956im       0.221076-0.0993525im    -0.101943-0.0449718im    0.0156223+0.155854im      -0.150799+0.0376541im      0.217089+0.0245853im    -0.112044+0.00683165im    0.0788368+0.140279im     0.00321008-0.024936im    -0.0360635-0.126245im      -0.0881397-0.0558841im    -0.0267894-0.0209133im      0.233603+0.0924184im   -0.0432033+0.028812im     -0.365672-0.109111im      -0.14629+0.00961369im    -0.0150946+0.0796439im    -0.0420496+0.147803im      0.0290297-0.0462416im        0.02932-0.0293511im    -0.023383+0.0468905im      -0.127691+0.0187682im   -0.0604009+0.0810711im    -0.0886776+0.202042im       -0.212661-0.162436im      0.0815247+0.120428im       0.151562-0.062869im      0.128409+0.227914im       -0.12053-0.113977im
   0.201389+0.0243033im    0.106753-0.000114396im   0.0621344-0.0417816im    0.0839784+0.0499479im     -0.162556-0.125131im      0.183661-0.0388926im    -0.104154-0.13296im      0.00393036-0.0725949im    -0.0925402+0.139725im      0.142255+0.0839786im     0.0672813-0.024245im       0.188585+0.0515918im     -0.20415+0.0446298im      0.0952619+0.135336im     -0.0762827+0.0128813im       0.13114-0.196796im     0.0567773+0.134356im     0.0074796+0.062594im     -0.131536-0.21486im        0.0733043+0.0158897im      0.221241+0.000999985im  0.00536555+0.137568im      -0.0237036-0.142321im     -0.134612-0.137032im       -0.174086+0.136514im     0.0876971-0.224792im      -0.234121-0.0785631im       0.136271+0.0294341im    -0.0843951-0.0394444im     -0.153838+0.15774im      0.0875817+0.294208im     -0.0987931-0.143934im
 -0.0505626-0.0408769im    0.148257+0.320903im       0.291111+0.192029im     -0.141528+0.0437442im      0.162984-0.0387418im    -0.100566-0.00818979im    0.163233+0.00244246im     0.238211-0.0513702im     0.0620482+0.0755507im   -0.0608104+0.0502225im     0.0242835-0.0802134im     0.0204675+0.204688im   0.000152998+0.158488im        0.105648+0.0275309im     0.0973406+0.166356im     -0.0693804-0.0908824im   -0.0800834+0.0912405im   -0.0518163+0.0102409im    -0.198209-0.190431im      -0.0920063-0.00215891im    0.0104485-0.155276im      -0.135588+0.191613im      -0.0687783-0.00080082im  -0.0585338-0.0995269im      0.0530389+0.0740079im    0.0104801-0.0445237im     -0.128932+0.0468649im     -0.0850679+0.215844im       0.141036+0.0683161im      0.188386-0.131496im     0.0622647-0.150242im       0.145877+0.208721im
  -0.283073-0.0081995im   0.0486022-0.106527im       0.151652+0.166968im    -0.0847791+0.0495736im      0.105731-0.105896im    -0.0244159-0.129541im     0.0708161-0.0404783im    -0.0549324-0.0400745im      -0.15523-0.0251717im   -0.0974331-0.0476072im     0.0567043+0.00902827im   -0.0683732-0.0500339im    0.0765078+0.10338im          0.15345-0.122705im      -0.244091-0.0266605im      0.160475-0.045266im        0.1919-0.0590197im    -0.127697-0.0316797im    0.0400962-0.0634152im       0.116579-0.173312im      -0.308039-0.233822im      0.0957282+0.0580698im       0.171681+0.00899173im   0.0109816-0.145199im        0.105963+0.0848987im     0.206876-0.0932553im      0.102762-0.00872024im     -0.129938-0.083159im      0.0175031-0.299435im      -0.226556+0.110453im      0.102479-0.0027381im     -0.127122-0.00781058im
 -0.0177258+0.0810743im   -0.083234-0.0438605im     0.0320069-0.0631687im     0.100606+0.0142344im     -0.101125-0.0470418im    0.0699715-0.0351082im     0.151426-0.240577im      -0.186756+0.275369im     -0.0437638+0.00432533im   -0.059997+0.129757im      -0.157328+0.140817im      0.0712129+0.0349315im    -0.231799+0.191331im       0.0933436-0.21911im       0.0828767-0.0893058im    -0.0462664+0.368775im      0.105704+0.151013im     -0.118141-0.0165748im   0.00705947-0.0624733im    -0.00688206+0.0389693im      0.119738-0.162225im      -0.205224-0.216867im       0.0160381-0.222379im     -0.123636-0.0733853im       0.122866-0.0183993im    -0.022158-0.130778im       0.025721-0.0230935im      0.0462683-0.169956im      0.0508926-0.042301im       0.123044-0.00640255im  -0.0351873-0.0791969im      0.114369+0.162006im
  -0.191941+0.0664235im   -0.138083+0.0672907im     -0.150171+0.094043im      0.130699+0.0316116im     0.0201112+0.0158835im    -0.051276-0.0899767im   -0.0035372+0.336004im      0.0253628+0.0673583im     -0.101944+0.0117215im    0.0156627-0.0162037im     -0.129211+0.0066245im     -0.013686+0.112955im    -0.0597504+0.0649536im      -0.062984+0.188448im       0.217599-0.026568im       0.206481+0.0484367im   -0.0711638+0.221094im    -0.0404097-0.0801301im    0.0272442+0.0725221im       -0.17852+0.15049im       -0.109951+0.0584519im     0.0897922+0.0192566im      -0.201362-0.136901im     -0.137273+0.132839im          0.2415+0.225612im      0.160398-0.00281565im   -0.0540063+0.200834im       0.0922131+0.0990375im     -0.176067-0.207869im      -0.109924+0.114343im     0.0052107+0.027555im       0.171487-0.0827907im
   0.104718-0.0431867im    0.151951-0.0399349im      0.244492-0.0251086im    0.0624223-0.0462772im      0.150306+0.23277im     0.00721286+0.112806im    -0.0295474-0.0695884im      0.179856+0.153923im      0.0290481-0.0903805im    0.0203264-0.0310015im      0.128973+0.121537im    -0.00731954-0.0609764im   -0.0957948-0.0306633im       0.246872+0.101535im      -0.205488+0.0510574im      0.130548+0.0196356im    0.0394311-0.0771075im     0.141494-0.106828im      0.181593+0.174986im       -0.452637-0.0888227im      0.203235+0.108782im       0.089038+0.0135447im      0.0303521-0.0556071im    -0.177575+0.0967905im      0.0595806+0.0276444im    0.0674212-0.12858im       0.0191599+0.0743388im       0.047928-0.0550167im     0.0576455-0.137336im    0.000449617-0.0339657im    -0.184633-0.140008im      -0.142313+0.0134717im
   0.134211+0.148515im   -0.0537098-0.0172666im     0.0178496-0.0875231im   -0.0906381-0.126475im       0.240395+0.0605848im   -0.0395048+0.11368im      -0.133733+0.101872im      -0.069355+0.0316417im     -0.187641+0.078627im      0.130996+0.0217924im    -0.0601228+0.111514im     -0.0457288-0.0606096im     0.183001-0.0695115im    -0.00629393+0.0307734im       0.20622-0.176824im      0.0553549-0.024287im      -0.11602+0.215041im     0.0403543+0.236141im     -0.128466-0.197236im         -0.1607-0.101464im      0.0318162-0.198513im       0.196973-0.0335569im       0.115791-0.094726im       0.17049+0.0785445im      -0.277164-0.175846im     0.0984811-0.166176im      0.0991968+0.135302im      0.00133482-0.121466im      0.0677317-0.135884im      0.0910525+0.019444im        0.1789-0.101897im     0.00548364+0.0909294im
   0.140461+0.0301877im    0.114044-0.135353im       0.139535+0.0262989im    -0.104135+0.154326im       0.130115-0.0557865im    -0.144223+0.0493429im    0.0289762+0.118809im    -0.00278597+0.0821982im   -0.00514853+0.0263277im   0.00172943+0.106487im     -0.0780909-0.143369im    -0.00838349-0.2728im      -0.0425967-0.113976im       -0.296118+0.184443im       0.221842+0.014503im     -0.0447609+0.112517im       0.26842-0.141487im     0.0421052-0.168081im      0.147917+0.00198406im     0.0507987+0.0120901im      0.233573-0.0665772im     -0.184757+0.104774im    -0.000160374+0.0586167im     0.044335+0.0557835im       0.089447+0.0247655im   -0.0978231-0.254838im      0.0154049-0.100114im       -0.141106+0.0537354im    -0.0453518-0.0565032im      -0.23264+0.0633687im      0.23799-0.0931581im     0.0974948+0.0264687im
 -0.0595555-0.0551857im    0.212327+0.00762448im    -0.208561+0.15749im       0.111337+0.134232im       0.156622-0.11619im      0.0194514+0.214323im     -0.232232+0.0508039im    -0.0591417-0.0293162im    -0.0281726+0.00473271im   -0.342018-0.167739im     -0.0547987+0.0135886im     -0.110068-0.0388305im    0.0321764+0.0896771im       0.108462-0.00456855im   -0.0814976-0.0975654im     0.0075466-0.0145451im   -0.0614166-0.119624im     0.0683801+0.203938im    -0.0442798+0.042im         -0.0111762+0.00458049im      0.20927-0.0160488im     0.0441922-0.167768im       -0.220988-0.0658802im    -0.200696-0.224209im        0.116563-0.337501im    -0.0291967-0.000253392im   -0.107629-0.050988im      -0.0450769+0.0545125im    -0.0695845-0.055836im     -0.0486088-0.106871im       0.19225+0.031217im      0.0999243-0.0318911im
  0.0670401-0.0297479im   0.0483731-0.0908299im     -0.296304+0.0360128im     0.067386+0.308369im      0.0629955+0.123976im    -0.0395053-0.175335im      0.248708-0.0897025im      0.213539+0.0234131im     -0.176548+0.0345348im   -0.0587426+0.231513im       -0.12806+0.104479im      0.0698065-0.012604im     0.0956463+0.103361im       0.0056603+0.0392071im    -0.0864913+0.131911im     -0.0291356-0.0176904im    0.0230975+0.138054im     -0.158773+0.11596im      -0.131278+0.0618564im     -0.0695276-0.0373221im     0.0859887+0.0744392im       0.25997-0.10253im       -0.0491128+0.143296im      0.127439+0.0706765im     -0.0908193+0.0142643im    -0.111151+0.0066554im     -0.190446-0.0761603im       -0.15068-0.0853814im   0.000431903+0.0707632im     -0.283225-0.0160839im     -0.10897-0.128973im     -0.0456161+0.169341im
   0.050568-0.0451441im   0.0630546+0.161297im      0.0233389+0.239307im      0.176409+0.0540254im     -0.165659-0.209445im      0.181898+0.0494004im   -0.0949584+0.0147564im      0.116938-0.111845im     -0.0509208-0.0428215im   0.00153176-0.00511778im    0.0888476+0.0342503im   -0.00699378-0.240458im    -0.0109808+0.11899im       -0.0708763-0.159523im      0.0276332-0.00797066im    -0.146028-0.0535593im   -0.0054222+0.0628755im      -0.1394-0.15514im     -0.0489483-0.221045im      -0.0986583-0.211712im       0.182324+0.247799im      0.0336659+0.0655585im     0.00871242-0.025326im     0.0999425+0.108593im      -0.0264225+0.0791263im    -0.104007+0.25408im         0.26396+0.005851im       0.0285059-0.165581im     -0.0721482-0.267351im      0.0426606+0.0729671im    0.0331451-0.162607im       0.149513-0.0167597im
  -0.178738+0.0651968im    0.218124+0.0734616im      0.007661+0.0330121im   -0.0327783-0.286732im      0.0763627+0.0470828im   -0.0153249+0.258013im    -0.0389926+0.0904161im     0.0417043+0.124597im       0.131594+0.120592im     0.0777537+0.133692im       0.170175-0.0160671im      0.160534+0.127137im      -0.10305-0.0248061im      0.0337289+0.0501126im      0.182736-0.0683618im   -0.00197879+0.254298im    -0.0481505-0.198403im     0.0279763-0.0308251im    -0.230561-0.187221im        0.160393-0.0431817im    -0.0353994+0.0431663im      0.167515-0.140283im      -0.0438428-0.00934907im  -0.0539127+0.0241233im      0.0400392+0.0792485im     -0.14677+0.145352im       0.015559-0.0240717im      -0.085978-0.099617im      -0.116449-0.0217467im     -0.295183+0.0432373im    -0.102867+0.0425079im     -0.226019+0.171041im
   0.171562-0.163902im    -0.193566+0.126307im       0.112466-0.0496965im   -0.0241343-4.63509e-6im   -0.0322619-0.12831im     0.00946426+0.076953im     -0.243445+0.0136188im     -0.126752-0.0343429im     -0.124463+0.145035im     0.0085109-0.0107927im     -0.126043-0.166392im       0.106002-0.0735237im    -0.134105+0.00636526im  -0.000579507+0.0675817im     -0.237168-0.100091im     -0.0987383+0.0763651im    0.0182995+0.0938308im   0.00100606+0.116186im     0.0286685-0.225663im      -0.0580903+0.0589599im     -0.107445+0.0496009im     0.0969952-0.0329842im    -0.00522738+0.213977im     -0.211539+0.195479im        0.214086-0.0365205im     0.191451+0.00859292im    0.0785788+0.0713912im      -0.281199-0.00499036im     0.177466+0.247192im      -0.179942+0.0243526im    -0.147058-0.0996675im     0.0766884+0.0348498im
   0.257686-0.065323im    -0.044723+0.133409im      0.0676914+0.0313008im   -0.0244008+0.0571654im    -0.0592059-0.0549237im   -0.0881042+0.0668826im   0.00148083+0.0466547im     0.0374187-0.0264117im      0.214411-0.0346745im    0.0647453-0.11263im       0.0791943+0.150933im      -0.401095-0.0437763im    0.0826841+0.224461im       0.0279337-0.117211im       0.228964-0.0375306im    0.00269212-0.0126468im     0.106112+0.0675072im    -0.133641-0.0296816im     0.111859+0.0964392im       0.140334-0.0295278im    -0.0686367+0.00976917im     0.133284-0.0901063im   -0.000710424-0.032582im     -0.255925+0.101865im       -0.175018+0.0161977im     0.237871-0.0333379im     0.0191333-0.202131im        0.194471+0.0874595im    -0.0356009+0.123542im      -0.229854-0.0229568im   -0.0297316+0.0374415im    -0.0466664+0.247472im

and then generate the state $ψ$

psi = P[:, 3]
32-element Vector{ComplexF64}:
  0.025804170485000652 + 0.06614819142016087im
  -0.03172568282984946 + 0.08608971879261204im
 -0.004587772731991348 + 0.0666274993974277im
  -0.29882356828643575 + 0.021682156736554im
  0.013707403159163726 - 0.08944631345361663im
  0.023380961711737275 + 0.08556189418692438im
    0.3495817743601207 + 0.0im
  -0.12890398406681453 + 0.02169491602474841im
  -0.10634450130015784 + 0.11381658259418127im
  -0.20111236288852083 - 0.015524039278263908im
   0.13195112932567732 - 0.05362290128650806im
  0.005049808993859555 + 0.11116376405588847im
  0.019028273567817774 - 0.03865378542035104im
   0.06824397432792141 + 0.25955034104961416im
  -0.25523254418569413 + 0.13233693678132802im
  -0.08927541744106779 + 0.029093659644254328im
 -0.013556335846458527 + 0.12240963230233456im
   0.09453779012159647 - 0.07103163172526142im
  -0.19924266226061518 + 0.08298912075145762im
 0.0014815573207195443 - 0.08394734097675391im
   0.15601817622957043 + 0.12190929291276753im
   0.13004572834551775 + 0.009926034136059563im
  -0.16400684374492686 - 0.18846401057275844im
  -0.07549674312602096 - 0.039108955555222286im
 -0.011947389669071728 - 0.06395965332739821im
   0.09520368783471622 - 0.11926000895456385im
  -0.15266185264795398 + 0.08599392572446087im
    0.3098525272233825 + 0.15106733556616683im
  -0.15257896237912374 - 0.09993444236116773im
  -0.09954108366344355 + 0.008524841257627749im
    0.1669078940076056 - 0.07369224303501733im
  -0.09816950294699185 + 0.04605451035642073im

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.