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.231069-0.124897im      -0.159318+0.0678049im     -0.109712+0.141695im    0.0847892+0.162033im   -0.0529997-0.280835im      0.172669-0.0745698im     -0.216885+0.026518im     -0.0580405-0.0067957im      0.0647342-0.177247im      -0.127984-0.014022im      0.071481-0.0358391im   -0.0783292-0.00590271im   0.00948451+0.043865im       -0.103044-0.0348882im    -0.151377-0.144612im     -0.161714-0.0636987im    0.0870037+0.0435975im    -0.0520233+0.322786im     -0.0839893-0.123598im      0.0153757+0.115706im       0.318637+0.0704118im      0.0427751-0.156118im     0.0794182+0.0928219im     0.0259497+0.14972im       -0.165592-0.0969065im     0.0570424+0.0556543im     0.0467551-0.163814im      0.0316188+0.194294im     -0.0703532+0.147769im      0.0891742-0.0497962im      0.108643+0.0147681im     0.144715-0.102403im
  -0.058111-0.0812229im      0.148117-0.143142im      0.0843076-0.0273008im   0.0277194+0.0167757im   0.0356299+0.0208306im   -0.0879315-0.15805im      0.00985965-0.151039im     -0.0947326-0.0566634im       0.209918-0.103424im     -0.0474578+0.194972im    -0.0728262-0.183996im     0.0766917+0.0319071im    -0.0985377-0.0978904im      0.0704881-0.0129605im   0.00186046+0.153872im      -0.17241+0.043201im    -0.0923571+0.056313im     -0.0393052+0.205074im      0.0957398-0.0203425im    -0.0416311-0.236891im      -0.154639+0.0156816im      -0.176536-0.0214645im   -0.0533325-0.0588524im     0.0370877-0.0818689im     -0.360819+0.0393942im      -0.29454+0.0777244im     0.0207988+0.143045im      -0.173983+0.164162im     -0.0232884-0.0808652im      0.106209-0.151237im      0.0199752-0.163312im      0.263275+0.123397im
    0.11918+0.0401389im     0.0632876-0.152481im      0.0302847+0.0491605im   0.0992032+0.0580294im    -0.14872-0.0601375im     0.043148-0.0240589im    0.00843713-0.0764523im      0.127162+0.366275im        0.148484+0.0081261im   -0.00323696-0.157718im     -0.226579-0.115345im     0.0669543-0.0358321im    -0.0474922-0.000370193im    -0.231592-0.119565im     -0.141938-0.0189127im   -0.0621262+0.0761274im    0.0303281+0.0685024im     -0.117178-0.0786117im     -0.138292+0.07374im      -0.0243445+0.0754762im     -0.021191-0.253402im       -0.313574-0.0346956im    -0.295463+0.0741645im   -0.00290628-0.0427212im      0.137319-0.150436im      0.0737272-0.0659192im      0.190702-0.055586im     -0.0716622+0.0223049im      0.111282-0.192468im      0.0238268+0.103035im      -0.238655+0.0178775im    0.0664709-0.0659517im
 -0.0828839-0.00571643im     0.194218+0.129812im       0.275577+0.0182396im  -0.0766899-0.212286im   -0.0939155-0.312516im      0.277758+0.243805im       0.096773+0.00622794im     0.130315+0.141979im      -0.0142943+0.0256142im     -0.175525-0.0704253im   -0.0845739+0.0366439im   -0.0997933-0.00662547im     0.077634-0.00720772im      0.108773+0.0863542im    0.0399352-0.161256im    -0.0172259-0.00177038im   -0.306212+0.0597572im    -0.0255365+0.0204491im       0.15075+0.029628im     0.00753932+0.0656115im      0.036078+0.0699073im     -0.0650548+0.0495985im   -0.0491948-0.0837742im     -0.215802+0.0291657im     -0.136501+0.296884im      0.0525335+0.0282891im     -0.200086-0.0406578im    -0.0349786+0.149876im      0.0389756-0.0507452im      0.120952+0.100177im     -0.0493837+0.0899093im    0.0458286-0.00951407im
 -0.0346309-0.0160318im     -0.108916-0.234345im      0.0738414-0.0485784im   0.0555183+0.0575575im   0.0839359-0.0315061im    0.0195091-0.0637373im      0.191691+0.00965286im   0.00348661+0.0256095im       0.194977+0.155328im      0.0344283-0.0296855im     0.164463+0.0411953im    -0.354705+0.0264527im      -0.40388-0.0943971im     -0.0526439+0.00907454im  -0.0515824+0.0604217im     0.165575-0.148624im     -0.154569-0.0850201im     0.0106052-0.0937891im     -0.087672+0.141647im      0.0481596-0.0761966im      0.171883-0.119504im        0.130512-0.0144922im     0.106893+0.0757138im     -0.107451-0.0653967im     -0.191333+0.00807012im    0.0104221+0.0146029im      0.067306+0.130102im       0.283037+0.155485im      -0.044307-0.0902276im     0.0323022+0.131153im     -0.0478412-0.107459im    -0.0504809-0.199936im
  0.0655062+0.0495242im     0.0880212-0.0492795im     0.0991352-0.19813im    0.00293415+0.101335im     0.135413+0.0232519im    -0.036018-0.0587056im     -0.177518-0.0999075im       0.18504+0.0170676im      -0.137846+0.0135956im     -0.365112-0.0289669im       0.1229+0.043324im     -0.129179+0.0651106im     -0.155208+0.0657702im       0.232388-0.0235556im   -0.0430851-0.180854im      0.107559+0.0345956im    0.0667942-0.0393763im      0.160113+0.165397im      0.0203022+0.120972im      -0.170667-0.168885im     -0.0977661-0.0827207im      0.0301473+0.042493im    -0.0396362-0.220765im       0.248788-0.110092im     -0.0166515-0.0419076im      0.267143+0.0839011im      0.101459-0.173824im      -0.187825-0.0946864im     0.0933397+0.00295675im   -0.0423527+0.164048im      0.0463731-0.079783im     0.0744989-0.103469im
  0.0832468+0.0818579im     -0.134872-0.133451im      0.0199606-0.0938608im   -0.141478+0.0055932im   0.0676819+0.157536im    -0.0512623+0.107054im       0.158122-0.021425im     -0.0365148+0.223459im      -0.0349048-0.0754187im       0.10096+0.122278im      0.101786+0.0197739im     0.251449-0.0819916im      0.179446+0.0673403im      0.0217513-0.0791647im     -0.22138-0.146791im     -0.212726-0.109044im    -0.0634722+0.122047im      0.0250124+0.0285002im    -0.0925476+0.129877im       0.158489-0.195253im     -0.0181429-0.125566im        0.177171+0.177487im     0.0816215+0.0262594im     -0.227185-0.0308447im     -0.153571-0.139182im       0.265729+0.159638im      -0.224666-0.149427im      0.0918994-0.0121509im     0.0964644-0.039752im      0.0268209-0.0935231im   -0.00457059-0.11999im      0.0942469+0.0702136im
  -0.204298+0.131948im     -0.0481899+0.0111422im     -0.238538+0.140661im    0.0776399-0.0369159im    0.190342+0.0117131im     0.137157+0.0918708im      0.109927-0.110431im       0.244964-0.251239im       0.0404762-0.104463im     0.00150631-0.0620102im   -0.0870658-0.0722678im     0.275786+0.055372im     -0.0879558-0.0832346im      0.0977015-0.0480369im    -0.153062-0.00977088im   0.0921306+0.222085im    -0.0581215-0.0689372im    -0.0831648+0.146579im      -0.258876-0.117683im      0.0983052+0.0127114im     0.0262859-0.129385im      -0.0802107-0.00589317im   -0.026314-0.14522im      0.00753325-0.155011im      0.0241848-0.00423382im     0.112572+0.148006im      -0.141513+0.15273im       0.0391501+0.0838904im     -0.183489+0.200924im       0.149119+0.170192im     -0.0600744-0.00161947im   -0.114835-0.0315108im
     0.1526+0.0450639im     0.0357194+0.0060607im     -0.275115+0.0577619im  -0.0926617+0.199096im    0.0905161+0.211226im      0.142739+0.186809im       0.041743+0.184913im    -0.00388326+0.13968im        0.0302979-0.227317im     0.00861791-0.139961im    -0.0194925+0.0289937im   -0.0317761+0.151681im    -0.00476838-0.122909im       0.0164036-0.0920068im    0.0662797+0.247105im      0.125722-0.215976im    -0.0245809-0.0881359im     0.0571605+0.0782768im    -0.0465501-0.0875847im      0.035392+0.0182518im    -0.0524827-0.035915im       -0.111258+0.178612im     0.0856017-0.233591im     -0.0273952+0.0409383im    -0.0114901+0.219464im    -0.00288313-0.118536im      0.0790759-0.046525im     -0.0534342+0.0431141im      0.231913-0.181596im       0.219562-0.117334im       0.220015+0.0838053im    0.0173077-0.107379im
  -0.219449-0.178867im       0.174771-0.0958615im     0.0395155-0.133331im   -0.0837112+0.0526634im   0.0668336+0.0975632im    0.0728297+0.0512942im     0.0310722-0.0656516im      -0.25464-0.0968355im      -0.126455+0.0680213im    0.00658143-0.195587im    -0.0395005+0.0368176im   -0.0328151-0.156266im    -0.00144533+0.0854652im     -0.0232972+0.0351663im    -0.108063+0.0332368im     -0.13056-0.161862im    -0.0407535-0.0512516im     -0.142368+0.0087579im    -0.0909216-0.129669im     -0.0705747+0.122863im      -0.190968+0.229798im       -0.158745-0.0224208im   -0.0636036-0.104247im       0.255919+0.0892711im    -0.0916706-0.111258im       0.132939-0.0573048im    -0.0717198-0.163337im       0.328937-0.0924158im    -0.0710746-0.00209529im     0.244379-0.0583728im      -0.18721-0.086976im     0.0204187-0.14993im
  -0.183899+0.0123299im   -0.00609253+0.00520566im    0.0113412-0.134146im     0.196698+0.268535im   -0.0503228-0.195175im    -0.0124705+0.116584im      -0.128505+0.15637im       0.0359948-0.0582071im       0.127744-0.0549345im      0.171771-0.109581im       0.18693-0.101939im    -0.0525699-0.188538im    -0.00046652-0.0380059im     -0.0451064+0.0607583im    0.0388329+0.0775515im   0.00443502+0.158747im     -0.238409+0.248694im       0.121264+0.000686712im    0.147893-0.0706909im      0.279091-0.225563im     -0.0802308+0.0200716im     -0.0619098+0.0955704im    0.0192865-0.0717315im   0.000470885-0.148322im       0.240615-0.0737568im     0.0281432-0.153788im      0.0932416-0.250954im      0.0867455+0.031511im     -0.0773008+0.0774665im     0.0303082+0.0510062im       0.10468-0.0535197im    0.0853439+0.10809im
  -0.352385-0.246334im     -0.0131053-0.010784im     -0.0780744+0.0302746im  -0.0898342-0.0707005im  -0.0529344-0.0572123im    0.0693302+0.0879353im    -0.0951877+0.00102568im   -0.0952425+0.0834995im   -0.000539593-0.0309552im    -0.0230065-0.0212128im   -0.0631812+0.0091978im      0.28982+0.0246738im     -0.208998-0.0886304im       0.346303-0.143625im     0.0173013+0.0376475im   -0.0533208-0.0522018im    0.0798013+0.0499117im      0.050393+0.0921325im    -0.0513613+0.205847im      0.0933719+0.0221369im   0.000583489-0.0173077im       0.248404-0.0154082im    0.0295118+0.166386im      -0.121473+0.108225im      0.0629371-0.0652982im     -0.198912-0.234399im       0.125236-0.0942747im    -0.0864984-0.110726im      0.0873309+0.011472im     0.00394451+0.183479im     -0.0504214+0.0376863im     0.140709-0.239672im
 -0.0773396+0.0818948im    -0.0506745-0.0868733im     -0.080151+0.0409523im  0.00519379+0.0706531im    0.154176-0.043121im     0.0913138-0.120447im      -0.242118-0.0998857im     -0.175722-0.0822458im      -0.156384+0.0265847im    -0.0281021+0.0972004im    -0.331364-0.0330942im    -0.172691+0.0835003im       0.27745+0.00738496im     0.0305297+0.135671im     -0.222502-0.0282106im     0.034733+0.0101759im    -0.152027-0.0418045im    -0.0413779-0.0293994im    -0.0225053-0.134801im       0.155159-0.151659im      -0.104462-0.109342im        0.109044-0.0845606im   -0.0717182-0.135406im      -0.160774+0.0400366im    -0.0366346-0.0304368im     -0.194935+0.100102im      0.0798572-0.0995535im      0.152132-0.00831768im    0.0803092-0.261128im      -0.224435+0.190797im       0.086159+0.12714im     -0.0764002-0.107836im
  0.0934643-0.216033im    -0.00578296+0.0486478im     -0.124964+0.108794im   -0.0758475+0.0412462im   -0.192415-0.150925im    -0.0443379+0.053525im       0.183735-0.167646im    -0.00964726-0.0202897im       0.066248+0.0962931im    -0.0569414+0.107261im    -0.0173933-0.0152813im   -0.0400822+0.0705097im    -0.0862521-0.224859im       0.0335027-0.0841533im   -0.0152496-0.0982324im    -0.145578+0.207907im     0.0623892-0.0266251im      0.206275-0.106809im      -0.053175+0.0418794im    -0.0898547-0.106868im      -0.090575+0.243271im      0.00644822+0.00907347im    0.194576-0.186722im      -0.042101-0.170195im      0.0599152-0.175101im       0.010042+0.197176im       0.139567-0.075759im       0.177838-0.0358539im     0.0972791-0.122856im        0.13932-0.0903149im    -0.0524721+0.386588im     -0.091521+0.0811727im
  -0.101797+0.125966im       0.145612-0.0638306im     -0.134174-0.0181816im   -0.226929+0.0404092im   -0.152304-0.222613im      -0.27702-0.186182im     -0.0847178-0.0377872im      0.203668+0.005644im       -0.128466-0.118541im       0.144812-0.296219im      0.116535+0.0191998im    0.0395596+0.019797im      -0.062971-0.135761im      -0.0249441+0.0622198im    0.0629644-0.212728im     -0.107277-0.215434im       0.16102-0.201986im       0.154049+0.0986306im     0.0466934-0.115242im      0.0474186-0.00401988im   -0.0779286-0.0089271im     -0.0896677-0.0598734im    -0.181393-0.00666069im    -0.266572-0.107744im      -0.196647-0.0172031im    -0.0172443-0.127348im     -0.0578229+0.0572816im      0.114314-0.052786im     -0.0474222-0.0229859im    -0.0574239+0.00433748im    0.0912267-0.0056309im   -0.0914614+0.0383759im
  -0.068116+0.0188854im    -0.0741085+0.251408im       0.153079-0.242981im    0.0487394+0.0428879im     -0.1169-0.143608im      0.114582+0.0167648im     -0.017587+0.0244219im       0.19041+0.0141137im      0.0637588+0.0933343im     0.0678285-0.0576537im    -0.112398-0.0723308im     0.117484-0.0431708im      0.077296+0.142508im       -0.125613-0.246517im     -0.095559+0.0681005im   0.00901729-0.250472im     -0.083395-0.0708779im      0.114353+0.0379773im     -0.297677-0.0961496im     -0.197727+0.0104877im   -0.00213446+0.0358235im       0.110943+0.282737im     0.0978982-0.0237326im      0.187822-0.0916205im     -0.135519-0.0417977im     -0.195546+0.0236073im     0.0600491+0.161467im       0.105063-0.114923im     -0.0330604-0.0583999im     -0.149574+0.125336im         0.1407+0.0617374im     0.117263+0.131213im
  0.0153679+0.0335165im        0.1923-0.0792929im   -0.00238958+0.199513im     0.138442-0.110664im    0.0243124-0.109256im    0.00716594+0.0387188im    -0.0505205+0.0170731im      0.118142-0.0891189im     -0.0584696+0.0834173im      0.112162-0.0866926im     0.106524-0.00905346im  0.00173537-0.0215387im       0.24317+0.105626im        0.306153-0.102735im    -0.0852841+0.109692im    -0.0394529-0.0141499im     0.299675+0.00755751im   -0.0636763-0.207474im       0.172223-0.00636315im     0.150592-0.0777553im      0.272164-0.0764607im      0.0456495+0.237533im    -0.0159426-0.011726im       0.132313-0.00676162im    -0.214963+0.0646456im     0.0411591+0.0690882im       0.32812+0.00624841im    0.0773458-0.0232109im     -0.134419-0.168941im       0.152987-0.0435539im     -0.102511-0.0220374im   0.00450076+0.0395413im
   0.160599-0.0619919im      0.254551-0.159766im      -0.208135+0.0131301im   0.0495369-0.134312im    0.0317197+0.0625577im      0.18262+0.172098im       -0.15239-0.230582im      0.0244754+0.124793im      -0.0222582-0.00366545im  0.000527411+0.0635443im   -0.0124004+0.012719im      0.169414-0.123663im     -0.0869235-0.0861465im      -0.129763+0.086157im     -0.130876-0.0488596im     0.187433-0.184249im     0.0224579+0.0567736im       0.12802+0.0159984im      0.047812+0.0436412im    -0.0732299-0.184636im       0.112018+0.0368544im     -0.0691848-0.16309im       0.159832+0.206718im       0.144602-0.153516im      0.0161604+0.251249im      -0.171218-0.0365276im    -0.0657018-0.196929im       0.155709-0.0961693im     -0.051688+0.0461987im    -0.0837692+0.0643502im   -0.00888514-0.0615007im    -0.136558+0.218525im
  0.0350229-0.0767332im      0.134255+0.250895im      0.0636839-0.0776159im  -0.0777576+0.210306im     0.174455-0.14642im     -0.0793821+0.00857576im    0.0440587+0.0430824im     -0.174548-0.216963im        0.260491-0.128707im     -0.0893689-0.10452im      0.0175981+0.378252im      0.126958+0.00406202im    -0.100307+0.0712133im     -0.0664079+0.0688718im    -0.148469-0.0594946im    0.0619416+0.0291046im    0.0845064+0.0206282im     0.0887466-0.149112im     -0.0162791-0.179957im    -0.00727084-0.133777im       0.141995-0.212545im     0.000675253+0.0316219im   -0.0199064+0.0778702im    -0.0338121-0.0594199im     0.0291019+0.0626384im    -0.0992892+0.0397652im     -0.189115-0.03377im       -0.136386-0.127694im     0.00826993-0.1986im       -0.0313135-0.126524im      -0.261877+0.0747764im    0.0493469-0.0877081im
  0.0356944+0.0319174im     -0.194445-0.0621041im    -0.0131662-0.166681im   -0.0655564-0.0133837im  -0.0549575-0.223113im     0.0193885-0.0695392im      0.187488+0.171423im     -0.0295081-0.140276im       -0.129642-0.248423im      0.0219853+0.0797847im    -0.118607-0.166301im     0.0997401-0.0458798im    -0.0725335+0.0124476im     -0.0110914+0.0854497im   -0.0189508-0.0652172im    0.0598356-0.0588491im    0.0901218-0.213974im      -0.230546-0.126178im     0.00107172+0.258581im       0.202255-0.220263im       0.120759+0.252823im       -0.147152-0.102737im    -0.0401029+0.0698638im      0.226206-0.0634648im      0.088694+0.167963im       0.113567+0.0235333im    -0.0666447+0.0462057im    -0.0282024-0.111844im      0.0413478-0.19276im     -0.00116898+0.078724im       0.104236+0.0775442im     0.177837-0.0471697im
   0.187402+0.00617114im    0.0380854+0.0124521im      0.179429-0.0347809im   -0.138708+0.0416034im    0.213197+0.110812im     0.0175729-0.169009im     -0.0766521+0.0993822im     -0.194033+0.155587im          0.1403-0.0860944im    -0.0821337-0.11407im      -0.124752-0.130309im      0.106228-0.0583774im      0.071344+0.0665192im       0.103526+0.0315396im    0.0359938-0.21807im      -0.110751+0.212909im      0.114347+0.0168264im     0.0664077-0.237508im     -0.0786391+0.103426im      -0.120851-0.0415557im     0.0145864-0.000351834im   -0.0494891+0.0814269im      0.12237-0.0522104im    -0.0533251-0.126041im    -0.00410637+0.06195im       -0.088667-0.291041im    -0.00289325+0.0794396im      0.147672+0.126851im       -0.29535+0.100447im       0.164663+0.164142im        0.23981+0.0445655im    -0.108346-0.0807464im
 -0.0622768-0.174499im      -0.108527-0.00229519im   -0.0141628-0.110534im    -0.214091-0.262862im   0.00621233+0.0423592im   -0.0765895+0.186565im      -0.187097+0.241898im     0.00584263+0.0610744im      -0.166539+0.0311278im     -0.111915-0.236087im    0.00313377-0.102501im    -0.0387775-0.0101764im    -0.0496912+0.085278im      -0.0682745+0.0579692im    -0.142393-0.0144477im     0.127953+0.0543169im   -0.0675535+0.191657im      0.0485411+0.0802751im     -0.136868+0.00466305im    0.0486674-0.0531988im     0.0386236-0.0516871im       0.142856-0.255052im    -0.0459961-0.0350427im     0.0243644-0.154648im      0.0440575-0.0810877im    -0.0280436+0.0764949im      0.126219+0.212839im     -0.0945502+0.0840625im     -0.172291-0.262271im       0.145143-0.311733im      0.0317376-0.0109888im   -0.0692066+0.116358im
  0.0465129+0.0017711im     -0.148845-0.169373im      -0.203351+0.0310906im   0.0824223-0.122851im    -0.098426-0.0237684im      0.15137-0.131738im      0.0765986+0.188655im      -0.136426-0.00979405im      0.174973+0.11369im       0.0627478-0.102691im      0.147518+0.0165612im     0.229659-0.0496149im      0.119488-0.071706im      -0.0425899+0.122309im    -0.0857696-0.312876im      0.226579+0.0325779im    -0.186308-0.0815062im      0.174415+0.0921029im      0.234338+0.159737im     -0.0995871+0.0881245im     -0.105407-0.0835851im      -0.045364+0.124443im    -0.0451231-0.231622im       0.127607+0.20424im      -0.0983968-0.0312896im    -0.0998938+0.0286666im     0.0600474+0.057573im     -0.0182477-0.121126im      -0.147678-0.0125636im    -0.0839493-0.0935623im    -0.0912242+0.0666518im    0.0998346-0.10685im
   0.182184+0.106449im       0.145474-0.19653im        0.172135+0.0902624im  -0.0806588+0.132465im   -0.0305539-0.0538511im    -0.207642+0.367349im      0.0586942+0.0739528im     0.0212971-0.148731im       0.0643006-0.124015im       0.134287+0.0985412im    -0.239755-0.0809598im    -0.117385-0.0364798im    -0.0390591-0.0273767im      0.0928162+0.0134113im   0.00799183+0.0615984im    -0.059961-0.139973im     0.0454516+0.135026im      0.0874656+0.205017im      0.0792847+0.220981im     -0.0311702+0.159231im       0.111716-0.141911im        0.116407-0.0444704im     -0.11693-0.192994im       0.182352+0.027307im      0.0639045-0.163237im      -0.122402-0.0100022im     -0.209477+0.0255905im     0.0824998-0.0714065im     -0.172468+0.0242815im    -0.0871696+0.0194052im     0.0094584+0.158901im    -0.0447406-0.0597006im
 -0.0310122-0.0387252im     0.0488681-0.115929im      0.0685382+0.0381403im    0.192268-0.10075im    -0.0224721-0.0700805im      -0.1438+0.0678031im     -0.128111+0.0314201im     -0.026171-0.0503329im       0.133334+0.00201751im    -0.312276-0.0780658im    -0.193838+0.0611621im     0.150873+0.03047im       0.0369052-0.138715im       -0.156596-0.211676im    -0.0219894+0.00481858im  -0.0171369-0.186446im     0.0508835+0.134327im     -0.0719233-0.0395282im      0.198359-0.0585232im        0.1586-0.0107767im    -0.0421512+0.155746im       -0.117943+0.0241765im     0.359392-0.128976im      -0.102449-0.026809im      0.0274494-0.0772094im      0.234059-0.0139803im    -0.0102519+0.251521im    -0.00499377-0.0714185im    -0.0179256-0.0128509im     -0.224575-0.0405822im     0.0662933-0.155426im     -0.120724-0.215423im
  0.0144378+0.197375im     -0.0471642-0.0493847im     0.0455657-0.0250359im     0.25497-0.079687im    -0.108792+0.00795983im   0.0179289-0.000490018im  0.00109015-0.0185816im      0.127549+0.0485912im       0.182946+0.00634636im     0.171461-0.0512796im    -0.204134+0.314581im    -0.0100727-0.0225443im    -0.0496376+0.0746842im       0.319763+0.157854im     -0.190637-0.0818586im    -0.141124-0.108245im    -0.0325328-0.179831im    -0.00311498-0.0947018im     -0.157482-0.00956727im  -0.00431562-0.037599im      -0.120206+0.0968311im       0.110089-0.248053im      0.107016-0.122063im      0.0776518-0.0504649im     0.0817627+0.0392061im     0.0326459-0.216268im      0.0712003-0.0532326im     -0.074638+0.219063im      0.0399619+0.0693457im    -0.0651899-0.317941im      0.0122862-0.00564489im   0.0494742+0.0353496im
   0.162203+0.222777im       0.218218-0.0331662im     0.0422758-0.0646189im    0.008568-0.16315im      0.173286-0.13737im       0.104355-0.0984249im      0.228595+0.190494im     -0.0504604+0.0142867im      -0.138431+0.0110186im     0.0856605+0.0139093im   -0.0270812-0.0878551im    0.0816372+0.0299435im     -0.323984+0.0740233im       0.016574+0.0548765im    -0.218392+0.149783im     -0.100369+0.249366im    -0.0286811+0.00874912im   0.00766923+0.166822im        0.14087-0.208042im     -0.0342123+0.269012im     -0.0900308+0.0200193im      0.0586036-0.00240404im    0.203391+0.11955im       -0.103056-0.0478414im    -0.0214748-0.0678902im     0.0602357-0.0329155im      0.134325-0.108685im      0.0151875-0.218582im    -0.00650633-0.135265im       -0.10606-0.0196849im      0.132629-0.00692745im   0.0386296+0.0158142im
 -0.0948235-0.135125im       0.169842-0.07368im       -0.313342+0.0917021im   0.0145679-0.0741134im   0.0866837+0.0105088im    -0.156784-0.143933im      0.0850223+0.169831im     -0.0360244+0.0703445im     -0.0826407-0.00159873im   -0.0436229-0.0987217im    -0.215423+0.190089im     -0.130332+0.0952966im     -0.152697+0.195993im       -0.136686-0.232793im     0.0057021-0.0664947im   -0.0916306+0.0432731im    -0.111641+0.0921732im    -0.0429194-0.0386897im      0.103019+0.0198965im     0.0446899-0.139837im    -0.00617771-0.0784113im       0.132605+0.0747536im   -0.0221284-0.0126122im      0.172391+0.12513im      -0.0657597+0.060022im       0.143157-0.107546im     -0.0914073+0.0567013im       0.04656+0.155798im    -0.00677957+0.149365im     -0.0902981+0.125491im       0.010141+0.255945im      0.183578+0.314181im
  -0.102034-0.157757im     -0.0376068-0.193981im      0.0776496-0.0506225im    0.118101+0.0166684im    0.153032+0.0215492im    -0.077175-0.0558584im      0.219798+0.0605246im      0.109751-0.245631im       -0.134889-0.0245095im      0.159256+0.0097647im  -0.00557124+0.0330289im   -0.0426294-0.135657im       0.121264-0.0850781im      0.0337861-0.094235im      0.040549-0.224214im    -0.0152906-0.0758838im    -0.115311+0.343445im     -0.0273136-0.0153572im     -0.213819-0.0287678im     -0.202293+0.00750791im     0.113609-0.0839133im      -0.227825-0.109678im     0.0992221+0.068506im     -0.0666993+0.05234im       -0.176422+0.0961963im    0.00460365-0.105092im       0.169792-0.113433im      -0.235622-0.115777im       0.117951+0.0113834im    -0.0128381-0.0344258im      0.138301+0.181835im     -0.181563-0.0456288im
 -0.0225987+0.0833348im    -0.0438286-0.0223485im      0.209179-0.222818im     0.255201-0.0348184im    0.184798+0.126963im     -0.128661-0.0910224im     0.0773024-0.108987im    -0.00334158+0.0669923im      -0.238141+0.0749948im    -0.0952236-0.103802im       0.03231-0.0328427im     0.190557+0.113301im      0.0307219-0.128002im       -0.131101+0.0480712im     -0.10701+0.196593im      0.012933-0.168631im      0.031103-0.0743798im      0.225639-0.00333485im     0.112101-0.00498605im    0.0572375+0.00266176im     0.268779+0.0746574im     -0.0384062-0.119365im    -0.0315502-0.140345im      -0.171015+0.106354im       0.113658-0.0322043im    -0.0813197+0.0113337im     0.0227818-0.0524743im     -0.018276+0.108833im      -0.101344+0.1225im         0.162425+0.0322926im    -0.0968208+0.331619im      0.215785+0.0330781im
 -0.0570377-0.139742im     -0.0327774-0.0307177im    -0.0252064-0.0637587im    0.229457+0.0357265im  0.00655646+0.132431im    -0.0700978-0.0414356im      0.152206+0.0919773im    -0.0431858-0.0189112im       0.301527+0.116954im      -0.171018-0.094085im    -0.0406705-0.0378543im     0.071316-0.320183im      0.0839378+0.16757im          0.17565+0.038384im     0.0972155+0.0247719im   0.00536052+0.00530351im    0.192765-0.0850433im     0.0198767+0.350613im      0.0720028-0.0546408im    -0.0738452+0.03078im       0.0598772+0.0145517im      0.0579739-0.119927im     -0.171326+0.0351446im     -0.157925+0.00662228im     0.112637+0.139982im       0.107757+0.0916441im    -0.0392294+0.0446083im      0.205062+0.0126369im      0.170325-0.232643im    -0.00436511+0.121641im       0.138247+0.0526562im      -0.1092+0.195874im
   0.160561-0.0318399im     0.0307927+0.233052im     -0.0216587+0.0440552im      0.1677-0.0596486im    0.012743+0.155697im    -0.0441889+0.0492037im    -0.0450027+0.0410892im     0.0169078+0.0587923im     -0.0709321+0.222171im      0.0753874+0.226225im     0.0958408+0.0281579im    -0.151386-0.155369im      -0.180095+0.0704867im    -0.00625026-0.171626im    -0.0237567-0.24607im      0.0157013-0.0942824im     0.165973+0.079836im      -0.147021+0.108973im      -0.109443-0.0421566im      0.312718-0.00391913im    -0.217406-0.0214247im      -0.121691-0.0319761im    -0.076476-0.142702im       -0.15896-0.104837im     0.00558548+0.204249im      -0.131603-0.00380913im   -0.0176494+0.0416312im     0.0314384-0.191328im      -0.206197+0.0198323im     0.0351526-0.0200218im   -0.00549123+0.138133im      0.220595-0.16168im

