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.209984+0.377414im        0.04247-0.00399127im    0.0594422+0.0597135im     0.0504013+0.185151im      0.139002-0.00843835im    0.0287301-0.273123im     -0.104029-0.0740299im     0.222431-0.00896064im    0.0384107-0.106301im     -0.0903678-0.195829im      0.0230052-0.149884im    -0.00240755+0.0074598im     0.105461-0.120437im     0.0540424-0.114829im      0.115826+0.127139im      0.0905191+0.102595im     -0.132936+0.136943im    -0.0802904+0.0803345im    -0.0405453+0.0240027im      0.0251207-0.21154im        0.125618-0.0738942im      -0.35691-0.110386im      0.058344-0.0471747im     -0.137363+0.106349im      -0.109283+0.226132im     -0.0697473-0.0943457im   0.00220616+0.0375294im     0.0918277-0.0766632im     0.0127986+0.0329799im   -0.0536875-0.0838442im     -0.07976-0.0805789im      0.07026+0.140026im
  -0.102449+0.101447im      -0.110954+0.0974872im    -0.0726165+0.0471757im    0.00748238+0.132511im      -0.10748-0.0705202im     -0.149931+0.19035im       0.363536+0.0713633im   -0.0602293+0.195946im       0.191348+0.0464616im    -0.0415357+0.0183053im     0.0741212-0.0412651im      0.227452+0.00477276im   -0.019417-0.00841843im   0.0988472-0.0470629im    -0.178485-0.0587034im      0.167233+0.116402im      0.129396-0.161925im     -0.155685+0.0906534im      0.222229+0.019779im       -0.325275+0.0230864im    -0.0470602+0.0440639im    -0.0223132-0.163261im      0.053728-0.0665745im      0.101821+0.0329444im      0.113062+0.111817im     -0.0394351+0.134319im    -0.0871877-0.189171im      0.0477077-0.214539im      0.0385814-0.0796831im    0.0267611-0.0685024im   -0.0160049-0.118604im      0.140899+0.152074im
   0.321388-0.0952518im     -0.184468-0.0126524im     -0.230164+0.195958im      -0.199781+0.157048im     0.0717959-0.0370872im       0.12735-0.140698im     0.0865726+0.0237609im    0.0982304+0.0386217im    -0.0970899+0.176873im     -0.0124006+0.0511444im      0.149883-0.0246722im     -0.191653+0.0171348im    0.0174312+0.0483478im     0.191327-0.00462282im    0.214812+0.26003im        0.013462-0.21651im        0.13482-0.154599im      0.142006+0.186453im      -0.067968+0.0710518im      -0.178158-0.0994619im      0.122227+0.0691456im    -0.0806014-0.0538107im    0.0485153+0.122909im    -0.00997053+0.0115667im     0.0245254-0.0247179im    -0.0306894+0.147347im     0.0725169-0.0017573im     0.0208084-0.0542863im    -0.0210215+0.0941901im    0.0384423-0.264202im      0.100097+0.0441938im   -0.0264651-0.105823im
  -0.104694-0.0884682im     0.0628852-0.171594im      0.0640974+0.0299492im     0.0149249-0.133682im     -0.461126-0.0836876im     0.0442977-0.0928998im   -0.0478836+0.068071im    -0.0579741+0.00395781im   -0.0114929+0.00111298im   0.00301304-0.0385958im      0.139717+0.211054im      0.0255322+0.00505739im   -0.110849+0.126476im     -0.149139+0.0120142im    0.0881016-0.127727im       0.125969-0.119343im      0.133312+0.0172753im    0.0540967+0.219564im      0.0698715-0.0437819im      0.0710325-0.0920403im      0.104872+0.0697863im    -0.0630718-0.124232im     0.0534474+0.183575im       -0.28477+0.0243064im     0.0723501-0.033068im      -0.108975-0.0913745im     -0.06056-0.137036im     -0.0512813+0.055914im     -0.0919282+0.10055im      -0.349323-0.0751001im    -0.160036-0.176747im      0.107872-0.0208035im
  0.0616169+0.0669638im     0.0796634+0.0938417im     0.0293777-0.10101im      -0.0461274+0.219679im     -0.374063+0.00784499im   -0.0716809+0.00348794im  -0.0924197-0.136181im    -0.0212923-0.0482603im      0.059908+0.135286im      0.0555822-0.00956492im     0.216399+0.113873im     -0.0234168-0.0134616im    -0.188984-0.109302im       0.21355+0.0103613im   -0.0396624+0.221054im     -0.0899635-0.192221im      0.103943+0.238419im    -0.0651736-0.145657im      -0.110619+0.0462392im     -0.0696475+0.115596im      -0.197879+0.0890059im    -0.0468977+0.0850861im    -0.047779-0.244735im     -0.0523832-0.0724153im     -0.232398-0.0445875im    -0.0504415+0.011911im    -0.0323914+0.0501439im    -0.0746458-0.0138426im      0.105361+0.15993im       -0.04749+0.109876im      0.154464-0.00193568im   0.0770793+0.253882im
  0.0514042-0.0564859im     -0.132608+0.135362im     -0.0663203+0.205981im     -0.0966574+0.16995im      0.0364274+0.123325im      -0.366627+0.18033im      0.0386302-0.0468005im    -0.171599-0.000641698im   -0.202185-0.144943im     -0.0583488+0.122114im       0.118804-0.0397326im     0.0570312-0.0550055im    -0.130808+0.0283182im    -0.114898-0.0478329im     0.222607+0.0721279im      0.156793+0.128119im     0.0202256+0.205938im    0.00618761-0.118048im       0.154923-0.110293im        0.188117-0.0150944im      0.011252+0.0211618im    -0.0723868-0.0875635im     0.178135+0.0246135im     -0.149937-0.259317im      0.0244861-0.0859862im     0.0981792-0.0870489im   -0.0045078+0.0870958im      0.203426+0.0754621im     0.0616054+0.066844im     0.0472833-0.0441932im    -0.172871+0.185777im     0.0658983+0.00836305im
  -0.135647+0.12722im       0.0121367+0.131331im       0.172139-0.0762945im    -0.0856381+0.137297im     -0.118645+0.0361799im     0.0409872+0.0547977im    -0.241785-0.0275309im    0.0539541-0.093614im      -0.127468+0.245335im     -0.0236577-0.0449317im     0.0542437-0.0798684im    -0.0280915+0.0302716im     0.111284+0.0864757im   -0.0230199+0.00723036im   -0.183694-0.0390803im      0.104274+0.184012im    0.00982081-0.141361im      0.372449+0.0794779im     0.0297704-0.0881599im      0.0780391+0.0866224im     0.0971532+0.0267444im      0.153377+0.273536im     0.0696018+0.0975516im     0.0352316-0.230374im       0.164588+0.11807im       -0.172591+0.0655153im    0.0696301-0.0303948im      0.066304+0.070004im      0.0544055+0.0828183im     0.200852-0.203611im     0.0376794-0.0525839im     0.146731+0.181323im
  -0.200451+0.0281878im     -0.120482+0.00133737im     0.123119+0.0694156im    -0.0635899-0.0940046im    0.0482693+0.131771im      -0.139372+0.0459703im    -0.385744+0.00377293im    -0.15976+0.0478266im      0.165312-0.0221643im      0.124929+0.0344099im     -0.156583+0.314589im      -0.130817+0.0771292im   -0.0873072-0.0672525im    0.0355538-0.0918958im    0.0202218+0.0988504im    -0.0633803+0.0547374im   -0.0436909-0.155022im    -0.0665332-0.0269202im   -0.00151067-0.0876277im      -0.360963-0.186304im      0.0903553+0.0173979im     -0.121633+0.0415572im    -0.120426-0.00639313im   -0.0964109-0.281405im     -0.0477005+0.00307462im   -0.0377187+0.138142im     -0.109026-0.0283001im    -0.0930411-0.145319im     -0.0518584+0.00475994im   0.0649877-0.0145965im   -0.0518599+0.114293im    0.00561629-0.208836im
  0.0831742+0.112594im      0.0663917-0.17503im      -0.0706334+0.101295im      0.0230356+0.179209im     -0.108633-0.0281709im    -0.0869113-0.112404im     -0.110398-0.0208701im    -0.185561+0.103788im      -0.217049+0.231895im       0.132752-0.21304im       -0.172538-0.00624152im     0.108028+0.144725im    -0.0924255-0.118735im      0.120893-0.0222221im   0.00542699+0.0729436im     0.0953605+0.0235043im    0.0787605-0.146287im    -0.0395554+0.0282603im      0.112031-0.246354im       0.0856688+0.0745066im     0.0575815-0.187033im      -0.108868-0.0565955im    0.0203031-0.0175852im    -0.0587202+0.120824im       0.152551-0.126559im       0.103337-0.0839791im    -0.167605+0.00899123im   -0.0843833+0.177068im       0.127133-0.1909im        0.202163+0.17029im       0.142345-0.186093im     -0.168851-0.100143im
  0.0344475+0.045005im      0.0478503+0.316866im      -0.112711-0.194296im       0.125945+0.0272349im    0.0351527-0.0973401im     0.0769628-0.107253im     -0.137866-0.153774im    -0.0592542+0.217478im      -0.136928-0.0919106im    -0.0689235+0.216391im      0.0647058+0.235196im       0.285258-7.30813e-5im   0.0660158-0.0185758im     0.107224-0.157213im    0.00501055-0.143274im      -0.223486-0.137025im    -0.0978846-0.059997im   0.000697531+0.00824002im   -0.0532893+0.041842im       0.0431889-0.067319im     -0.0720272+0.00191725im    -0.138834-0.0365905im    0.0523196+0.122904im     -0.0862109+0.0147182im      0.165637-0.0510648im   -0.00963759+0.160491im      0.116033-0.0846834im      0.308152+0.0751911im    -0.0231311+0.0920332im     0.110187+0.156398im     0.0774676-0.13625im        0.12564-0.130257im
   0.103677+0.0936498im     0.0133482+0.00130465im    -0.266999+0.0135605im     0.0792385-0.0171428im    -0.126222+0.0102786im     0.0930485+0.143442im    -0.0444819+0.109126im     0.0438011+0.103648im     -0.0418549+0.00946419im     0.317732-0.224448im       -0.13046+0.0410338im     0.0988937-0.0618715im      0.13869+0.0784939im   -0.0748398+0.0248964im     0.237701-0.0487993im    -0.0592475+0.0638389im    -0.194963+0.0354664im     0.241147-0.0533502im     0.0940758-0.192819im      -0.0912416-0.183987im       -0.29742+0.0995634im    -0.0798934-0.110599im    -0.0826254+0.0405084im      0.207916-0.0586631im    -0.0554146+0.191319im     0.00376388+0.0629894im    0.0301258-0.0879802im    -0.0239132+0.163052im       0.135387+0.0323613im    -0.182876+0.00361651im   0.0572718+0.192481im     0.0368898+0.110839im
   0.249911-0.0325102im      0.013214+0.0349037im     0.0368964-0.137927im      -0.101138+0.230719im     0.0901846-0.0517638im      0.123203-0.0901116im   -0.0720774-0.133734im    -0.0758113+0.059523im       0.163339+0.118905im      0.0748592-0.0896976im    -0.0196318+0.160345im      -0.232615+0.0870786im    -0.093743+0.304665im     -0.150853-0.209267im     -0.152728-0.0471406im     0.0425151+0.267567im      0.103923+0.0320833im    -0.170156-0.103185im     -0.0471373-0.0238336im       0.158933+0.0133501im     -0.050681+0.0459901im     -0.167882-0.0178884im     0.296429+0.0513697im      0.124109+0.126519im      0.0607505+0.0326309im     0.0444876+0.171955im     0.0110955-0.0818826im     -0.109275-0.0209993im     -0.147215-0.0388849im   -0.0965283+0.0873051im    -0.131514+0.155809im      0.032347+0.0488329im
  0.0556446+0.026204im       0.306981-0.226815im       0.115315+0.0424448im   -0.00731496+0.24168im      -0.054368-0.00305546im      0.14156+0.0727111im      0.10212+0.00160443im   0.0342336+0.013458im     -0.0495965+0.069644im      0.0876419+0.169816im      0.0679025+0.0656163im      0.163631+0.0292075im   -0.0512722+0.175281im      0.200195+0.177112im      0.184415+0.046988im     -0.0097838+0.117299im     -0.171395-0.0551862im    -0.132048-0.188046im     -0.0196724+0.144969im       -0.158754-0.0405949im     0.0968808-0.114671im      0.0513667+0.0995413im    0.0307435+0.0468081im      0.210853-0.142623im       0.113398+0.159352im      -0.124569-0.245149im     -0.106108+0.102264im      0.0863287+0.0289129im     -0.191968+0.120717im    -0.0129658+0.0850283im    -0.161688-0.00877283im    0.045363-0.184897im
   0.056232-0.0438632im     0.0143575-0.0295515im      0.111848-0.0573487im      -0.10647+0.231036im    0.00301043+0.195637im      0.0129744-0.0204847im   -0.0765038+0.024259im    -0.0171837-0.186816im      0.0277182+0.132496im      0.0440359+0.213332im      -0.139914+0.211326im    -0.00852023-0.185148im       0.15366+0.0132087im    -0.412813+0.0647159im   -0.0216673+0.0973857im      0.031385-0.235127im     -0.161077+0.0354223im    -0.213313+0.106668im       0.199791+0.0339825im      -0.120588+0.122442im       0.143323+0.0769754im    -0.0423557-0.0900087im   -0.0954293+0.0632043im     0.0771106+0.125916im      0.0237505+0.104721im      0.0274179-0.00165538im  -0.0059845+0.00647061im     0.259387+0.0530892im      0.185587-0.070775im    -0.0143521-0.00806086im    0.083187-0.0697058im    -0.136515+0.159032im
  -0.147994-0.0351213im      0.078635+0.0473792im      0.153168+0.0818203im     0.0723566-0.0470383im     0.190779-0.0575049im     0.0347404+0.0731746im     0.104849+0.124441im     0.0266507-0.198873im       0.134271+0.115974im      -0.126958+0.195625im     0.00717679+0.0257276im     0.0662896-0.00207135im   0.0402549+0.273058im     0.0946435-0.0769074im   -0.0390139+0.301344im     -0.0273016+0.135017im      0.134507+0.250741im     0.0880204+0.131594im      -0.124598-0.274897im      -0.0340575-0.131876im      -0.165987-0.000314149im  -0.0936174-0.0696646im   -0.0491419+0.123584im      0.0709728-0.017197im       0.142862-0.0864268im     0.0500842+0.0190805im   -0.0183152-0.0369575im    -0.0916501+0.0582535im      0.278299+0.18868im     -0.0451801+0.157727im      0.038063-0.193356im     -0.119645-0.0852301im
  0.0145944-0.0286003im     0.0661757+0.0648481im   -0.00933555-0.02509im      -0.0103509-0.0295771im   -0.0388715+0.155475im      -0.178355+0.173514im    -0.0325434-0.326501im     0.0800164-0.147253im     -0.0503435+0.0576079im     -0.088843-0.148845im       0.137809+0.28572im        0.114237+0.0229615im     0.329733+0.0247946im   -0.0160812+0.118654im      0.147591+0.0235007im     0.0416467+0.142543im      0.174031+0.0674759im     0.106006-0.0866106im    0.00652352+0.206955im        0.106178-0.0242931im     -0.143556-0.128442im      0.0205672-0.149381im     -0.100381+0.0140999im    -0.0401038+0.144439im      0.0782025+0.134996im     -0.0271637+0.159666im     -0.147624+0.107074im       -0.11727-0.178222im      -0.115046-0.115627im    0.00715975-0.145595im     0.0863746-0.089204im     -0.174881-0.151864im
 -0.0827054+0.041528im      -0.153707-0.224134im      -0.138866+0.223243im      0.0863599-0.0746045im   -0.0424142-0.00551014im    0.0285217+0.208624im     -0.150031+0.059327im     -0.223361-0.0605146im    -0.0687175+0.0390214im    0.00261648+0.1458im       -0.0908127-0.101567im     -0.0923279-0.0342573im    0.0647541+0.21157im       0.027826+0.125747im    -0.0375443+0.0535209im     0.0346838+0.0361428im    -0.213305+0.0706825im    0.0763861-0.0296414im     -0.219555+0.299387im       0.0138637+0.252848im     -0.0727895-0.0415614im     -0.287765-0.060208im     0.0321325-0.192123im      -0.132643+0.0605329im     0.0967985+0.0510476im      0.069991+0.107588im      0.088633-0.248365im    -0.00141735+0.0318422im     -0.168936+0.0366303im    0.0867438+0.0383012im    0.0402992-0.134253im       0.05363+0.0966953im
 -0.0424974+0.00899335im    -0.190126-0.0213927im    -0.0174405-0.00938988im   -0.0404565-0.00572054im  0.00135971-0.0431661im     0.0635984+0.036681im    -0.0131804-0.0733596im   -0.0471479+0.179346im      -0.212951+0.1801im        0.0694672+0.0743993im      0.219646-0.0453841im     -0.143277+0.170077im     0.0989736-0.159827im     -0.240229-0.249836im      0.028652+0.0396191im     0.0959171+0.155464im    -0.0260594+0.15718im      0.0347878+0.012743im      -0.147509-0.117474im       -0.139704+0.0511991im     0.0780486-0.0537091im       0.17722-0.122773im     -0.261155-0.236584im       0.196191+0.0182678im   0.000359143-0.0321857im    -0.0436561+0.00268118im    0.132807+0.145156im       0.115783+0.0035195im     -0.116056-0.0356493im    -0.224082+0.152247im    -0.0822332-0.225428im      0.112009-0.12989im
  0.0180813-0.11604im       0.0652888+0.0936946im     0.0649678-0.122894im      0.0933248+0.0683666im   -0.0673263+0.410356im    -0.00714418-0.119328im      0.241403+0.127933im     0.0305972-0.152354im      -0.196837-0.171616im       0.222578+0.119771im     -0.0236666+0.075358im      -0.111591+0.178801im      -0.10457-0.103418im     0.0143246-0.0928813im    0.0119188-0.0733302im      0.250353+0.140642im     -0.137146-0.12818im      0.0408394-0.0274566im     -0.136269+0.0292071im       0.021361-0.121222im      -0.121689+0.0837998im     -0.186224-0.0350018im    -0.128466+0.0638548im     0.0343733+0.0676092im      0.104964-0.202919im     -0.0864181-0.0993463im     0.103806-0.0503586im     -0.114874-0.170182im     -0.0689318+0.0784972im     0.108589-0.0381617im     0.154794-0.0795625im   0.00442355+0.132268im
  -0.186599-0.0279375im      0.072535-0.0953169im     0.0811203-0.10632im        0.088907-0.0115029im    0.0303844+0.0497935im    -0.0655218+0.0215654im    0.0628902+0.146522im      0.191705+0.25038im       -0.300313+0.047987im      -0.137251+0.0968168im     -0.113534+0.014618im      -0.242938+0.0123802im   -0.0345448-0.184564im    -0.0616852+0.0245683im     0.170212+0.0148965im    -0.0476167-0.0862679im     0.089462-0.109005im     -0.191347+0.0126421im     -0.154746+0.0320998im       0.165159+0.112876im      -0.172583+0.00916028im   -0.0113616-0.0472305im     0.205632-0.0215738im      0.148377-0.197648im      0.0223699+0.158266im     -0.0613977+0.304859im     -0.280332-0.0807288im    -0.0334964+0.0613459im      0.124182+0.0924492im   -0.0803264-0.0602335im   -0.0624818-0.0610432im    -0.084977+0.0264596im
   0.120899-0.0761548im     0.0338458+0.0214984im      0.309112-0.0913227im     0.0774751-0.0633228im    0.0430001-0.124285im     -0.0890725-0.0895572im    -0.107018+0.0866448im   -0.0356811+0.0570499im     -0.210894+0.105595im      -0.101359-0.11681im      -0.0440557-0.13465im      -0.0895844-0.0856736im     0.079615+0.164805im     0.0545342+0.0708017im    0.0701034+0.1093im        0.0658888+0.0711265im    -0.141038-0.0896075im    0.0781607+0.0771696im      0.173027+0.156217im       -0.159144-0.00652445im    -0.172622+0.0927603im     0.0772559-0.220083im     0.0136654+0.208131im     -0.0822952-0.00467425im    -0.191023-0.15687im        0.149478+0.0568324im    -0.158075+0.19977im       0.0450051-0.184582im      -0.102532-0.0388466im    0.0209458+0.275247im     0.0507565-0.0213443im     0.258201+0.127347im
  -0.156396-0.132782im      0.0878501+0.085341im     -0.0714647-0.136209im     -0.0802788+0.0914363im    -0.186026-0.157483im     -0.0995883+0.17253im       0.130611-0.00532773im  -0.0720902-0.0683075im    -0.0390167-0.0276249im   -0.00889999-0.330143im      -0.135911-0.183982im      -0.154945+0.0355718im    0.0823795-0.00797705im  -0.0162344+0.0882997im   -0.0350917+0.182802im      -0.186353+0.0563437im   -0.0979324-0.0545466im    -0.227439-0.010878im     -0.0377917+0.0148486im     -0.0663778-0.0237326im    -0.0541093+0.0955143im     -0.174491+0.191498im     -0.163158+0.101989im     -0.0953047+0.108764im       0.251633-0.201024im     -0.0820374+0.151679im      0.135098+0.204989im       0.184622+0.0615499im   0.000125024+0.0560249im   -0.0803261-0.104731im      -0.17814+0.0050709im   -0.0298966-0.0950147im
  -0.136215-0.0551564im     0.0416346+0.0589806im     -0.206415-0.0299027im   -0.00510951+0.0576072im   -0.0936882-0.00404224im   -0.0233952+0.140387im    -0.0760556+0.131754im    -0.0131135-0.0465023im     0.0163819+0.132758im     -0.0126509+0.0916695im    -0.0215444-0.104379im      0.0109185+0.00609845im    0.138389-0.0399413im    0.0424466-0.308926im    -0.0822154-0.118069im     -0.0628155-0.105433im     0.0225934+0.205616im    -0.0496039+0.0827962im       -0.2062+0.16014im      -0.00663061-0.0302286im      0.168963-0.21528im      -0.0708508-0.111184im    -0.0632772+0.293507im       0.130123-0.0218596im     0.0857586-0.127259im     -0.0247528-0.130709im     -0.351876+0.107736im      -0.109339+0.0497312im    -0.0554319-0.125896im    0.00304018-0.0436546im     0.119311+0.302758im      0.162618+0.121491im
  -0.237175+0.0338772im    -0.0645244-0.00724021im    -0.281244+0.0805593im    -0.0160556-0.108182im     0.0768398-0.0122873im      -0.18993-0.223876im    -0.0680108-0.169705im     0.0978746+0.150066im       0.134778+0.10519im       0.0889163+0.214365im     -0.0262799-0.0160205im     -0.117842-0.0294651im    -0.019097+0.0903148im   0.00570122+0.0471311im    0.0859556+0.0912976im      0.203685-0.00665457im  0.00487258-0.104463im    -0.0781215-0.159702im     -0.0178682-0.129929im    -0.000686265+0.153797im      -0.262399+0.0557647im      0.145104+0.247665im    -0.0347527+0.250116im      -0.117459+0.202304im       0.159209+0.119444im     -0.0241082-0.178142im    -0.0594827+0.0975354im     0.0839499-0.0813073im    -0.0648464+0.0223619im     -0.13694+0.0643826im     0.146538+0.0427841im    0.0626269+0.0807959im
  -0.114716-0.210272im      -0.263898+0.107129im      -0.117033-0.0611722im     -0.127682+0.187157im    -0.0109056+0.0130617im      0.141809-0.067001im    -0.0905412+0.156409im     -0.101395-0.14222im       -0.146912-0.0515009im      0.131404-0.0774944im     -0.223597+0.00815803im     0.364706-0.249781im    -0.0604595-0.0192481im      0.06607-0.00712963im  -0.0137251+0.00990928im     0.111001+0.0195799im    0.0560793-0.0106409im     -0.01682+0.10533im       -0.241488+0.028219im       0.0805696-0.00635821im  -0.00597576+0.0456696im       0.06994+0.154454im      0.133457-0.0477778im     0.0200687+0.00458358im   -0.0629636+0.191695im       0.136271+0.04611im     -0.0463927+0.225643im     -0.0955936-0.258365im      0.0171653+0.00940972im   -0.151572+0.0641157im    -0.100534-0.151804im     0.0266238-0.0831705im
  -0.212482-0.114248im      0.0215065+0.0268175im     0.0324964-0.0631749im    -0.0312074-0.05156im     -0.0751367-0.0521641im      0.124687+0.0770031im    0.0666168-0.0149743im     0.114728-0.10554im         0.10762-0.0547299im      0.121518-0.0410677im     0.0359279-0.06779im      -0.0606908-0.139182im     -0.269454-0.0246495im   -0.0174072-0.078028im      0.277394+0.0705166im      0.188488-0.0821485im   -0.0359347+0.191045im     0.0755584-0.0645126im      0.140593-0.0523583im     -0.0185517-0.190145im       0.151768-0.138794im       0.117688+0.0958033im    0.0583428-0.0300277im     0.0313953+0.15752im       0.0712832+0.030805im      0.0623649+0.40716im     -0.0854266-0.0598322im      0.108553+0.122331im      -0.271812-0.0454422im     0.254858+0.174057im      0.131091-0.0361556im   -0.0153436+0.063356im
  0.0503907+0.0133228im   -0.00127847+0.0639874im      0.111104+0.0189675im    -0.0239428-0.105788im       -0.1373+0.0250669im     -0.101144-0.211983im    -0.0489462-0.0926159im   -0.0759669+0.325258im      0.0902157-0.0145622im     0.0205023+0.178297im     -0.0476086-0.0981671im     0.0679365-0.132454im    -0.0954016+0.103235im     0.0218361+0.323711im     0.0406533-0.140236im      0.0740867+0.202737im    -0.0802091+0.173025im    -0.0761338-0.0153917im     -0.115328+0.0522422im     -0.0191004-0.0764441im      0.226574-0.0177335im    -0.0765476-0.0558794im   -0.0589484+0.0183906im      0.151506+0.0376473im     0.0536288-0.0822058im     0.0325858+0.240453im      0.110095+0.278101im      -0.205843+0.140145im        0.21081-0.0290185im   -0.0320797-0.229207im      0.162144-0.0492887im    0.0513734+0.0180036im
  0.0611596-0.129705im      0.0299828-0.111695im        0.20612+0.0431786im     0.0837062+0.118917im    -0.0103026+0.0369377im    -0.0595661+0.0882367im    0.0218139-0.20647im      -0.130729+0.0866251im      0.115586-0.0350855im      0.131101-0.0237975im     0.0143846-0.0416934im    -0.0972512+0.0440601im    -0.086995-0.316085im     0.0300191+0.0115539im    -0.190447-0.0222287im     0.0578528+0.0127196im   -0.0952499+0.109264im      0.130079+0.251026im      -0.226868+0.0993179im      -0.100603-0.103515im      -0.194519+0.0730704im      0.171535-0.0717116im    0.0893512+0.156351im     -0.0804991+0.211729im      0.0575643+0.278815im       0.243804-0.0645603im   -0.0623891-0.0278474im      0.109844+0.177087im      0.0896709+0.138417im      0.106387-0.0883702im   -0.0712032+0.0957923im    0.0501305-0.158581im
 -0.0245944+0.237017im      -0.142235+0.00775601im    0.0707948-0.247483im      0.0618843+0.124123im     0.0614184-0.0245061im     -0.220086-0.0128305im    0.0699725+0.0125577im   -0.0606488-0.107315im      0.0839614+0.140197im      0.0371587-0.0311881im    0.00336768-0.0978093im     0.0143399-0.299195im    -0.0386941-0.0365094im    0.0144321+0.0425886im       0.1087-0.0764801im    -0.0490725+0.166194im     0.0614676-0.0766408im   0.00891429+0.0979669im    -0.0755258-0.0026974im      0.0950397+0.0487737im     0.0974898+0.248732im     -0.0464732-0.00602185im  -0.0850028-0.0209088im     0.0951193-0.0276911im      -0.10409-0.137091im      0.0571523-0.0944699im    -0.141144-0.226882im       0.105084+0.13727im       -0.290644+0.153472im     -0.168571-0.0589641im     0.303393+0.0258946im   -0.0876015-0.269055im
 -0.0536768+0.0192475im       0.18628-0.419431im       0.127768+0.055253im      -0.141646+0.101368im     0.0724549-0.106993im      -0.185515+0.0254664im     0.132074+0.0453839im   -0.0746744+0.210804im      0.0412466-0.0766887im     0.0126571-0.0454382im   -0.00548046+0.0802865im      0.109944-0.0326718im    0.0276125+0.0155129im   -0.0243073-0.203556im     -0.102944-0.0074099im   -0.00269495-0.178813im     0.0485217-0.0568692im     0.245197-0.106656im     -0.0451795-0.00383837im      0.253245-0.010246im       0.130834+0.0599551im     -0.105417+0.0461684im     -0.25141+0.05677im       0.0513057-0.0602155im     0.0524848+0.0723124im       0.15362+0.18035im       0.151996+0.113019im      0.0741285-0.273785im     -0.0133004+0.138592im    -0.0554676+0.0711804im     0.145944+0.107479im    -0.0180488+0.0941363im
  -0.014151+0.0630521im     -0.090543+0.0975662im      0.119611+0.0890137im      0.260759-0.367486im     -0.136188-0.066328im     0.00535317+0.0133857im    0.0580087+0.0350194im   -0.0749929-0.244096im      -0.108508+0.115184im       0.126473-0.0870436im      0.196968+0.135633im      0.0175631-0.00983271im   -0.028948-0.0256102im    0.0996446-0.0553353im   -0.0603109+0.17203im        0.110812+0.0155525im    0.0139495-0.240313im     -0.206285-0.120171im     -0.0658353-0.0317953im       0.113107+0.108108im        0.16679-0.16653im       -0.104101-0.0432384im    0.0675196+0.125154im       0.209836+0.0800428im     -0.116108+0.167978im       0.164904+0.0491303im     0.144051+0.0630778im      0.188247+0.00425344im     0.129049+0.0822109im   -0.0423122-0.0601488im    0.0420949+0.198431im     0.0811467-0.0413365im
   0.100765+0.135696im     -0.0161372+0.10083im       0.0735659+0.01369im        0.240553-0.0986509im    -0.144204+0.153394im     -0.0713984-0.0632453im    0.0666225+0.0121217im    -0.102445+0.0842594im     -0.117454+0.0351321im      0.108383+0.0979646im    -0.0628793-0.214164im      0.0845312+0.169468im      0.151131+0.07048im      0.0117746-0.0476667im    -0.137552+0.159359im      -0.146292-0.146112im     0.0639791+0.189062im    -0.0610099-0.0349506im    0.00437491-0.101485im      -0.0764987-0.120684im       0.114454+0.218048im      0.0741438+0.0650205im     0.141768+0.113696im     -0.0684553-0.133796im      0.0645002+0.203431im        0.11758+0.0482607im    0.0444456+0.0668319im    -0.0561404-0.0382375im     -0.378307-0.099069im    -0.0561843-0.0224695im   -0.0219246-0.0352306im    -0.349774+0.13399im

