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.101801-0.102324im      -0.0129606+0.114202im    -0.00684771+0.0609313im     -0.0764318-0.333035im       0.103994+0.0281236im    -0.0175594-0.0690969im    -0.173343-0.0923646im   0.0698067+0.152747im       0.130864-0.333888im      0.177636-0.17731im      -0.0771546-0.0660497im    -0.0688911-0.174192im       0.291629-0.0983148im   -0.0664521-0.0737301im       0.121876+0.158423im        -0.1067+0.0337793im    -0.108228+0.0364159im      0.126398+0.221752im       0.0329229-0.0799236im      0.134784-0.129616im      -0.110805+0.02516im     -0.160081+0.0419574im     -0.0440436+0.0221396im    -0.140212-0.055686im      0.13708-0.105243im       0.101033-0.0468691im    -0.151258+0.0487654im       0.167147-0.128471im     -0.0313171-0.0717052im   -0.0359088-0.0249578im     -0.100751+0.0312105im     -0.158961-0.159399im
   0.0697093+0.0843903im       0.128916+0.0545877im     0.0397948+0.0501023im       0.197002-0.137791im      -0.247324+0.0130261im      0.151215-0.0412598im      0.11728+0.075675im    0.0849222+0.111927im      0.0817789+0.0513898im     0.126573-0.0236656im     0.0868454-0.0709256im    -0.0314682-0.189631im       -0.17989-0.2441im      -0.0553616-0.00278384im      0.135939-0.212273im       0.103298-0.200508im     0.0143895-0.076989im      0.0727357+0.0565783im     -0.0241691-0.0702672im      0.101288-0.107638im       0.170415+0.137108im     0.116522+0.231989im       -0.112218+0.0784858im     0.105584+0.256627im    0.0995442-0.0874591im      0.279316+0.150122im      0.160276-0.0695285im      0.0307442+0.118356im      -0.142203+0.0239843im     0.043878+0.0847395im     -0.152288-0.132319im      0.0856764+0.0449432im
   -0.291861-0.0500668im     -0.0929315+0.14457im        0.169468-0.207815im      0.00111036-0.0694431im    -0.0707671-0.136819im       0.137591-0.125028im     0.0387982+0.0862861im  0.00743816-0.0957488im     -0.181875-0.0593892im     0.094241+0.22992im       -0.116032-0.0912828im    0.00446559-0.0180963im      0.159815+0.233911im     0.0118073-0.0444707im      -0.127338+0.0869086im     0.0254957+0.0486546im    0.0117049-0.0790372im     0.0655333-0.16731im       -0.0169941-0.288809im       0.250326+0.0243652im        0.1389+0.0202197im    0.240519-0.0857916im       0.180455+0.0468331im   -0.0789901+0.124632im     0.224309-0.0978949im    -0.0850822-0.0163056im   -0.0120755+0.0198848im      0.0851773+0.0816128im    -0.0993384+0.126262im     -0.153011+0.00932363im    -0.137213+0.0443388im     -0.113189+0.0899174im
   0.0994314+0.0262888im     -0.0302448-0.099918im       0.275937+0.0269646im      -0.240952-0.197823im      0.0714418+0.0937571im     0.0232973+0.0377366im    0.0274244+0.0466383im   0.0174757+0.0775467im     0.0505289+0.232276im     0.0633486+0.00160649im     0.110748+0.0315307im     -0.069706-0.0119217im      0.037343+0.283866im     0.0403607-0.0628156im      0.0754418-0.0753456im    0.00504436+0.211452im      0.124041+0.0495846im     -0.130224+0.0130744im      -0.204716-0.177869im      -0.199024-0.207566im      -0.116186+0.055254im    0.0578064+0.100317im      -0.0418765-0.116335im     -0.158391+0.294265im   -0.0384322+0.158978im     -0.0912634+0.167555im     -0.195107-0.142405im       0.0581722-0.0538926im     -0.176254-0.110045im     0.0370974-0.0517944im      0.011624+0.0474722im      0.176995-0.00651208im
  -0.0112364-0.128026im       0.0319646+0.171378im     -0.0104636+0.0112486im     -0.0584845+0.00244784im     0.123772-0.244814im     -0.0287168+0.136107im    -0.0249665+0.0282365im   -0.218959-0.0719909im    -0.0194977+0.0649744im   -0.0939295-0.0318896im     0.0217603+0.149785im       -0.12209-0.193683im      -0.177037-0.123077im     0.0617128-0.199792im      -0.0606567-0.0502146im     -0.118368-0.13848im      0.0208211-0.231432im     -0.0562824-0.097095im       -0.120615-0.0972411im       0.10467+0.104561im      -0.290768-0.0272182im  -0.0105477-0.0341296im      -0.212393-0.158862im      0.159969-0.0811047im  -0.0482202+0.0497526im    -0.0682437+0.0866563im   -0.0723958-0.0122754im     -0.0019199+0.0746486im      -0.10364+0.024145im    -0.0107191+0.0922206im     -0.374751+0.269761im     -0.0223073-0.133266im
  -0.0579078-0.0671685im      0.0452809-0.150621im      0.0628517+0.0689683im       0.262331-0.115358im     -0.0519402+0.121764im      0.0245394-0.291636im     0.0681136-0.129948im     0.158449-0.220515im       -0.12312-0.0147963im    -0.123552-0.0221402im      0.347004+0.194556im      0.0919846+0.187532im        0.17049-0.0417239im    0.0860776+0.108987im       0.0707481+0.0325912im   0.000264889-0.012459im     0.0177524-0.121167im    -0.00232816-0.00138596im     -0.173383+0.0588865im    -0.0115939+0.0563007im      -0.12777+0.0563202im   0.0276538-0.0417799im     0.00581455+0.100591im     -0.049036-0.110868im       0.1672-0.131987im     -0.0434041+0.192219im     -0.048952-0.0613143im      -0.244564-0.178377im     -0.0624862-0.0827678im     0.182387-0.0336477im     -0.209148+0.0943307im    -0.0986386-0.0239625im
 -0.00121333-0.0413512im       -0.15013+0.10773im       -0.148118+0.0768143im       0.029895-0.239967im       0.111074+0.0915456im     0.0764018-0.0468109im    0.0504921-0.032233im    0.0188252-0.0350011im      0.174601+0.0974264im    -0.202947+0.0583314im      -0.35693-0.0719852im     -0.112506-0.104401im     -0.0180566-0.0954437im    -0.154801+0.179476im        0.109494+0.163962im       0.131033+0.155478im     0.0911081-0.0038498im    -0.0874408-0.119616im       -0.238438-0.122617im    -0.00277921+0.181037im      -0.154428+0.127669im    0.0467476+0.0209481im       0.114191+0.139243im     0.0213776-0.0812313im   -0.100288+0.0618595im     0.0787161+0.0827847im     0.126704-0.261482im       -0.173045+0.0449674im    -0.0443286+0.139007im     0.0439578+0.140317im       0.182724-0.0117575im     -0.132508-0.0535184im
    0.144317+0.0583742im      -0.123246-0.0169921im     -0.258927+0.00682192im   0.000108848+0.0189581im      0.279388-0.150762im     -0.0321415-0.1017im        0.141195+0.106566im     0.277187+0.0436662im     0.0181013+0.0334377im   0.00355654+0.0128303im     -0.125644+0.00258708im  -0.00561557-0.0425im        -0.224345+0.0844993im   -0.0585661-0.103572im      -0.0954063-0.068286im     -0.0610146+0.0913924im     -0.23881+0.0079858im      -0.10636+0.132986im       -0.163928+0.140052im     0.00372608+0.156105im      0.0295404-0.200376im    0.0865727-0.0334068im       -0.14922-0.0071688im    -0.338714+0.142161im     0.126778-0.2721im        -0.101672+0.116561im      0.103765+0.0898917im      0.0289693+0.0487743im     -0.036242-0.00368159im    0.135389-0.0999395im      -0.07324-0.0367964im    -0.0517374+0.122188im
   -0.118221-0.0234119im      -0.150126+0.0495727im      0.213444-0.110901im        0.164852-0.0667225im      0.159628-0.274928im      0.0673527+0.0143978im     0.178204-0.0735302im   -0.104687+0.0352062im     0.0313896+0.0748699im   -0.0677407-0.133691im      0.0900616-0.114228im      -0.399555+0.144989im       0.125638-0.139104im    0.00361427+0.0829546im       0.183264+0.035121im      -0.239607+0.014545im     -0.109058+0.261829im      0.0186886+0.0519769im     -0.0704847-0.00526307im    0.0283946-0.0622316im      0.206065-0.180632im    0.0819379+0.0226852im     0.00453514+0.00336627im    0.031908-0.0616414im  -0.0736967+0.0754191im     -0.053729+0.118771im    -0.0297714+0.0611313im      -0.145403+0.170771im       0.209926-0.0440246im    0.0450937-0.0243981im    -0.0535621-0.129188im       0.112384-0.0791494im
   -0.108426+0.0232789im     -0.0367866+0.0406172im    -0.0612623+0.0681137im       0.118646+0.107221im     -0.0113984-0.0225072im    -0.0816667+0.183677im     -0.236138-0.210231im     0.040208+0.039147im      0.0671652-0.0062689im     0.082807-0.333446im      -0.122275+0.00715213im    0.0208662-0.00274601im    0.0350196-0.0411713im     0.218577+0.0734201im      -0.271344-0.179718im      -0.159243+0.0490146im   -0.0287277-0.0484953im    -0.0159431-0.190901im       -0.162617+0.0759833im      0.211774-0.0267978im   0.000937086+0.18469im      0.221092+0.0270784im     -0.0127972+0.0994024im   -0.0335874+0.142535im      0.11045-0.137989im      -0.095652+0.0293925im    -0.105028-0.138744im         -0.1064+0.0102005im     0.0225353-0.278836im     -0.091844+0.0857472im      0.224807-0.0187448im      0.109277-0.0778429im
  -0.0657257+0.126074im        0.036471+0.0300373im    -0.0544531+0.00202522im    -0.0466376+0.0831832im      0.154927-0.209243im    -0.00970623-0.119637im    -0.0668389-0.195529im    0.0872631-0.168759im    -0.00124349-0.140955im      0.113549+0.186466im     -0.0652469-0.0350892im     0.0881004-0.135103im      -0.126536-0.0354795im    -0.152138+0.0643392im     -0.0821028-0.125745im      0.0807824+0.10052im     -0.0563952+0.139848im       0.134898+0.0331559im      0.0915108-0.13105im      -0.0954934-0.215701im       0.228771+0.0940943im   -0.025175-0.0630873im      -0.118471-0.0975687im      0.11161-0.366929im     0.015759+0.0297438im    -0.0978866+0.336204im    -0.0746913-0.181536im      -0.0491559-0.126621im      -0.214212-0.0391909im   0.00843323-0.00918932im    0.0536016+0.0196527im      0.172323-0.0280113im
   0.0247544-0.00396061im  -0.000471744+0.0626021im    -0.0234755-0.0614459im      0.0762902+0.042156im       0.143503-0.0291576im    -0.0584243-0.302354im     -0.010408+0.107466im   -0.0434969+0.221627im       0.116841-0.340051im     0.0763132-0.128457im      0.0346766+0.0593604im      0.110375+0.0277155im     -0.106008+0.202184im      0.079096+0.0524801im      0.0295584+0.125656im        -0.1368-0.134171im      0.248603-0.0592516im  -0.000578845+0.0360277im     -0.0196177-0.0605542im     -0.185042-0.0023023im      0.187657+0.152651im   -0.0382182-0.110772im    -0.000329182+0.0154344im   0.00989271+0.167224im    -0.269048+0.0376186im    -0.0452442+0.16697im       0.179133-0.00768215im     -0.157777+0.173569im      0.0787977-0.139328im     -0.155762+0.0930409im    -0.0237568+0.225017im      -0.113861+0.0416802im
     0.12897-0.070426im       0.0942888+0.0593841im    -0.0278248-0.0289107im       0.136459-0.255765im       -0.10826-0.138823im      0.0218549-0.00905585im    0.161391+0.0222694im   -0.113654+0.0806066im     0.0376528-0.305411im    -0.0441536+0.223823im      0.0971162+0.0565329im      0.189091+0.0103923im     0.0530817-0.101349im   -0.00968105-0.173906im      -0.0460271-0.151656im      -0.108438+0.0148109im    0.0139885+0.0641528im     -0.113677-0.199818im       -0.173769+0.0156438im     0.0219541+0.0338682im     0.0749021-0.107726im    0.0558315+0.0960501im      -0.186226-0.0973956im   0.00421232+0.0911823im    -0.16304-0.0272972im     -0.164604-0.170594im    -0.0883895-0.0730807im      -0.157574-0.248725im     0.00545088+0.212692im     -0.131874-0.156873im       0.243877-0.12691im     -0.00680387-0.0976108im
   0.0161864+0.0256851im     -0.0162246+0.095747im      0.0695686+0.146118im       0.0673371-0.0963153im      0.116162-0.025404im       0.073714-0.0343666im    0.0507764-0.252837im   -0.0641945-0.145094im      -0.139637-0.0548797im    0.0902554-0.132084im      -0.122431-0.0448535im     -0.139665+0.0934244im     0.0777872-0.0218996im    0.0689543-0.516664im       -0.189082-0.0882744im      0.191539-0.0240318im     0.213716-0.137658im      -0.108375+0.000741761im   -0.0383212+0.0163246im     -0.120737-0.0516838im      0.080818+0.132549im   -0.0308091+0.151402im        0.101917+0.111566im    -0.0839779-0.109979im    -0.063641+0.0748829im   -0.00483713+0.0670511im     0.261788+0.117928im        0.128338-0.0678375im      0.181211+0.0461127im     0.157817-0.10706im        0.037002+0.00230981im    0.0314127+0.0902749im
  -0.0645761-0.00194565im      0.141825+0.00626121im     0.180386+0.140242im       0.0772087+0.0410636im      0.142819+0.122466im      -0.071219-0.0446766im     0.146262+0.0382756im   -0.170905+0.127958im       0.140211-0.124194im      0.112851-0.129568im      -0.115969+0.11906im       0.0298465+0.0460888im     0.0197282+0.0220657im    -0.132458-0.18283im         0.121278-0.143873im      0.0200069-0.0390403im   -0.0795212+0.131124im     -0.0228569-0.151443im       0.0851399+0.0361197im    -0.0132594+0.0166792im     -0.267714-0.218644im     0.204022-0.153441im        0.105389+0.101377im     0.0260407-0.150196im     0.141303+0.0581091im      0.148937+0.076969im    -0.0213364+0.161209im       -0.166038+0.0372027im     -0.304373-0.0391433im    -0.133324+0.0286085im      0.101805-0.0184259im     0.0496864+0.320084im
  -0.0556873-0.0810352im     -0.0734056+0.0377782im      0.210172-0.259157im        0.114575-0.0863173im   0.000149955+0.0239318im    -0.0334463+0.160174im     -0.131725+0.0766425im    0.080121+0.0329342im     -0.103133-0.013078im     0.0204107-0.016009im    0.000686034-0.0104663im     0.0109528+0.0246317im    -0.0457268+0.0903981im   -0.0360685-0.0194283im      0.0256861-0.225964im       0.294909-0.229632im    -0.0490277+0.265279im      -0.279534+0.157169im       -0.055692-0.112113im      0.0241033+0.233581im    0.000533166-0.0501035im   -0.068214-0.00754603im    -0.0741802+0.0933711im    0.0954143-0.119228im    -0.198408-0.214663im      0.0241128+0.0720247im    -0.118362-0.123137im        0.139618-0.136515im      0.0809413-0.224424im    0.00168089+0.127405im      0.0549037+0.0583288im      -0.19323+0.105983im
   0.0463686+0.310543im       -0.167286+0.148466im        0.17339+0.0775398im      -0.125314+0.209672im     -0.0205152+0.0394074im      0.113521+0.115028im    -0.0105615-0.0376144im     0.13876+0.0739012im    -0.0301714+0.0169707im     0.139796+0.0819982im      0.065174-0.0368522im    -0.0148783+0.0308637im       0.08582+0.105421im     -0.175193-0.174661im        0.200756-0.153398im       -0.21723+0.0711269im     0.159317-0.226054im       0.128027-0.0795632im       0.128545+0.0237256im     0.0940621+0.0626905im    -0.0481492-0.0421478im   0.0572739-0.161433im      -0.0321195-0.0144931im   -0.0529364-0.0632261im   -0.251417-0.227914im       0.126838-0.0107495im   -0.0208458-0.146719im       -0.193822-0.0588515im     0.0434365+0.0142386im     0.192603+0.0623508im   -0.00674186-0.113682im      -0.178341-0.136243im
   -0.034475-0.0953065im      -0.144653-0.0680306im    -0.0438199-0.0497306im     -0.0472844-0.14758im      -0.0741401-0.186601im      0.0261445-0.117692im      0.295124+0.0121479im   0.0214204+0.287757im   -0.000958803+0.164866im      0.020414+0.082076im     -0.0770353+0.119044im       -0.02918+0.0100965im      0.026933-0.0228669im     0.110694-0.112228im       -0.216945+0.0708625im      0.135967-0.0151976im    -0.205487-0.114784im       0.285413-0.201139im       0.0955699-0.00694738im    -0.249849+0.00483673im   -0.0773954+0.182001im    -0.156875-0.0131613im      0.0154052+0.0138062im   0.00849013-0.0889314im   -0.111475-0.162533im       0.144046-0.0748074im    -0.216818-0.0294581im     -0.0886632-0.00567241im    0.0853666-0.264064im    -0.0328864+0.0845627im    -0.0388969-0.133233im      0.0593083+0.0886907im
   0.0347058-0.12459im        -0.336025+0.10771im       0.0165843-0.161651im      -0.0620129-0.0844609im     -0.106673-0.00835015im    -0.110323-0.00181959im   0.0249283-0.161009im    -0.109269+0.0549923im      0.110121+0.194887im    -0.0412244-0.191428im      0.0640584+0.399927im      0.0898107-0.123347im     -0.0409503+0.164803im    -0.0487275+0.024735im      -0.0281821-0.161937im      0.0338011+0.0694639im    0.0455659-0.026175im      0.0430066+0.0706878im      0.0781615-0.00163954im    0.0706085-0.243451im       0.164059-0.138912im    -0.149205+0.14345im      0.000927683+0.0187805im     0.106476-0.0713328im    0.162198-0.0321544im       -0.1144-0.0593446im     0.176826+0.051333im       -0.146218+0.0649554im     -0.115365+0.113791im     0.0659957-0.00163615im     0.110346-0.0154648im     -0.287411+0.027586im
    0.110988-0.147784im        0.154412-0.214637im      0.0612056-0.0792038im     -0.0991236+0.169986im      0.0679832-0.0882061im    -0.0762896+0.00725375im   0.0430091-0.0609945im   0.0559093-0.0731874im      0.171934+0.0137375im    -0.184583-0.0413732im    -0.0178128-0.0990145im      0.310628+0.0344073im     0.0620122+0.145403im     0.0514005-0.181533im       0.0208101+0.0638526im     0.0915675+0.0243461im    -0.104975+0.089145im      0.0572729-0.0588876im      -0.151272-0.0202468im       0.25016-0.23131im       0.0257834-0.0392619im    0.125803+0.200526im      0.00116266-0.0813128im    -0.159837-0.117458im    -0.131528+0.0531163im        0.2232+0.0623606im    0.0641366-0.0292857im     -0.0592813-0.0108711im      0.190517+0.0700243im   -0.0448069+0.369449im      -0.155687-0.0737035im    -0.0764715-0.0228033im
   -0.138169-0.19866im        -0.106186+0.00438192im   -0.0848148+0.250146im       -0.158385-0.107769im      0.0297582-0.0829417im       0.22295+0.179722im     0.0843875+0.119784im   -0.0708182-0.165279im      0.0855744-0.0687743im     0.175199-0.153349im       0.157107-0.0166988im      0.268401+0.248233im     -0.0443677-0.101375im    -0.0791673+0.0664445im      0.0361369+0.0295826im      0.129714+0.105659im    0.00254402-0.190273im     -0.0499134+0.146594im      -0.0864404-0.276927im     -0.0258718-0.0274578im      0.131496-0.142785im   0.00876157-0.157851im       -0.148593+0.108277im     -0.028703-0.0622275im  -0.0220205-0.105669im      0.0309137-0.194981im   -0.00319133+0.0275363im     -0.0252544+0.147229im       0.024732-0.06901im      0.0723028+0.129376im      0.0945948+0.0716609im      0.198898+0.0221227im
    0.272674+0.0322976im     -0.0360773+0.149927im       0.105004-0.00501465im     0.0260046-0.0393687im     0.0302358+0.189793im     -0.0857064-0.0174385im   -0.0455186-0.0415612im   0.0557753+0.0239238im     -0.133165+0.0664942im   -0.0865497+0.272187im     -0.0210592+0.164409im      -0.118335+0.0675128im      0.169083-0.078987im     0.0914786-0.00614423im    -0.0132576-0.0575876im      0.167739-0.147523im     -0.138371-0.034419im       0.234034+0.15476im       -0.0437057+0.0306858im     0.0188818-0.0840925im     0.0194309-0.0144667im     0.21838-0.158442im       -0.219533+0.176777im      -0.18218-0.0627848im    -0.11076+0.0804181im     -0.165251-0.093868im      0.165686+0.0853564im      0.0139156+0.174472im     -0.0989308-0.0415553im    -0.166411+0.212457im       0.119951+0.126923im        0.13757-0.189225im
  -0.0448833-0.259629im        0.235645+0.0819984im     0.0885492-0.000106461im   -0.0255176+0.0367029im    -0.0716873-0.0144429im     0.0167372-0.276543im     -0.121084-0.0276607im   -0.192183+0.0524018im    0.00695721+0.110652im      0.146735-0.00731815im    0.0150141-0.151646im      -0.155886-0.0526044im     0.0612547+0.0384987im     0.171439+0.00903057im     -0.100836+0.00275873im   0.00984191+0.244436im     0.0269139+0.114419im     -0.0177549+0.152722im       0.0553294+0.0871899im     0.0108457+0.216102im      0.0409327+0.0223795im   0.0367127-0.0657279im      -0.158641-0.293392im    -0.0242596-0.0229604im  -0.0415948-0.091116im      0.0104179-0.224025im      0.259967-0.0911311im      -0.124175-0.0736571im     -0.210985-0.0660117im     0.242918+0.194156im      0.0219134-0.102918im     0.00652273+0.0590464im
   -0.229969-0.0313916im       0.204906+0.0250777im    -0.0442143-0.160362im      0.00503669-0.117197im     -0.0497197+0.268261im       0.117278+0.237077im     -0.109237+0.0105392im  -0.0238434-0.135338im    -0.00647371-0.120685im     0.0268694+0.0965855im     -0.236469+0.232659im      0.0692116-0.00641025im    0.0437149+0.189796im     0.0247553-0.115554im       0.0634517-0.148602im      -0.136202+0.114282im     -0.283231+0.0646986im      0.167654+0.0757921im     -0.0840584-0.0566276im     -0.146359+0.14037im       0.0216172+0.0410178im   -0.181726+0.0579528im    -0.00270568-0.0478808im    0.0376111+0.0965065im  -0.0102948-0.0178502im      0.094912+0.132382im      0.142909+0.0873169im      -0.235481+0.14521im        0.144402+0.00766975im   0.0889416-0.0790717im    -0.0946238-0.0166522im      0.152336-0.131653im
  -0.0393686+0.117452im        0.137684+0.109575im       0.132977-0.246823im       0.0102416+0.0785773im      0.213864+0.0503514im     -0.199911+0.112636im      0.187892-0.0397939im  0.00933828-0.0567869im     0.0260212-0.172679im     0.0602816+0.194766im       0.126878+0.0146998im     -0.148365-0.0512838im     -0.231791-0.0180429im    0.0318684+0.0683098im      -0.120182+0.277931im       0.156224+0.11486im       0.062594-0.136086im     -0.0756203-0.0101482im     -0.0345636-0.090421im       0.140171-0.146222im      -0.101612-0.151118im   -0.0906043+0.118824im       0.0106121+0.117739im     0.0515608+0.100406im    0.0902981-0.0515648im      0.185194-0.131815im      0.124074+0.0624681im      -0.160145-0.117111im    -0.00291164-0.295789im      0.100368-0.0700659im       0.12074-0.0239329im     0.0424982-0.155556im
   -0.237776-0.134809im       -0.018004+0.204882im      -0.184611-0.0592926im      0.0449884+0.108278im     -0.0115937+0.130471im      -0.202203-0.0432775im      0.28642+0.101801im   -0.0328259-0.060595im      -0.131619+0.0795116im  -0.00313583-0.177629im      0.0679092+0.101912im      0.0612729-0.0481222im    -0.0491347-0.0335437im    0.0499191-0.0467031im      0.0728054-0.0596102im    -0.0408457+0.0685143im   -0.0845249+0.0459105im     -0.137577+0.146703im         0.11013-0.122187im     -0.0759114-0.0907343im    -0.0311458+0.230248im     0.287258-0.144584im      -0.0354319-0.0595918im    -0.183255-0.0756073im   -0.117771+0.104965im       0.208816+0.0143009im    0.0115636-0.0868994im       0.146005-0.0752731im   0.000110428+0.00275023im   -0.111466-0.207725im      0.0174332-0.174193im      -0.126333-0.277585im
    0.122839+0.16144im        0.0422915-0.00120075im      0.14123-0.149436im      -0.0927276-0.0227908im    -0.0399314-0.221508im      0.0121647+0.125669im    -0.0711381+0.0840476im    0.061364+0.067191im       0.109528+0.0822549im     0.128696-0.025146im      0.0184447+0.170581im       0.186444-0.232439im      0.0405973-0.138125im      0.284143+0.000709167im    0.0932152+0.121567im      -0.100283+0.216467im    -0.0442595+0.0522473im    -0.0643257+0.0833964im     -0.0243371+0.0222817im    -0.0993113+0.133517im      0.0570456+0.0660416im    0.177468-0.0707248im       0.081573+0.394616im     0.0311358-0.171223im   -0.0180805+0.0928385im   -0.00549984-0.120386im      0.170424-0.107049im      -0.0229426-0.181825im      0.0651641+0.0664036im   -0.0119916-0.127856im      -0.191422+0.0730242im     0.0985849+0.163983im
 -0.00446828-0.0801534im      -0.141616-0.0520166im     -0.258402-0.0678834im     -0.0457609+0.104382im       0.115866-0.00677859im     0.116532-0.317021im     -0.363022-0.165658im   -0.0997067+0.0891078im     -0.104933+0.0457796im    -0.156007+0.0844674im      0.118252+0.0482651im    -0.0864117-0.000521924im  -0.0956447+0.0861788im    0.0871434-0.150338im        0.225334-0.0773883im    -0.0247209+0.00521181im  -0.0780854-0.011995im     -0.0768962-0.0800267im    -0.00221525-0.246736im       0.143244-0.0380389im    -0.0431958-0.0387452im  -0.0793128-0.133036im        -0.11505+0.271616im     0.0993256+0.153125im    -0.025118+0.0623853im      0.192533-0.0412815im   -0.0229265+0.0708492im   -0.000759854-0.145571im      0.0447463+0.0154064im   -0.0217936-0.0347221im     0.0471128-0.193404im       0.199599+0.0820009im
   0.0414364-0.0136079im       0.122724-0.166607im      0.0948237+0.039514im       -0.260221+0.0454984im     -0.160658-0.0778728im     0.0234459-0.0618856im    0.0717759+0.0904244im    0.140768-0.255077im       0.152299+0.0408177im    -0.137674+0.0358608im    -0.0891649-0.0560943im     -0.118288-0.100125im       0.181262-0.0181834im    0.0776292-0.0778271im    -0.00583282-0.045609im      -0.177252-0.245755im     0.0701628+0.021938im      -0.188424-0.0637868im     -0.0566546-0.128318im     -0.0231773-0.0857425im    -0.0160159+0.0371846im   -0.208649-0.185245im       -0.201087+0.0453226im   -0.0128051-0.11016im      0.147728-0.0895891im     0.0167989-0.0282018im     0.222739-0.0875246im     -0.0627187+0.189236im     -0.0102725-0.22497im      -0.178941-0.216397im       0.128286-0.152348im      -0.127374+0.0290775im
   0.0679692+0.0929842im     -0.0048737-0.336088im      -0.062139-0.00658726im    -0.0322884-0.114429im      -0.155791-0.0867431im     -0.250683+0.0403222im   -0.0521892+0.0286559im   -0.196953-0.0781351im      0.212738-0.133027im     0.0122661+0.0313271im      0.113782+0.0498596im     -0.144911-0.0604587im    0.00956862+0.0130881im    -0.114178+0.0875981im     -0.0313389-0.121125im      0.0400805+0.0896687im   -0.0575382-0.156767im       0.162715+0.0123686im      -0.097497-0.221272im      0.0704452+0.152314im     -0.0312989+0.0859236im    0.209625-0.123433im        0.148797-0.035371im     0.0480182-0.0198737im   -0.189256+0.00838235im    -0.149089+0.1413im        0.117092+0.298812im        0.190506-0.0477198im      0.017887-0.137202im      0.157029-0.00589289im    0.0262335-0.218522im      -0.117704+0.00263717im
    0.323621-0.212386im        0.184773+0.0805211im    -0.0668683+0.0961725im     -0.0870168+0.186439im     -0.0036157+0.0844245im    -0.0726053+0.112514im      0.153221-0.125538im    -0.207186+0.264082im      -0.181314+0.0581621im    -0.158484+0.106566im       -0.10606-0.0276675im      0.143704-0.0135944im      0.108199-0.0241046im   -0.0473175+0.0119062im    -0.00477876+0.0468991im    -0.0673605+0.00517161im    0.163888+0.160092im     -0.0148045+0.0505045im     -0.0733554-0.222261im      0.0644296+0.0365504im      0.174708+0.0822905im   0.0614873-0.0316566im       0.127528+0.124374im     0.0982054-0.0320786im   0.0817358-0.259161im     -0.0207395+0.106097im     -0.143026+0.0607363im      -0.023991+0.130693im     -0.0110452-0.0912782im     0.254129-0.202401im       -0.05716+0.0596418im     0.0271262-0.0238954im
  -0.0876316-0.0851006im       0.186648+0.0036921im     -0.141537-0.0576035im     -0.0898096-0.120663im       0.106542-0.0277864im      0.023228+0.0786295im     0.098791+0.0386092im   -0.158502+0.0376549im     0.0642859+0.0245045im    -0.105279-0.0167181im    -0.0469035-0.0733549im    -0.0732782-0.0648808im      0.190091+0.167776im    -0.0643073+0.217358im        0.156011-0.214953im      0.0980288+0.00885092im   0.0416768-0.216289im      -0.208227-0.248415im        0.254738+0.266086im       0.022955-0.0341524im      0.208105-0.0433277im  -0.0942288+0.0231174im     0.00311629+0.23628im      -0.189444-0.0323949im  -0.0832212-0.103457im     -0.0896371+0.0668348im    0.0789721+0.043325im        0.055181-0.171285im      -0.104597-0.0993684im   -0.0537622+0.0730369im      -0.19434+0.0248268im      0.138196-0.151542im