and then generate the state $ψ$

psi = P[:, 3]
32-element Vector{ComplexF64}:
    -0.2033346869585067 - 0.061519452261437686im
     0.3251068655530197 + 0.0im
    0.03334379352722254 - 0.05773221769849324im
    0.07958086018535453 + 0.19640235307364595im
    0.02888773434078068 - 0.14991306123396259im
    0.10561698142749107 + 0.01754552365128968im
  -0.027698403861219984 - 0.06505383722988169im
    0.04603596597873679 + 0.07070248281432384im
   0.009628709173791638 + 0.04676357615707313im
   -0.11091504404657769 + 0.26467677469998035im
    0.12465968731314483 + 0.004132273051938208im
  -0.013904825166122188 + 0.08335783645537884im
     0.2945913625146499 + 0.024327562162916667im
     0.1215545603644323 - 0.13093194411822215im
   -0.12036025901601137 + 0.09919748897730228im
    -0.2587391171615193 - 0.059853563032745666im
   -0.12001967094323193 + 0.28658267930939535im
    0.03617656030030113 - 0.02579642062921845im
   -0.01493661123757938 - 0.05370378317170016im
    0.13717610318171253 - 0.18353628385735973im
 -0.0016013026301029236 + 0.09981882897396879im
    0.12414129873518111 + 0.05292123689564562im
       0.07505409966426 + 0.19255962333668236im
    0.12386792328886673 - 0.06362996505147879im
   -0.09419397903654027 - 0.08463878114370679im
   -0.07284326241902189 + 0.2894661686019308im
    0.13099185832042815 + 0.03911058608171358im
   0.009043056351700406 + 0.03330634844885166im
   0.027541958421615994 - 0.019992026421193538im
     0.1287905859836585 + 0.078745874525378im
   -0.16717462531553792 + 0.02760496169332399im
   0.010739535477543456 - 0.09626400684255601im

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.