and then generate the state $ψ$

psi = P[:, 3]
32-element Vector{ComplexF64}:
   0.21766874093096372 + 0.10609629392815388im
  -0.03085966409631513 - 0.2965190860936163im
 -0.050897843043304705 + 0.09607768062731156im
  -0.08608508050628835 - 0.16820051956865287im
   0.07526408429078357 + 0.03886733463218655im
   0.11645723826784736 + 0.11939756536357682im
  -0.14341515772149102 - 0.054794653077737746im
  -0.09036006801401025 - 0.26191163353796515im
  -0.13481857469501907 + 0.0023046922745435378im
  -0.07889014773413294 + 0.159764282900409im
   0.16181144043342946 + 0.02857207732813323im
   -0.1107935561444555 + 0.21867125190939146im
   0.19042302233483094 - 0.007068100492689328im
  -0.05984010453663136 + 0.04419010972125751im
  0.057657715782064176 - 0.23577996654988104im
   -0.0513299624048755 + 0.021798842139948288im
  -0.23129178497274014 - 0.011388811924581632im
  0.052863249693414605 + 0.15241531435756256im
  0.035553135741382524 - 0.16227507081947012im
   0.30265239654169646 + 0.0im
   0.08030846588685336 + 0.2288241078030373im
   0.04207606320470696 + 0.004274542306098885im
   0.07128381215191992 + 0.04345894983077746im
   0.11114618406320254 - 0.12382717659905201im
  -0.21205062108703915 + 0.08934825930691259im
   0.11944755644615576 + 0.04148074404896479im
 -0.051216686863940875 - 0.012512291202712938im
    0.0531620158920302 - 0.11234378725117178im
   -0.1408765463432669 + 0.010965352019001666im
  -0.06785299640296161 - 0.07462584927268831im
  -0.11801307947604225 + 0.02452595444422155im
 -0.016083173665984375 - 0.05053124740706953im

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.