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.144962+0.0444319im    -0.0305481+0.0281083im    -0.181845-0.0089989im      0.11524-0.131727im     -0.120354+0.0244182im    -0.065087+0.260427im     -0.054275-0.0782636im      0.127904-0.048851im     -0.150032+0.0375001im   -0.0455951-0.00877855im     0.299176-0.16356im       -0.146485+0.0182846im    0.0282236+0.180326im      -0.253254+0.0124136im   -0.0035428-0.0861414im      -0.232074+0.100926im        0.168527-0.122614im       0.0768066+0.250107im      0.0749144-0.386448im     -0.0836012+0.0966332im     0.0836941+0.0495439im    0.0533422+0.111939im      0.206414-0.00317963im     -0.11916-0.0131149im     -0.0279084+0.0687168im     0.0765351-0.0431481im    0.0726389-0.1037im      -0.0129742-0.160422im    -0.00114029-0.0500038im    -0.00808284-0.00674633im    -0.169385-0.0180742im      0.0633277-0.0869393im
   0.133163+0.0220742im    -0.0979171-0.147188im    -0.0700065+0.0224978im    -0.165661-0.0203366im    -0.081892+0.0811331im    0.0456342+0.118372im    -0.0872115-0.0519006im     -0.130179-0.0474956im    -0.234396-0.224599im     0.0299626-0.0726292im     -0.144621+0.0271228im     0.0847335-0.0204393im   -0.0268257-0.0465785im     0.0374664-0.0171545im      0.06021+0.111575im       -0.118223-0.199372im        0.186821+0.113405im       0.0669929+0.0128303im      0.232095+0.188956im     -0.0424383+0.189339im     -0.0758577+0.0305417im    -0.232136+0.01017im      0.0775851-0.240683im      -0.205725+0.244493im       0.0348313+0.188323im      -0.170525-0.132079im    -0.0282036-0.185927im    -0.0766267+0.020833im       0.115392-0.00534082im    -0.0164506+0.0316054im     -0.161602+0.236963im       -0.109453+0.055574im
 -0.0191742+0.256607im       0.186469-0.0478407im     -0.13293-0.185803im     -0.209029-0.120796im      0.029789+0.046279im     0.0951418-0.0099707im    0.0379654+0.0804341im    -0.0596533-0.158558im     -0.136186-0.00651426im    0.186928-0.134963im      -0.130499-0.0644753im     -0.289971-0.110381im      0.052473-0.22698im       0.0112787-0.268749im     0.0170011-0.042196im        -0.15195+0.0895725im      0.0514005-0.00597756im      0.237308+0.00638322im  -0.00273495+0.0424451im    -0.0452162-0.0594804im     0.0042728+0.184623im    -0.0216135+0.0219578im   -0.0206957+0.157206im       0.177432-0.195563im       0.0416771-0.089343im      -0.212443+0.0106521im   -0.0567145+0.239362im       0.16152-0.0447064im       0.15089+0.0305477im     -0.0879083-0.0431648im    -0.0682987+0.000336937im    -0.031192-0.0980261im
  -0.174899+0.247752im       0.343642+0.223735im     0.0663951-0.0282292im    -0.167468+0.0650005im   -0.0859271+0.00683717im  -0.0721654+0.042021im    -0.0541232-0.080967im    -0.00651566+0.162296im     0.0308385+0.0378694im    0.0069604+0.101879im     -0.0400413+0.140823im      -0.103732-0.0248044im     0.227274+0.0097907im      -0.10781+0.0762753im    -0.318335-0.107517im       -0.054242+0.0134563im        0.06062+0.0570585im       -0.20545-0.0974948im      0.139191+0.0378122im    -0.0586516-0.148173im     -0.0344458+0.0304947im    0.0698548-0.0812727im   -0.0249284-0.160611im     -0.0665933-0.144637im      -0.0900088+0.164116im      -0.195869+0.125592im    0.00145662-0.113536im     -0.124857+0.110738im     -0.0885217-0.182195im        0.061713+0.0838961im     0.0141759+0.180118im        0.178444+0.0692978im
  0.0532492-0.0734167im      0.225962+0.0303237im     0.154671+0.0277925im     0.131677-0.231136im      0.075593-0.184703im    -0.0629584+0.00142982im   -0.094651-0.0461451im      0.139972+0.028647im    -0.0590234+0.0341617im    -0.178535-0.168144im      0.0804225+0.0403884im      -0.17846+0.0806522im     0.160631-0.0972973im     0.0174071+0.049636im      0.159046-0.0698426im     -0.0717418+0.223522im      -0.0388336+0.0186135im       0.243483+0.0155269im      0.108338+0.233698im      -0.186775+0.212831im      -0.126111+0.101744im    -0.0991723-0.0369498im     0.093221-0.0408876im     0.0482236+0.0700577im      -0.197029-0.181963im       0.154909+0.0527611im    0.0025622-0.0826686im   -0.0166588+0.110709im     -0.0601873+0.0554435im       0.121127+0.127202im       0.211032+0.0539211im     -0.0897779+0.245705im
 -0.0183485+0.0583393im      0.162482+0.121348im     -0.139585-0.0389478im   0.00440194+0.0491971im    0.0673973+0.218069im     0.0389844-0.0317497im     0.220113-0.0110953im     0.0456121-0.291107im     -0.191082+0.0340836im    -0.265548-0.134477im      -0.114453-0.0756965im     0.0824926-0.110316im     0.0301121+0.171369im     0.00480005+0.254565im   -0.00718701+0.105123im      -0.0468725-0.201606im      -0.0720956-0.100695im     -0.00775338-0.149487im       0.117865+0.0681945im     -0.053475+0.0586291im      0.158441-0.0861231im   -0.0978277-0.0207557im   -0.0440861+0.0828634im      0.132197+0.0254725im     -0.0956271-0.111314im      0.0983903-0.0243368im     0.166386-0.0797104im     0.318021+0.181048im      -0.137594-0.171649im        0.142327-0.0682559im    -0.0939744-0.0133249im      0.0618322-0.102977im
 -0.0373138+0.135432im     -0.0236522-0.092819im      0.211223-0.0183512im   -0.0406801+0.137916im    -0.0708201+0.0355738im     0.169665+0.0341795im    -0.170002-0.182559im      0.0265003+0.0538511im    -0.021068-0.0638457im    -0.216313+0.0515089im    0.00591169+0.138921im    -0.00660451+0.218439im    -0.0475454+0.162378im      0.0381099-0.183946im    -0.0414071-0.0136407im    -0.00675189+0.0488213im       0.264488-0.114091im        0.205069-0.119054im      -0.141442+0.0725613im     -0.164219-0.190663im       -0.11148-0.173615im      0.020809-0.0363732im   -0.0980103+0.322383im       0.107169+0.189576im      -0.0495889+0.0795722im    -0.0581349-0.0596513im   -0.0991429-0.119685im      0.104258-0.121572im     -0.0134166-0.0470667im       0.203789+0.154052im      -0.140255-0.160752im     -0.00888574-0.0473091im
  0.0997905+0.0134394im     0.0560958+0.0867464im     0.265385-0.0770898im     0.199641-0.0847807im    0.0127532-0.175556im     0.0488374-0.0448597im     0.143996-0.0381767im     -0.159117-0.169542im      0.113177+0.0201771im    -0.157144+0.0600701im     -0.114162-0.280823im     -0.0675548+0.0768501im    -0.203422+0.0246449im     -0.116973-0.0364907im   -0.0132943+0.154955im     -0.00809672+0.144571im      0.00118718+0.243718im       0.0289381+0.0295462im     0.0723993-0.0988553im    -0.0775198-0.191618im      -0.125381+0.0808228im   -0.0590726+0.105867im    -0.0278801-0.0449485im      0.115397+0.0905971im       0.252243+0.17471im      -0.0494927+0.250579im      0.207363-0.0734654im  -0.00229273+0.0639161im     0.0476596+0.052052im       0.0586455-0.188003im      -0.185585+0.104805im       0.0780424+0.10401im
 0.00999499-0.205879im      0.0113092-0.190199im    -0.0542257+0.146502im      0.228166-0.00658083im  0.00151593+0.0223065im    0.0701129-0.227377im     -0.197683-0.18958im      -0.0327195+0.0545749im    -0.106924-0.159226im     -0.202671-0.226259im       0.103211-0.166555im      -0.108369-0.0105829im    0.0884096-0.0792602im     0.0622075-0.0222039im    -0.318785+0.00437655im          0.09-0.107863im        0.131503+0.0666991im      -0.065818+0.0132968im    -0.0805076-0.0373684im       0.16725-0.0872436im      0.146355+0.190802im      -0.16002-0.128654im      0.015279-0.0370911im      0.223117-0.190591im       0.0847719-0.189761im      -0.130595-0.0983258im   -0.0707913-0.122309im     -0.147314-0.0402027im    -0.0436784-0.0312496im      0.0184225-0.0488555im    -0.0535632+0.0272326im      0.0958044-0.0189757im
 -0.0995909-0.00304294im    0.0042298+0.0536957im   0.00114848-0.28723im        0.12428+0.0969048im     0.105442-0.166102im     0.0359962+0.0659361im    0.0545097-0.0422605im    -0.0705907-0.0217686im     0.138459+0.00377969im   -0.271297-0.0921404im    -0.0660695+0.123422im     -0.0995928-0.0402422im    -0.133005-0.00673912im     0.105571+0.0877355im    -0.320887+0.13999im        0.0244829-0.206494im        0.101972-0.243345im        0.130941+0.169682im     -0.0468939+0.076521im      0.0761676+0.186348im     -0.0917871-0.0734828im     0.245947+0.00977924im    0.211855-0.165656im      0.0139144+0.0642412im      -0.016566+0.0504969im    -0.0421381-0.00170378im  -0.0262159+0.200759im     0.0690825-0.118796im       0.220722+0.0817853im     -0.0202828-0.00813652im     0.172643+0.131212im       0.0808026-0.0369621im
  0.0239659-0.121278im      0.0961215+0.118669im    -0.0844436-0.165366im       0.07414+0.0562539im     0.182223+0.110996im      0.118244-0.0912424im    -0.216711+0.160667im      -0.236554-0.073629im      0.161983-0.185351im    0.00211274+0.0386531im       0.03959-0.0235096im     0.0869267+0.00681195im  0.00616853-0.148342im      -0.232741-0.0145586im    0.0130431-0.139596im       -0.175161+0.0971955im      0.0674919-0.16221im         0.041928+0.0663036im    -0.0439204+0.127416im      0.0725077-0.1659im       0.00408703-0.152233im     -0.144551+0.0290638im   -0.0218535-0.253033im      -0.190553-0.111896im        0.144218-0.0307814im      0.117055-0.0589615im   -0.0259168-0.109845im      0.291488-0.0523491im     -0.060406-0.00956217im    -0.0411264+0.133952im     -0.0314978-0.19546im         0.120147+0.213632im
   0.114075-0.114586im       0.115821-0.0432057im    0.0690224+0.109596im      0.088434-0.13641im       0.114805+0.128515im     -0.192957+0.120543im    -0.0611501-0.0398287im     -0.148552-0.0267929im     0.124971+0.145433im      0.261532-0.0573253im      0.182965-0.176535im      0.0864262-0.135909im    -0.0399477-0.0797538im     0.0745644-0.225859im    -0.0282421+0.112277im      0.00179088-0.134056im        0.138528-0.0390097im       0.124078-0.379256im       0.135989-0.0658451im    -0.0627198-0.154188im      0.0369477-0.106536im       0.27841-0.0874135im     0.110613-0.140553im     -0.0176053+0.122051im       -0.104484-0.156393im      0.0618737+0.0817297im   -0.0433156-0.0898779im    0.0603745+0.0116428im      0.131405-0.0166816im       0.143084+0.049367im     0.00917318+0.0809401im       0.102349-0.13465im
   0.104493-0.289734im      0.0878114+0.090968im      0.191958-0.0554819im   0.00741581+0.142816im     -0.246181-0.229425im    -0.0640638-0.0797722im    -0.143201-0.00428898im     0.182084-0.26069im      -0.106948-0.00424826im    0.166451-0.00503966im   -0.0294804+0.0378661im     0.0150043-0.00424517im   -0.128339-0.192465im     -0.0205357+0.246082im    0.00255848-0.0202419im      -0.249406-0.0104876im     0.00727477-0.0629008im     -0.0360726-0.0937939im     -0.139647+0.0800292im     0.0384094-0.11856im      0.00301353+0.197854im      0.157866+0.129767im    -0.0707366-0.0118596im    0.00212471-0.0710478im     -0.0613688+0.116147im     -0.0307195-0.11855im       0.101606-0.12214im       0.075542-0.166592im    -0.00976677-0.0825329im      0.0522511+0.0653958im      0.049363+0.0852455im      -0.177618-0.267749im
 -0.0342792-0.141253im      -0.238426+0.0468542im    0.0886243+0.107233im     0.0381363-0.120401im     -0.175651-0.0396658im    0.0872209-0.0937025im     0.122427-0.0381043im     -0.191722-0.0136711im     0.040602-0.0737143im    0.0860504+0.084925im      0.0247619+0.0365796im    -0.0464512-0.140952im      0.218651-0.136869im      -0.157569-0.0678284im    -0.163088+0.14664im        0.0111532+0.234221im      -0.0238115-0.0535727im      0.0676192+0.067573im        0.16141+0.0787134im    -0.0182287+0.0473954im      0.241316-0.128391im    -0.0578756-0.198977im    -0.0210565+0.289891im    -0.00549218+0.0510543im      0.0283583+0.216455im       0.129436-0.19358im       0.117659+0.104627im      0.128403+0.00881163im    0.0160216-0.0672982im      0.0548285+0.101306im       0.168388+0.269751im        0.140396-0.0573788im
  -0.225257+0.0414013im     0.0414824-0.0870205im  -0.00125002+0.0168879im     0.120589+0.212306im     0.0470637+0.140161im     -0.170941-0.0291513im   -0.0440861+0.207443im      0.0402612+0.12108im      0.0767806-0.160262im     0.0165462-0.0836758im      0.030682-0.0116722im     0.0382299+0.326996im      0.231989+0.026578im      0.0136754-0.0151935im    -0.132931+0.000392866im   -0.0778377+0.105258im      -0.0797727+0.187131im       0.0397191-0.0505257im     0.0787821-0.0641407im     0.0524699-0.00387522im   -0.0435757-0.125296im   -0.00552883+0.204076im    -0.0587473-0.0408487im      0.163377-0.0286099im    -0.00289506+0.0154113im      0.178073-0.105327im     0.0702585-0.0457861im      0.14593+0.0904301im      0.395061-0.0476026im     -0.0212854-0.109701im     -0.0121976+0.176399im       -0.292928-0.095544im
   0.137886+0.18191im        0.130313+0.0327466im     0.118663+0.0593853im    0.0627561-0.145708im      0.170642+0.0646462im     0.176262-0.0912696im    0.0619575+0.216836im      0.0617369+0.0669467im     0.163932-0.219798im     -0.109561+0.105992im     -0.0352472+0.0135036im    -0.0136739-0.0364121im   -0.0559575+0.0569505im     0.0496839+0.139064im     0.0865386-0.169257im      -0.0519926-0.23213im      -0.00773541-0.0978649im     0.00267212-0.0457776im      0.160596-0.1898im       -0.0711131-0.206633im       0.368265+0.202663im     -0.030647+0.0109724im     0.127038+0.144364im     -0.0246778+0.0508457im    -0.00558507+0.118863im     -0.0204846-0.0784775im   -0.0132168-0.0727495im    -0.128013-0.105928im       0.177323+0.154035im       0.0266067+0.142937im        0.19476+0.0352463im      -0.154213+0.0253236im
  -0.249676-0.127036im      0.0213224-0.150712im      0.206342-0.0377104im   -0.0743283-0.0143208im    0.0867904+0.0404969im    0.0248633+0.0510114im     0.076782-0.108826im      -0.055372+0.234772im      0.130138+0.0444059im     0.141692-0.0390307im     -0.194367-0.00241416im     0.188347+0.140855im     0.0860492-0.129201im      0.0641944+0.0525604im    -0.121193+0.10123im        -0.300004-0.108222im       -0.178528-0.102806im        0.143888+0.00802017im     0.021087-0.0753311im       0.13762+0.0684075im      0.047085+0.322106im    -0.0113506+0.0252676im     0.200104+0.19734im       -0.129499+0.131455im       0.0679546-0.091372im      0.0224382+0.089742im     0.0593312+0.023665im     0.0337759-0.00793444im    -0.154789-0.185527im       0.0326739-0.0327243im     -0.185788-0.124083im        0.023484+0.136241im
  -0.126649-0.156238im    -0.00259626+0.245541im     -0.104726-0.0433416im    0.0977379+0.0534655im     0.065833-0.0266474im    0.0130087+0.0727592im    0.0567315-0.0609647im      0.223869-0.103944im       0.14289-0.108294im    -0.0760882+0.107062im     -0.0369632+0.0307141im    -0.0779763+0.0318109im     0.156338-0.0843069im        0.1647-0.0406111im    0.0778119+0.019249im      0.00662662+0.106747im        0.207791+0.0344685im      -0.102424-0.323705im      -0.100803-0.133913im      0.0148366+0.221432im      0.0813667+0.0245733im    -0.166793-0.112853im     -0.160589+0.0855516im     -0.371038+0.0159192im       0.143387-0.162463im      -0.180258+0.118871im     0.0391874+0.0967364im    0.0403591-0.128298im       0.144094+0.110604im        0.162669-0.0527881im    -0.0904993+0.0940847im     -0.0203165+0.024229im
  0.0463579+0.0304959im     -0.179379-0.0364966im    0.0658989-0.10275im    -0.00977827+0.0272683im     0.217341+0.333324im     -0.170845+0.0403377im   0.00655838-0.152194im     -0.0956277-0.140179im     -0.129755-0.0962659im   -0.0919241+0.170224im      -0.145316+0.189854im     0.00211921-0.217329im    -0.0930123-0.121822im      -0.129026+0.0680158im    -0.150272-0.108924im      -0.0660715+0.183582im       -0.016117+0.0123823im      0.0983609+0.0435974im    -0.0490889-0.122352im      0.0883271-0.047124im      -0.212751+0.164654im   -0.00489971-0.144472im     -0.086508+0.0312531im    -0.0698069-0.0544387im      -0.138165-0.0688836im      0.192707+0.0181075im    0.0912449-0.0781621im    -0.267231+0.110719im       0.158576+0.0893792im       0.208445-0.0826482im     0.0758455-0.0944285im     -0.0453453-0.113159im
 -0.0881023-0.212518im      0.0420182+0.0729799im    -0.056614+0.11396im     -0.0554617-0.0351326im      0.19426+0.194037im     0.0836075+0.0771053im    -0.262308+0.118062im      0.0528924+0.0448913im    -0.124394-0.10773im     -0.0971963+0.146739im      0.0132994+0.0869041im    -0.0570118+0.123254im     -0.136961-0.247478im      0.0995948-0.016145im      0.124879-0.167709im       0.0502267-0.165555im      -0.0895259+0.232195im       0.0901673+0.156728im     -0.0463143+0.00506978im    -0.226636+0.0882669im     0.0897046-0.0574519im     0.291355-0.165256im    -0.0450872+0.012088im        0.12179+0.0185441im      0.0532936+0.136885im         0.0183+0.0908587im     0.200007+0.120155im     0.0173032-0.0916442im    -0.0914623-0.16645im        0.0255386-0.143459im     -0.0809871+0.138703im        0.148801+0.0116596im
  -0.107272+0.012571im      -0.215972+0.0453664im    -0.110097-0.0591736im     -0.21482-0.0413717im   -0.0650655-0.0053735im     0.228405-0.348424im     0.0368249+0.0862262im     -0.136717-0.114499im     0.0838454+0.00889508im  -0.0413416-0.176099im       0.259898-0.00336212im   -0.0146109+0.0461696im     0.141871-0.0821713im      0.235331+0.159412im     0.0101122+0.0425317im       -0.12939-0.0768439im       0.194958+0.0712595im      0.0214306-0.0973537im    -0.0157255-0.153326im      -0.215165-0.198717im      -0.267292+0.0396385im    0.0220684+0.0808091im    0.0269097+0.0233659im     -0.154921+0.0424716im       -0.17123+0.0076909im      0.164315+0.023694im     0.0667311+0.0555472im    -0.130817+0.0279818im    -0.0647061-0.0528522im     -0.0699174-0.185158im       0.100279+0.0185695im      0.0616618+0.0579979im
 -0.0841295-0.140318im       0.205831+0.149491im     0.0906117-0.0533096im   -0.0674903+0.0257811im    0.0285889+0.0769321im     0.292482+0.0103587im      0.14912-0.16308im       0.0469003-0.0318594im    -0.106024+0.089553im     -0.146603+0.0459397im     0.0827655+0.0215137im     0.0911229-0.0340743im   -0.0828042-0.0407503im     0.0310417-0.347183im    -0.0908392+0.0640947im        0.13658-0.0187414im      -0.171001+0.0817635im    -0.00463467+0.00888547im    0.0596631-0.038323im      -0.128554-0.025979im    -0.00413353+0.0806397im    -0.106348+0.207255im    0.00206326-0.156719im      -0.154567-0.105907im        0.117653-0.00505259im     0.334465-0.127708im     -0.212795+0.131534im     -0.140579-0.0506819im    -0.0396025-0.122997im    -0.000350631+0.18407im      -0.0454797+0.0829523im      -0.170667-0.180172im
  -0.135671+0.0596685im    0.00788543-0.0460328im     0.328799+0.116695im     0.0109438+0.0553497im     0.146155+0.0249141im    0.0829159-0.141199im     0.0479557+0.0129129im    -0.0099768-0.198327im    -0.0268001+0.0856544im      0.16112-0.0810716im   -0.00785504+0.248822im     -0.0562466+0.127273im       0.10187+0.0148376im     0.0644244+0.0338071im     0.234301+0.213216im        0.150229+0.0845996im      0.0964571-0.245749im       -0.125124+0.152548im       0.149414-0.0684874im    -0.0911605+0.0801415im     0.0712458+0.0645247im    0.0818176-0.0936835im   -0.0816271-0.240481im      0.0747538-0.13775im      -0.00313367-0.0721699im    -0.0251908-0.175245im      0.158012-0.0511372im    -0.106215-0.0484053im      0.190829+0.0035044im     -0.0277375+0.0628212im     -0.258508-0.116855im        0.167785+0.0257314im
  0.0219018+0.191347im      -0.229698+0.0422589im     0.144019-0.0296447im  -0.00960798+0.026235im     0.0772236-0.0831218im   -0.0723582+0.0304253im   -0.0265032+0.122206im       -0.14101+0.00367636im   -0.122425-0.240223im      0.125059-0.040345im     -0.0594322-0.109041im      -0.249972-0.00395902im    0.160456+0.18912im         0.17475-0.141628im    -0.0162995-0.0593076im       0.152831-0.0656472im        0.07646-0.0142691im   -0.000901707-0.00130023im  -0.00522599+0.102239im        0.14669+0.07233im        0.100767+0.117541im      0.128703+0.204142im    -0.0261384-0.147465im     -0.0915726-0.0768863im      0.0742421+0.0214421im      0.193718+0.112625im      0.123769+0.0165246im    0.0544395-0.137165im       -0.32359-0.0822733im        0.36743-0.0194459im     0.0774117-0.0344045im     -0.0885654-0.0478953im
   0.151585-0.0981116im      0.166994+0.142208im      0.114728-0.237021im    -0.0101987+0.130488im      0.162125+0.0714833im    0.0246846-0.165471im       -0.1141-0.0361301im    -0.0204165+0.0512735im     -0.20646-0.0743442im    0.0702985-0.0220783im     -0.062651-0.280798im       0.108975+0.0960257im    0.0624267+0.227318im      0.0535601+0.083203im     0.0987943+0.131655im      0.00969063+0.190816im        0.118465+0.205927im      0.00840137+0.103999im       0.143449-0.0398543im      0.245223+0.0317777im     0.0560439-0.0452024im    0.0503866-0.174232im     0.0369641+0.107182im     -0.0933994+0.0527613im      -0.318168+0.0870311im   -9.76606e-5+0.0988555im    -0.127525+0.215571im    -0.0669128-0.153315im      0.0438489-0.0829551im      -0.149756+0.0685888im     0.0224043-0.051189im       0.0673275-0.0607037im
    0.20405-0.121217im      0.0378264+0.0584626im    0.0469113-0.116385im      0.273034-0.200808im    -0.0848721+0.267081im     0.0569666-0.00191999im     0.17215+0.223245im     -0.0221787+0.050407im      0.207238-0.0376334im    0.0798021+0.0343084im    -0.0608318+0.256857im      -0.110452+0.0932001im   -0.0241459+0.0227044im   -0.00826295-0.119468im     -0.147635+0.0117372im     -0.0271243+0.046604im        0.125108+0.0737979im      0.0350632-0.026289im     -0.0986014-0.082754im    -0.00715526+0.157023im     -0.0133223-0.0145523im     -0.11629+0.173414im    -0.0417401-0.117892im       0.103358+0.120372im       -0.303002-0.0207584im     -0.207726-0.10243im       0.104235+0.0399278im   -0.0791742+0.0173173im     -0.293762-0.109753im       -0.123162+0.00272767im   -0.0697291-0.053578im      -0.0104349-0.160607im
 -0.0496588+0.1475im        -0.041251+0.154637im    -0.0528247+0.137935im     0.0936671-0.214986im     0.0555951-0.166016im     0.0332564-0.0683752im    -0.159023-0.0269118im     -0.194635-0.0599073im    0.0340625+0.0853484im   -0.0751944-0.203326im     -0.0480283+0.180419im        0.28491-0.0107299im     0.147991-0.0724192im     -0.155748+0.0656439im    -0.053676-0.0247884im     -0.0796295+0.000359065im    0.0626056+0.260996im      -0.0499446-0.00815118im    0.0221037+0.0632842im    -0.0895777+0.214818im       0.146307+0.031479im     0.0779351+0.0663068im   -0.0377451-0.0125428im     0.0224474+0.0736195im       0.121977+0.0973711im    -0.0335803+0.171308im     -0.134357+0.0415673im    -0.033654-0.0281584im       0.10324-0.0102304im      0.0640343+0.000240483im   0.0254923-0.387549im       -0.045553-0.338147im
  0.0486462-0.00668951im  -0.00310929+0.179441im     -0.113866-0.027614im     -0.171402+0.117193im     0.0631839-0.0693694im    -0.156893+0.0935299im    -0.206352-0.00360571im    0.0194501-0.170488im      0.202389-0.0199268im     0.112127-0.0573992im    -0.0692712-0.0581472im     0.0679996-0.107209im     0.0118158-0.0211093im     0.0144084-0.0469611im    -0.199647+0.234884im       0.0369369-0.120293im      -0.0706228-0.0315854im       0.166796+0.0366348im     0.0627534-0.135284im       -0.13973+0.148462im      0.0920082-0.0870329im    -0.169695+0.156569im     -0.261818+0.136321im       0.242717-0.052013im       -0.100773+0.0163623im      0.104241+0.0680378im    0.0562075-0.142618im     -0.258942-0.273878im     -0.0360371-0.00432911im    -0.0606954+0.0949074im    0.00704373-0.0378981im     -0.0230408+0.272748im
  0.0569319+0.0570984im    -0.0818236-0.0538985im   -0.0179353-0.0418944im    0.0687061-0.129352im      0.194669+0.0649033im    -0.114082-0.0505262im   -0.0616101-0.224838im       0.256995-0.0999626im     0.225694-0.0243717im    0.0102019-0.0725198im    -0.0829121-0.0690805im     -0.191417+0.072748im    -0.0726541-0.00253215im    0.0638434+0.0761689im    0.0141639-0.159613im      -0.0967297+0.0629962im      0.0508077-0.131074im     0.000143976-0.128354im        0.29585+0.255281im      0.0761741-0.00717919im  -0.00679616-0.160649im     0.0940267+0.139539im    -0.0914464+0.114636im     -0.0723028+0.000777528im     0.251539+0.100347im      0.0974624-0.141906im    -0.0983911+0.0582129im    -0.247985+0.0733088im    -0.0884217-0.216985im       -0.231943-0.130661im     -0.0421742-0.0121885im      0.0886331-0.116235im
 -0.0110701-0.0887451im     0.0831209-0.209348im      0.290723-0.0577116im   -0.0840909+0.0457174im   0.00937487+0.0583083im    -0.035697+0.0658508im    -0.113676+0.125643im      0.0240539-0.0412573im     -0.12991-0.0606548im     -0.21241-0.0479586im      0.144625+0.0526466im    -0.0539531-0.311512im      0.268716+0.137417im      -0.111229-0.0764652im   -0.0467689+0.0229644im       0.128357+0.00130503im     -0.170455-0.00837705im     0.0815651-0.196896im     -0.0863464+0.027879im     -0.0444252+0.0148821im     0.0140524+0.0243194im    0.0515771+0.0992339im   -0.0477328+0.0243746im     -0.193131+0.139848im        0.118289+0.0247141im     -0.101905+0.0823433im     0.218791-0.0611707im    0.0134986-0.0925175im     0.0266755+0.0214555im      -0.437785-0.116777im      0.0938227-0.117343im         0.05577-0.0422439im
  0.0712643-0.136258im     -0.0139616-0.0365383im    -0.114207-0.0897255im    -0.149992+0.118788im      0.103455-0.0788815im     0.277105+0.170326im     0.0057294+0.0410469im     0.0357424+0.168812im      0.154218+0.0656244im   -0.0699526+0.0755907im    0.00333801-0.202978im       0.181328-0.10825im      0.0789667-0.0140867im      0.127311-0.0890427im    0.0281817-0.00710012im   -0.00682349+0.205107im       0.0845479-0.0337055im     -0.0616019+0.227198im       0.136563+0.207492im     -0.0722069-0.0204244im     0.0478157-0.0274197im     0.076983+0.189895im     0.0405509+0.0633635im     0.0025196-0.10111im       -0.0642444-0.179538im      -0.233339-0.0554078im     0.310821-0.221064im     -0.135607+0.112874im      0.0880486-0.0466692im       0.161545-0.0797012im      0.112548-0.072165im      0.00757463-0.205245im
  0.0698404-0.115603im      0.0392981+0.016789im    -0.0882942+0.0654701im    -0.314398-0.0175604im     0.104091+0.013591im      -0.26064-0.110909im      0.114547+0.248644im        0.13906-0.185142im      0.227634+0.0731969im    -0.166819-0.0273939im      0.020079+0.141834im     -0.0855635+0.0579294im    0.0885408+0.130874im      -0.157122-0.149009im     0.0673918+0.159051im       0.0219252+0.0191013im      0.0143551+0.146228im       0.0114273+0.215413im     -0.0810758+0.0758134im      0.144313-0.121148im     -0.0232099+0.156283im     0.0193707-0.102989im      0.143108+0.031667im      -0.024717+0.1714im          0.106753-0.0538297im    -0.0351171-0.0942596im    -0.241604-0.177307im     0.0102698-0.148963im    0.000810898-0.186488im        0.166754-0.0845426im     0.0370013+0.070223im       0.0957774-0.0655796im