and then generate the state $ψ$

psi = P[:, 3]
32-element Vector{ComplexF64}:
   0.08401714483781453 + 0.1659886001248722im
  0.016529642545913048 + 0.1235287334475984im
   0.09984464819154729 - 0.012958264035917079im
    0.1503187846765846 + 0.14875944745703218im
  -0.02592707644290257 - 0.22467599386988152im
   0.20097021814690577 + 0.14442260516550914im
   0.02635574223409603 - 0.050419293539698005im
    0.1707537962032488 - 0.19907076764498172im
   0.07317246096916918 - 0.02679346408153595im
  -0.02904930086797248 + 0.14254604848540758im
  0.045091361034589425 - 0.07602157010278215im
   0.06775004315442633 + 0.0737182435262614im
  0.022830923777002923 - 0.04243265592238092im
    0.3297058924512097 + 0.0im
  -0.06598329248436845 + 0.0381139812068846im
  0.010367061351673083 + 0.09359893411924945im
  0.037107127792175384 - 0.32599182332106935im
   0.04394355172979045 + 0.189823674983622im
   0.08502003272425239 + 0.07614515912945619im
   0.07149838979580578 + 0.15467861532540556im
  0.015878683394614915 - 0.17450856561887904im
  -0.23511502997164244 - 0.051618086684849476im
   0.06399004703896763 - 0.07766449492898805im
 -0.024566306730545634 - 0.017646692369277312im
   0.28673639978619847 - 0.15460686100527776im
 -0.009599345726510188 - 0.11890244276200171im
  -0.13795323773988602 - 0.013370141904157654im
   0.07605220062321003 + 0.1051454681598051im
   0.17172439240235582 + 0.028879085792547353im
 -0.036657203146648235 - 0.23415962122391507im
   0.07650630627108265 - 0.008842571645336354im
    0.0167874733600503 - 0.05762929421795777im

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.