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.0623748-0.251714im    -0.0435482-0.0113538im      -0.11829+0.0662036im    0.0423142-0.112081im     -0.132351+0.0748613im     0.108783-0.0343522im     -0.122276+0.146358im    0.0727294+0.206451im     -0.0508846-0.0659895im      0.188831+0.155014im       0.135021+0.098236im     -0.0168614+0.0231088im    -0.229099+0.0732297im   -0.0350773-0.0675626im    -0.0462876+0.0874507im      0.120745+0.144634im   -0.00279579-0.00119219im     0.0519571-0.102463im     0.0936623+0.153229im      0.122759+0.100409im       0.109956-0.0124798im      0.167575+0.0886802im   0.00302753+0.011044im      0.125559+0.107538im       0.216003+0.224349im      0.0920418-0.302057im     -0.0483102+0.159627im       -0.10444+0.308924im      0.0663373-0.138117im     0.0535422+0.00150852im     0.140688+0.195546im       0.0711948-0.082154im
   -0.03324-0.108571im      0.140873-0.266692im     -0.0959556+0.109447im    -0.0175541+0.262164im      0.192744+0.133405im    -0.0352054+0.0417614im    -0.0769922-0.285315im     0.121782-0.062826im     -0.0669789+0.116849im      0.0411533+0.146699im      -0.175574+0.138907im     -0.0891706+0.16273im     -0.0464698+0.342806im     0.0306761-0.0821842im     -0.140388+0.053612im     -0.0689311-0.0132894im   -0.0185294+0.111468im       0.0185577-0.00424441im  -0.0378347+0.116329im    -0.0304034-0.151821im      -0.128706+0.232094im     -0.0480917-0.105084im     0.0447518-0.0810775im   -0.0390701+0.0747123im      0.274376+0.109181im     0.00218236+0.147632im      -0.120343+0.18249im       0.0806882-0.145783im    0.000238291+0.0199721im     0.098605-0.0106878im    0.00959929-0.061782im       0.0926668+0.047511im
   0.174767+0.104487im    -0.0181561+0.140504im      0.0479685-0.468597im      -0.03296-0.106261im     0.0586494+0.0692554im    -0.148539-0.0349493im     -0.152121+0.0725033im  -0.0859918+0.125708im     -0.0990496+0.0152396im      0.158787-0.122898im       0.276716+0.0387134im   -0.00886416-0.121508im      -0.10351+0.284639im     0.0852841+0.0425322im      0.015354-0.0911113im    -0.0183684-0.0882299im     0.117347+0.231577im      -0.0500228-0.063386im     -0.121735-0.0530849im    0.0575904-0.137397im    -0.00877379+0.28731im      -0.0612132+0.0480404im    0.0780713+0.00998012im   -0.127027-0.0339143im      0.141114-0.0434598im      0.172979-0.0259765im    -0.0136156-0.154173im     -0.0467139+0.0326381im     -0.144243+0.0274767im     0.128505-0.0786721im    -0.0296043-0.00193665im    -0.0983614+0.0034952im
  0.0367766-0.0644516im   -0.0550099+0.211704im      -0.039546+0.0537018im   -0.0563649-0.489951im     0.0260463-0.0569616im   -0.0475736-0.0823715im     0.0882204+0.16472im    -0.0452532+0.0518816im     -0.117888+0.0275127im     0.0734266+0.221709im      -0.136287+0.0616902im     -0.138713+0.0271371im     0.101325+0.0168612im   -0.0215557+0.199885im    -0.00139231+0.196055im      0.0855462+0.0964525im   0.00110114+0.0765531im       0.142533+0.192094im      0.133662+0.145693im     -0.197697+0.0345301im   -0.00560274-0.012287im      0.0366214-0.200121im     0.0292904-0.113482im    -0.0659329+0.13591im        0.125763+0.00333181im    0.0239186+0.261596im     -0.0132511-0.0638911im     0.0491856-0.154068im      -0.234035+0.0526956im  -0.00435297+0.0392888im   -0.00171893+0.0780114im      0.0361508+0.162577im
 -0.0748981-0.0586072im   -0.0593625+0.145658im     -0.0755087-0.0570938im     0.201368-0.00357791im  -0.0427167-0.363075im    -0.0596767+0.180651im      0.0929754-0.0955756im    0.123246-0.0776232im     0.0510814-0.0555265im     -0.087422+0.081321im       0.125025-0.10281im      -0.0678025+0.0413962im    0.0461297+0.0317015im   -0.0982754-0.133089im       0.041301-0.0235355im    -0.0706124-0.0985411im   -0.0127013+0.048329im        0.254884-0.187411im      0.296479+0.00650289im    0.255865+0.136458im      -0.141836+0.0984225im     0.0123357-0.0282484im     0.356985-0.0514694im    -0.019177+0.00907747im    0.0135604-0.069693im       -0.14772+0.135306im      -0.102763-0.0812726im     0.0267528+0.0850918im     0.0747461+0.0714378im      0.26048-0.032228im      -0.112972+0.0798798im     -0.0116211-0.0536429im
   0.102658+0.0229063im   -0.0869922-0.102528im      0.0799222+0.227271im      0.128386-0.0459993im    0.0645196+0.0792021im    -0.030691-0.341302im    -0.00684339+0.187337im     0.228158-0.0910246im     0.0575553+0.0141552im      0.168859+0.126785im     -0.0771409-0.0564688im     0.0471036-0.232078im    -0.0568167-0.0881122im     0.180298-0.0437866im      -0.09137+0.0737052im    -0.0553702-0.277212im      0.104964+0.000413545im    0.0297442+0.109091im     -0.138407-0.0224899im     0.139686+0.0452508im      0.120952+0.119037im     -0.0922362-0.127658im       0.12882-0.199835im      -0.07824+0.0615085im     -0.195636-0.0894374im   -0.00718591-0.0129392im     -0.229972-0.00987543im    -0.150666+0.0671294im      0.133078+0.0927122im     0.152595+0.0503079im      0.188775-0.109052im      -0.0835093-0.00852619im
   0.184109+0.102166im     0.0123303+0.0190106im    -0.0482406+0.175711im     0.0103169-0.142497im     0.0921201+0.219295im     -0.153075-0.11246im       -0.102151-0.480023im    0.0505747+0.0794868im     -0.311983-0.067867im     -0.0783114+0.0424299im      0.218987-0.0568667im      0.047399-0.043217im     0.0514844-0.148496im     0.0183171-0.103165im      0.0345118+0.153567im      -0.130506+0.203959im     0.0644192+0.121207im      0.00248289+0.058776im    0.00129734-0.134378im      0.101988+0.103238im       0.179311-0.0427905im    -0.0193149+0.120449im    -0.0251421+0.14044im       0.124945+0.0615981im   -0.00350113-0.14559im       -0.181778+0.0944324im   -0.00315752+0.0806148im   -0.00552812+0.147098im      -0.120264+0.0971311im    0.0470154+0.0100344im    -0.0623215+0.0415697im      0.0187199+0.0364178im
 -0.0439637+0.135839im     -0.123927+0.173658im        0.17399-0.0681361im   -0.0554069+0.0880913im   -0.0576635+0.187005im    -0.0138697-0.147935im      -0.145605+0.036379im    0.0932685-0.251859im     -0.0082896+0.063286im      -0.240689-0.112412im       0.227965-0.0439638im     -0.142937+0.223148im     0.0993016+0.0274685im     0.171621+0.00910698im    -0.171376+0.280724im      0.0691646+0.151474im    -0.0123455-0.084549im       0.0433246-0.0222652im   -0.0130541+0.0553554im   -0.0456913+0.0391652im      -0.22682-0.0774966im   -0.00693278+0.0394543im   -0.0548129-0.201996im    -0.0290326+0.00711145im    0.0808702+0.112834im     -0.0817831-0.0896015im     -0.145234-0.0877409im    -0.0803714-0.0948072im      0.188112+0.134122im     -0.043775-0.0874115im     0.0425981+0.268173im       -0.149826-0.0295878im
 -0.0653617-0.189296im       0.15622-0.0317929im      0.169967-0.139122im     0.0435504-0.0317686im   -0.0631715-0.0158255im   -0.0293956+0.14011im       0.0174477-0.0107642im    0.128546-0.0469072im    -0.0373903-0.126179im      -0.110211+0.119101im      -0.253383+0.00857095im   -0.0811139-0.179126im     0.0371869+0.179819im      0.228594+0.158359im     -0.0583563+0.11858im       -0.192351-0.112147im      0.143438-0.022147im       -0.180426+0.111222im    -0.0200879-0.0326701im     0.156648+0.182537im    -0.00813489-0.112407im     -0.0488632+0.0461684im   0.00786671+0.162952im      0.146123-0.050055im       0.184229-0.151714im    -0.00864597+0.111137im       0.269339-0.0726845im      -0.22281+0.039412im       0.142162-0.0605221im   -0.0961031-0.199518im      0.0794604+0.185503im      -0.0501568+0.0847698im
  -0.169648+0.0983992im   -0.0212222-0.00611737im   -0.0948256-0.0346911im    0.0391152+0.0429737im   0.00849092+0.109423im    -0.0470214+0.146293im      -0.181327+0.164245im     0.137091+0.0629976im      -0.19477-0.0516488im     0.0213402-0.328798im      -0.171042+0.0791739im      0.148938+0.0991341im    -0.246376+0.080878im     0.0291403+0.0576618im      0.162887+0.135737im      -0.134152+0.13873im     -0.0783732-0.145029im      -0.0625974+0.0354239im    0.0980697-0.1727im      -0.0164417+0.301283im      0.0448188+0.10217im        0.250531-0.101715im    -0.0404764-0.0865034im    -0.247906+0.145325im      -0.101949-0.0204627im    -0.0460141+0.0965961im    0.00408984-0.0497353im    -0.0515559+0.0216175im      0.104341+0.0168224im     0.114101+0.00703605im    -0.127895-0.132484im       0.0535486+0.172922im
  0.0119626+0.00776026im    0.157925-0.0478119im     -0.118678+0.0774051im    0.0674887-0.12485im     -0.0925756-0.0170836im     0.054964+0.0232881im     -0.123766+0.0862422im   -0.051935-0.0708104im      0.263031+0.0303462im      0.148985-0.00718508im    0.0645782-0.231205im      0.0201314-0.0130379im    0.0440972+0.072166im      0.148403-0.160847im     -0.0778308+0.319483im      -0.200241+0.0639556im    -0.298005+0.108094im       0.0370673-0.0702395im   -0.0836889-0.137048im      0.122775+0.00419499im   -0.0445759-0.20868im       -0.088906-0.0861461im   -0.0198592+0.239148im    -0.0312351-0.0668393im     0.0487423+0.0325608im      0.201177-0.180156im      0.0829197-0.0175502im        0.1286-0.176911im     -0.0661021+0.0646722im     0.196748+0.106761im       -0.09098-0.047443im      -0.0178782+0.243078im
  -0.100159+0.0251978im     0.269525+0.190145im       0.107645-0.0563263im     0.118575+0.118111im     0.0153825+0.173193im     0.0579924-0.076929im     -0.0070074+0.0160778im  -0.0150122+0.13456im        0.141372+0.154494im     -0.0523026-0.0340382im    -0.0021209+0.26556im       0.0933087-0.352051im    -0.0376778-0.107491im    -0.0288408-0.236819im      0.0713079+0.141403im     -0.0120173-0.0396669im     0.143946-0.0732914im      0.0108188+0.064737im      0.288827-0.00592167im   -0.033636-0.104585im      0.0685029+0.06408im      -0.0709327-0.0370459im     0.182883-0.0613952im    -0.107584-0.0779569im    -0.0382068+0.0817627im    -0.0265777-0.0604828im     0.0667544+0.169926im       0.195919-0.0462213im     -0.022749+0.114582im     -0.157267-0.0418055im     -0.108977+0.249967im       0.0446668+0.182111im
  -0.043235+0.129358im      -0.12504+0.144532im     -0.0516957+0.0862781im     -0.26566-0.0362598im   -0.0210696+0.086023im    -0.0677532+0.0768824im    -0.0331364-0.128471im    0.0338669-0.333956im       0.146444+0.191317im        0.04702+0.112345im     -0.0224625-0.109701im      0.0954958-0.122847im    -0.0185187-0.0787076im    0.0366879+0.129387im       0.117261-0.0857172im     -0.214031+0.0343713im   -0.0347356-0.189635im       -0.056223-0.079475im      0.013183+0.15569im      0.0512344-0.0634123im      0.196068+0.230173im      0.0786944+0.034642im      0.229181+0.115712im     -0.110026+0.180364im       0.157596+0.190636im      -0.104754-0.142863im       0.214019-0.120481im      -0.157381-0.0937857im    -0.0707364-0.0654193im   -0.0471707+0.142252im      0.0318656+0.0280207im      0.0488685-0.049527im
 -0.0757949+0.17457im      -0.185565-0.16056im      -0.0584031-0.0804375im    -0.077575+0.110656im     0.0628485-0.100698im     0.0478086+0.0573541im     0.0988068-0.13623im     -0.236212-0.111749im      -0.323887+0.0878761im      0.130852-0.0127525im    -0.0561275-0.176379im     0.00845302-0.291246im     -0.131954-0.00789441im   -0.134185-0.247944im      -0.153237+0.00511006im    0.0588702-0.0610278im    0.0485836-0.0339019im      0.0512267-0.0532202im    0.0356572+0.0928937im   -0.0011125+0.254156im      0.0234888-0.151275im      0.0400133-0.146022im    -0.0998321-0.0837871im   -0.0836825-0.0250024im     0.0293409-0.0650157im     0.0856578-0.111im        -0.0387193-0.0288987im    -0.0455464-0.221373im      -0.125175-0.101271im     0.0429072-0.171269im       0.171437+0.232878im      -0.0222431+0.092836im
   0.189459+0.0277124im    0.0129082+0.0306916im    -0.0893121+0.135853im    0.00144732-0.0209289im     0.233913+0.106544im      0.291323+0.0385972im     0.0232647+0.0511366im  0.00612345+0.0573338im     -0.121371-0.0484964im     -0.119794-0.108581im      0.0913036+0.114051im      -0.065811+0.225277im    -0.0106205-0.193442im     0.0323287+0.0451004im     0.0751745-0.150233im      -0.058385-0.0795656im    0.0356523-0.053733im       0.0679893+0.041535im       0.16061+0.146022im      0.147419-0.0687124im     0.0799182-0.0403828im    -0.0841501+0.0229454im    0.0653787-0.0494585im   0.00039042-0.207335im       0.061414+0.159388im      0.0943736-0.00187322im     0.268199-0.0125924im     -0.102128-0.12908im       0.0509378-0.0430949im     0.277269-0.20805im        0.180447-0.119778im       -0.224667+0.263728im
   -0.12618+0.310927im    -0.0614411+0.00207476im   -0.0347452+0.0155721im    -0.156051+0.0197653im   0.00600941+0.0455665im    0.0190729-0.0160695im    -0.0175346+0.0587569im   0.0617525+0.263643im       0.207597+0.195231im      0.0680404+0.202989im     -0.0628789+0.0640001im    -0.0142207+0.0250504im    0.0311915-0.0337329im   -0.0228165-0.0154207im     0.0434324-0.0155151im     -0.101646-0.209294im     -0.207188+0.0620889im      0.0699201+0.103049im     -0.132721+0.106688im     0.0485225+0.0559411im     0.0361345-0.111501im       0.127088+0.455399im     -0.135082-0.0577688im   -0.0912295+0.0741711im      0.085638-0.119042im     -0.0899062+0.143158im     -0.0343183-0.0362533im      0.153415+0.0365192im     0.0529381-0.0399091im     0.158069-0.290563im     -0.0907713+0.11583im      -0.00417955-0.0132624im
  0.0317685+0.107562im    -0.0724272+0.132659im      -0.257718+0.276668im     0.0564999-0.0626671im    0.0669759-0.0124413im    -0.041011-0.0255023im      0.036577+0.0220922im   0.0495341-0.0280172im     0.0398955-0.00598786im    -0.106819-0.0667542im     -0.043837+0.0396059im   -0.00155691-0.255533im    -0.0381383+0.153653im      0.158974-0.140241im       0.112252+0.0527762im    -0.0237189-0.0215574im    0.0452945-0.0463433im      -0.134799-0.339152im    -0.0602587+0.0705748im    -0.214551+0.0647497im     -0.227351+0.0062206im     0.0825107+0.189217im    -0.0723027-0.212059im      0.169258-0.328048im      0.0389429+0.0720079im      0.165469+0.198598im      0.0918395-0.0715893im     -0.101176+0.130495im      -0.122473+0.038429im   0.000416747+0.101347im     0.00428148-0.0231291im       0.102943-0.0219101im
   0.168608-0.0131157im    0.0502213+0.0887617im     0.0752155+0.128208im    -0.0814536-0.00562477im  0.00286244+0.087444im    -0.0419022+0.0675861im     0.0835969+0.0602331im    -0.01914+0.213051im     -0.0371555+0.053038im       0.128789+0.154762im      0.0977276+0.12646im       -0.147381+0.0428166im    0.0328144+0.117332im     0.0386396-0.098938im      -0.106902+0.0668075im     0.0845508+0.0580411im    -0.111958-0.325419im       0.0589819-0.270541im     -0.168402-0.106758im     -0.132385-0.0198558im     0.0355127+0.0950386im     0.0390556-0.165486im      0.150556+0.112437im    -0.0207462-0.137725im      -0.165437-0.220277im      -0.208179-0.00621892im    0.0329674+0.0522585im     -0.197946-0.171048im      0.0853804-0.327527im     0.0372115-0.109585im      -0.202734+0.0485231im     -0.0755123-0.0137397im
    0.13461-0.0107827im   -0.0601707+0.0661607im    -0.0270009+0.0434995im    -0.137521+0.198017im    -0.0935688-0.0183836im     0.199684-0.147631im      0.0997604+0.077437im     0.115277-0.15852im     -0.00449038+0.0202624im    0.00779086-0.0461785im     -0.116921-0.21538im       -0.149029+0.0150285im    -0.134413+0.128412im     -0.153058-0.133462im     0.00454935+0.118391im      0.0508219+0.0572259im  -0.00190674+0.000912392im     0.172445+0.345004im        0.1329-0.297893im     -0.186487-0.0032111im    -0.0248021+0.260246im     -0.0677178+0.2204im        0.034475+0.104157im      0.104213+0.0368175im    -0.0611174-0.0173642im      0.171091+0.0735904im       0.17449+0.0536941im    -0.0487591+0.121928im      -0.124588-0.140052im     0.0874279-0.00382554im   -0.0815079+0.0900263im      -0.139287-0.0715883im
 -0.0544545+0.145369im     0.0818695+0.0570746im     0.0219605+0.0248821im   0.00424986+0.29881im      -0.172119-0.0819854im    -0.139783+0.129063im     -0.0478736+0.137762im      0.22038+0.037502im       -0.14784-0.0585117im    -0.0110832+0.193871im     -0.0348628-0.0326018im    0.00812489-0.14256im       0.171443+0.0352613im    0.0264002+0.147874im       0.036554+0.012601im     0.00642755+0.209602im     0.0617651+0.19253im         0.241458-0.0325418im    0.0760804+0.00481253im  -0.0166379-0.199559im       0.161006-0.10569im       -0.105054-0.0240065im    -0.263337+0.0108457im    -0.294626-0.263964im     -0.0521475+0.127814im      -0.114249-0.0160986im     0.0103733+0.0267289im     -0.181731+0.0591928im     -0.105277-0.0621877im     0.150893+0.0878967im     0.0962541-0.00279631im     0.0460708-0.00746246im
  -0.181862+0.0757058im     0.100299+0.267012im      -0.121047+0.0336419im     0.107631-0.00147438im   0.0477474+0.10421im       0.029029-0.124289im      -0.174589-0.153186im    0.0190392-0.0573812im       0.08713-0.136589im      0.0552297+0.111699im     -0.0014359-0.0865423im    -0.0335473+0.228574im    -0.0918974+0.159376im    -0.0785076-0.127617im        0.26311-0.0836272im   -0.00744999-0.241032im      0.308243-0.0802013im     -0.0405521+0.147894im    -0.0288116+0.0345135im   -0.0265585-0.0414676im     0.0233743-0.34593im       -0.046525-0.165467im     -0.043283+0.0549329im   -0.0663214+0.0302928im    -0.0191862+0.0269328im      0.111108-0.0271722im     -0.130196-0.0674149im     -0.198937-0.0606319im    -0.0899588-0.173181im     0.0172959-0.0164425im     -0.219983+0.0189969im      0.0172221-0.126989im
 -0.0162256+0.157862im     0.0427951-0.141709im      0.0764408+0.0503007im      0.16232-0.0624907im    -0.189849-0.0350619im   -0.0434345-0.00203079im      0.19553-0.204901im   -0.0534101+0.24973im        0.164767+0.218667im      -0.026974-0.053591im      0.0558707-0.21394im       0.0975282+0.0791362im    -0.196462+0.0911387im    0.0833384+0.0226983im      0.168804+0.00512245im    -0.109921+0.249308im     0.0694144-0.03728im         0.125065+0.124368im    -0.0965303+0.235746im     -0.197542-0.0372635im    -0.0105938+0.040053im     -0.0662327-0.296942im     0.0330983-0.0587782im   -0.0351852-0.0432545im     0.0305639-0.0690493im     0.0902592+0.0388255im      0.165132-0.0679177im     0.0226287+0.208117im       0.188602+0.0458306im    0.0291012-0.0967503im      0.124097+0.044694im         -0.1414-0.0918507im
   0.216946-0.00806973im   0.0698754-0.132844im      -0.164268-0.0929996im    0.0399004+0.0792005im    -0.424188-0.0440783im      -0.3541-0.215402im     -0.0762384+0.0341938im   0.0468588-0.0770373im    0.00136129+0.076081im     -0.0370419-0.00513422im  -0.00135277+0.0743084im     -0.012415+0.0610062im    0.0443483-0.100712im     0.0966145-0.126056im      0.0372327-0.139913im       0.201813+0.0332674im   -0.0609777-0.0718209im      -0.104256+0.160585im     0.0260828+0.0891991im     0.182885+0.0904442im    -0.0738858-0.098567im      0.0851833-0.0114085im    0.0998394-0.252375im    -0.0208132+0.00275768im     0.108783-0.0856659im     0.0139971-0.0153921im      0.263905+0.184226im     -0.0597142-0.125209im      -0.166285-0.0609359im    0.0357857-0.0644649im     -0.127086-0.110932im       0.0335972-0.00826445im
   0.119898-0.147577im     -0.236763+0.110257im     -0.0632616-0.00440951im    0.182389+0.0797023im   -0.0507529+0.0168642im    0.0916882-0.0220019im      0.111149+0.0393766im   0.0134515+0.0403843im     -0.107586-0.0772723im      0.333893+0.00624768im  -0.00166621-0.130456im      0.0638039+0.0432522im   -0.0256872+0.0877039im     0.176418-0.0502054im       0.22386-0.164325im     -0.0445661+0.0942979im    -0.156357-0.210259im     -0.00871417+0.146477im    -0.0348114-0.0528372im     0.116121+0.0300306im     0.0968812+0.0479926im       -0.1583+0.0830052im    -0.082996+0.0456118im   -0.0288111-0.250597im       0.179431+0.115051im      -0.142949+0.137911im      -0.126606+0.0264773im     0.0860896-0.229969im      0.0706023+0.270807im     -0.204334-0.0551449im    -0.0430511+0.135469im       0.0770583-0.0807406im
   0.170599+0.107986im    -0.0620186-0.0742992im     0.0695422+0.102766im     -0.121192+0.101076im    -0.0655849-0.191173im     0.0731738-0.00652669im  -0.00231345+0.0254828im  -0.0350076+0.119213im      -0.253985-0.235446im     -0.0919854+0.0734972im    -0.0569075+0.0281054im     0.0287063+0.0667483im   -0.0473294+0.158747im      0.051348-0.126544im       0.146892+0.221999im      0.0556061-0.22982im     -0.0529738-0.074603im       0.0299183-0.186289im    -0.0135964+0.103259im      0.095762-0.235834im       0.115967-0.111498im     -0.0174232+0.0410384im    0.0322339-0.0679932im    -0.168132+0.271032im      0.0451763-0.0696795im      0.095287-0.00348303im     0.209943-0.0486936im      0.100493+0.0428045im     0.0824752+0.175901im     -0.217359+0.241424im     -0.0877888+0.0590707im      -0.217347-0.0178062im
  0.0254489+0.0733897im    0.0304491+0.155479im     -0.0642728-0.117643im       0.11697+0.062387im      0.349628+0.117665im     0.0520439-0.0151257im      0.212086-0.0273842im  0.00917411+0.00806348im    -0.071373+0.0836407im       0.20018+0.228582im      -0.136661-0.127578im     -0.0217806+0.0634491im     0.022977+0.0188922im   0.00946318+0.195171im     -0.0938882-0.0128984im    -0.0116036+0.221897im     0.0231451+0.140374im      -0.0970096-0.0477244im    0.0556317+0.00674987im    0.145894+0.120459im      -0.134815-0.0683347im     -0.056361+0.0852368im    0.0273298-0.293233im    -0.0568365+0.0120485im     -0.155633-0.105525im       0.100349-0.274254im       0.264836+0.0840899im     0.0372491+0.0288249im       0.13893+0.0303661im   -0.0419117+0.130418im      -0.243794-0.0258902im      0.0134212-0.116318im
  0.0153889+0.247057im      0.101859+0.162219im     -0.0257648+0.00624417im   0.0883771-0.0515068im   -0.0531148-0.116752im     -0.156108+0.0832575im     0.0357506+0.187078im     0.204843-0.0967935im    -0.0795966+0.0485953im   0.000132096+0.0468866im     -0.143911+0.173676im      0.0323769+0.319973im     -0.320169-0.0840085im     -0.15788-0.24013im       -0.247883-0.0148351im    -0.0195862+0.0675743im    0.0578346+0.109285im       -0.156459-0.0422197im     -0.10669+0.0827127im   -0.0523157+0.0574789im      0.198986+0.0439543im     -0.276401+0.0481047im    0.0489639+0.115644im      0.154957-0.0894035im     0.0219096-0.0824194im    -0.0558918-0.0498587im     0.0326591-0.178245im       0.102085-0.0664373im    -0.0117015+0.0751982im   -0.0687042+0.0519481im      0.128371+0.0407632im      0.0754578-0.010412im
 -0.0451966-0.00960159im    0.335532-0.100027im       0.231315-0.036423im        0.1166-0.110651im     -0.085396+0.085136im      0.253593-0.0246209im    -0.0872947+0.125543im   -0.0134758+0.0462475im     -0.160793+0.144307im     -0.0436166-0.0564182im     -0.017778-0.199754im     -0.0994074-0.0145825im   0.00458747+0.0204115im    0.0800131-0.145845im      0.0454584-0.00594819im    -0.128737-0.0346913im    0.0334384+0.0717123im       0.224639-0.110147im     0.0577683+0.230233im     0.0786512+0.131839im      0.0696831+0.15918im       0.0899078+0.109865im     -0.146705-0.0948801im     0.181232+0.0397104im    -0.0525602+0.0574248im     -0.156471+0.00474552im    0.0157318-0.117567im     -0.0653666-0.217788im       -0.18318-0.0171913im    -0.121602+0.0410135im     -0.126414-0.220666im    -0.000798368-0.252953im
  -0.084198-0.0924734im   0.00111241-0.104991im     -0.0594011+0.264736im       0.02283+0.169316im    0.00625501+0.0941786im    -0.267519-0.199002im      0.0301894+0.198528im    -0.282516+0.0998516im    -0.0227167+0.03931im      -0.0262118-0.0963056im      0.102707-0.0860444im    -0.0824999+0.0771823im  -0.00366237+0.0523458im     0.106454+0.142497im      -0.045084-0.0202239im    -0.0959177+0.0721716im     0.158645+0.0557639im     -0.0967934-0.1074im        0.222343+0.0479736im     0.153344+0.0934583im     0.0366266+0.00351738im    -0.188093+0.139907im     0.0805151+0.138399im     -0.123916+0.0898675im     -0.119667+0.0388647im      0.109555+0.224606im     -0.0172657-0.166738im        0.20822-0.104059im      0.0281131-0.296372im    -0.0302367+0.049448im      0.0566499+0.15191im        0.0336003-0.0886305im
 -0.0190652-0.115402im     -0.088285+0.119551im    -0.00925562-0.0816403im    -0.183943-0.0148235im   -0.0109466+0.00444665im   0.0684255-0.072257im     -0.0168107+0.0509267im    -0.13132+0.104885im      0.0943939-0.0431367im   -0.00172237+0.165784im      0.0237068+0.0812373im      0.210925+0.0766466im     0.173113+0.193515im     0.0206999-0.363472im      -0.162095-0.0953262im     -0.146422+0.0986045im     0.171966+0.0569052im     -0.0244125+0.00218694im  -0.0539547-0.180318im    -0.0313606+0.145148im     -0.0615035-0.0876333im     0.0589519-0.073096im   -0.00955492-0.0238306im    -0.103886+0.133731im      -0.176961+0.246235im      -0.179266+0.147768im        0.29651+0.0141604im     0.0180894-0.0236995im    0.00728514+0.156044im     0.0746782-0.0544427im      0.262159-0.122338im      -0.0189139-0.166046im
  0.0323201+0.193668im     0.0227802-0.117461im      -0.077033+0.131102im    -0.0157274-0.0821258im   -0.0072137-0.0482681im    -0.175978+0.128012im     -0.0648238+0.0134275im   -0.070799+0.00885437im    -0.118692+0.12895im        0.127092+0.0269889im    0.00243302+0.00268621im   -0.0983726+0.0108341im     0.127875+0.0458033im    0.0608985-0.0532167im     0.0545129-0.0261276im     0.0319413-0.171869im     -0.102762+0.334454im      -0.0118488+0.119024im      0.171844-0.216887im     -0.180661+0.100469im      0.0568364-0.0603133im     0.0520215-0.036634im      0.225303-0.0133737im    0.0748227-0.107807im      0.0207017+0.352638im     -0.0374581-0.105057im     -0.0468716-0.0525334im    -0.0981792+0.0627961im      0.265765-0.0492233im    -0.336181-0.128108im     -0.0871117-0.10647im         -0.16987-0.00820423im
   0.254417-0.144726im     -0.011623+0.0128041im    -0.0981389-0.15238im     -0.0229925-0.0273431im     0.103139+0.0494364im   -0.0384977-0.00625884im   -0.0429375-0.0178906im   0.0812233+0.050176im     -0.0723687+0.0433165im     -0.120731-0.0950467im     -0.210981+0.0834228im      0.130931-0.0164948im    0.0628236-0.220909im    -0.0171997+0.00803384im    0.0421264+0.254177im      -0.206671-0.098749im     -0.154164-0.0415034im      0.0472485-0.0387158im    0.0659659-0.0989547im   -0.0901202-0.0400652im     0.0299973-0.105339im      -0.057922-0.141365im     0.0356705-0.0506232im   -0.0924537-0.0996919im      0.156467+0.0193005im      0.107607-0.0800732im    -0.0462967-0.116477im        0.13949-0.00532953im  -0.00966166-0.176337im     0.0895199-0.119136im      0.0666046+0.0355841im      0.0810472-0.572713im