and then generate the state $ψ$

psi = P[:, 3]
32-element Vector{ComplexF64}:
 0.0012726886161744805 + 0.12113964727903195im
  0.005133577562855207 - 0.14211415072862543im
 -0.042109964721717554 + 0.09255565209352135im
   0.08023485603379354 - 0.03160153563658087im
   0.36403664580365425 + 0.0im
    0.0765457910731712 + 0.02185849138335361im
  -0.16333610916556646 - 0.18515941177166956im
 -0.010339300880293771 - 0.0735400615561609im
  -0.18636620409270102 + 0.1549617520139838im
   0.15942441463610105 + 0.05483749089794266im
  -0.03077405313667972 + 0.31828213272120615im
  -0.15546631535959682 + 0.02776695234878801im
  0.054159027940989174 + 0.025799124688396326im
  -0.07933283891193085 - 0.1452936243843333im
  -0.09672863785818435 + 0.008211457917888354im
  -0.23934665988605064 + 0.10364231267174603im
   0.10474268879655312 + 0.11093597840229222im
  -0.17681079340016814 - 0.0004338614136403518im
  -0.13398746955251067 - 0.06184881852239336im
    -0.082358207135772 + 0.10290639482780822im
   0.05189722551131373 + 0.14506076401789245im
  0.030331917360319878 - 0.10816923985749921im
     0.250762371345969 - 0.11617607520798164im
  -0.05420459763228919 + 0.11601400981459731im
   0.05318618309477792 + 0.2352320536132399im
    0.0800631677003739 - 0.09683149571995688im
   0.02198431495863278 - 0.07236390538510776im
  -0.11910733081651395 + 0.08148460252078611im
 0.0010996855775564224 + 0.15037005579460644im
  -0.17608138831086256 + 0.06935792373892488im
   0.08639680929591136 + 0.10489000149899977im
 0.0029168322066786545 - 0.13766234181530726im

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.