and then generate the state $ψ$

psi = P[:, 3]
32-element Vector{ComplexF64}:
   0.05987623151810845 + 0.209857109154876im
  -0.05820261919897231 - 0.08161545511701293im
   0.02991195541609369 - 0.3682922382871652im
     0.371416389338062 + 0.0im
  -0.09794963579662945 + 0.06558728093829426im
  0.027650473012339798 + 0.1564268038852246im
 -0.043945214952182086 + 0.036150117000287196im
  -0.03927996896621953 + 0.0017911863631421276im
    0.2868706134729026 + 0.01382495829541927im
  -0.11485119682535036 - 0.21525875373524472im
    0.0394708097984449 + 0.2630903329438929im
  0.052144019132819776 - 0.046818928415255784im
 -0.018374778881595593 + 0.06321622010548411im
  -0.02442316144660324 - 0.16346740994391493im
  -0.10350925732851482 - 0.041739230187523055im
  -0.04901722684633708 - 0.08140604057451295im
  -0.05922846050056186 - 0.04840178742034858im
  -0.03224322503012603 + 0.06661345455088691im
   -0.1480922015443393 - 0.15915543678615612im
     0.146591667853851 + 0.06043636324858846im
   0.14114505091612886 + 0.08773819121478603im
   0.04665454552022367 + 0.22829234007232022im
  -0.09832403944181493 + 0.009055765365725811im
   0.04909360273562037 + 0.005685021338781091im
  -0.06390393987341224 - 0.032501597201286446im
   -0.1009282824914284 + 0.1279186320616994im
   0.12136326710044504 - 0.042007978477235im
     0.085992129820647 - 0.06482713254018528im
    0.1408174871809209 + 0.14536193417718032im
   0.06415608186488438 - 0.09079037533651961im
  -0.09633784251472856 - 0.18737812157426964im
    0.1012502228147033 - 0.08667328885411092im

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.