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.0341526+0.0422402im    -0.0431352+0.104382im    -0.0755132-0.0779842im     -0.15117+0.0528164im    -0.221057-0.203177im     0.000919984-0.0568689im     0.0583535-0.129947im      0.0653614+0.290773im     -0.0340248-0.210553im      -0.313123+0.0876722im     -0.138245+0.0728811im       0.128343+0.11158im      -0.0397395-0.193645im     -0.154287+0.177159im      -0.191304-0.270505im     0.046074+0.024097im      -0.138142-0.102689im     -0.106439+0.173557im     -0.0441665-0.058562im      0.0592523+0.151637im     -0.141608+0.144472im     0.0793586+0.0183312im     -0.112183-0.00552694im  -0.0282404-0.0416684im     0.108544+0.0965404im      0.149337-0.0225482im     0.127493+0.0111288im    0.0148311+0.0746306im    -0.092399-0.0808311im    0.0935986+0.0232995im    0.0885883-0.192231im       0.107322+0.143589im
     0.191087+0.117457im      -0.132065-0.0657294im   0.00727003-0.109487im     -0.031311-0.0409185im    0.0137513-0.11387im        0.0036459-0.0559865im    0.00951805+0.0224877im      0.256535+0.0926471im     0.0332972+0.0428306im     0.0589555+0.0290893im    0.00272641-0.0891915im     0.00776025+0.189204im      -0.135999-0.013854im      0.202936+0.0338999im    -0.0894384+0.0861412im   0.0229522+0.0801776im      0.083967-0.162933im      0.128546-0.0978051im     -0.117749+0.0198341im     0.0127499-0.111597im     -0.102023-0.155301im      0.290034-0.0217635im    -0.0848396-0.0381859im    0.0888145-0.0826443im    -0.126278-0.00968752im     0.147051-0.196773im      0.084781-0.142722im     -0.292631-0.11229im       0.156989+0.100423im     0.0675328-0.20193im       0.255167+0.326942im      0.0513541+0.0389063im
   -0.0799644+0.0512031im      0.122623-0.0703577im    -0.225069-0.0146062im     0.189191+0.144629im     -0.035051-0.191506im       0.0926303+0.0378455im     -0.230218-0.143258im      0.0239043+0.0720912im      0.123277+0.0628721im    -0.0913502+0.0437216im     -0.341313-0.118993im         -0.3023+0.0958497im    -0.0578618+0.00692621im   0.0323234-0.0278596im     -0.101253+0.164958im    -0.251054+0.0304478im     -0.103118+0.076677im    -0.0739581+0.0897726im    -0.0534318-0.00226048im     0.184804-0.0342621im   -0.0295922-0.161823im     0.0156174+0.0798967im     0.0792802-0.11083im     -0.0499119+0.118076im     -0.223586+0.0432679im     -0.110823-0.0346269im    -0.121872+0.0590733im     0.159663+0.254023im     0.0925083+0.180158im     -0.037447-0.0263487im    0.0874078-0.0650768im    -0.0447172-0.036474im
     0.110768+0.19384im        0.085031+0.142509im     -0.135346+0.374257im     -0.163546+0.205158im      0.159851+0.105859im        0.198134-0.146897im     -0.0586245-0.0970407im     0.0707191-0.160452im     0.00859062+0.111414im      -0.085776-0.0570218im   -0.00444711+0.186375im        0.118532+0.151537im       0.188694-0.235796im    -0.0440569-0.0129186im    -0.0250193-0.0351006im  -0.0671736-0.0730791im      0.113905-0.0378103im     0.085017-0.0251236im    -0.0502209+0.0389463im    -0.0529695+0.0742911im    0.0390926+0.0183837im     0.108882+0.185228im      0.0106978-0.082479im    -0.0454409+0.0317841im   -0.0692129+0.0360198im      -0.13381-0.238705im     -0.128779+0.045356im     -0.100373+0.0372986im    -0.212905-0.0917445im    -0.215086+0.0812717im   -0.0500083+0.149752im     -0.0605604+0.123993im
  -0.00452901+0.0766914im      0.032745+0.105786im    -0.0539199+0.0620258im     0.107732-0.100973im      0.105801+0.0983209im      0.0138622-0.0538345im    -0.0704536+0.000264401im    0.135534-0.0153463im      0.157064+0.0473774im    -0.0174424-0.0461731im     -0.227147+0.289799im       0.0430039-0.246361im      -0.189794-0.0147676im   -0.0445634+0.0290299im     0.0932493-0.152654im     -0.17085-0.294824im      0.0955723+0.133412im     -0.203556+0.0417113im     0.0872075-0.134203im      -0.106442+0.25163im      0.0276512-0.0740681im     0.150221-0.182745im       0.139009-0.108361im     0.0273162-0.128013im     0.0448605-0.147613im     0.00032543-0.0598299im   -0.0518394+0.0325668im   -0.0492646-0.188808im      0.299019-0.0114135im     0.175325-0.0231951im    0.0521392-0.0257195im      0.128709-0.0188525im
    0.0421589-0.00259799im    0.0549737+0.0128706im    -0.246468+0.00618991im  -0.0177251+0.262833im     -0.184485+0.162487im      -0.0959977-0.0371005im     0.0909009+0.146219im      -0.212626+0.164988im     0.00782763+0.0126167im     0.0239048-0.135622im      0.0269001+0.168919im       -0.161976-0.152138im       0.142252+0.0787622im    -0.142416-0.16619im        0.033058+0.0418806im  -0.0118424+0.0690595im      0.120589-0.174656im     0.0689779+0.0601883im     -0.199002-0.0128369im     -0.104878-0.0719186im   -0.0413077-0.234386im      0.232475+0.013454im      -0.173518+0.183304im     -0.159308-0.168037im    -0.0381467-0.161539im      -0.127118+0.0136927im    0.0503779-0.200199im      0.161353-0.0258569im   -0.0506914+0.0425098im      0.17376+0.0537921im    0.0485775-0.0431416im      0.138511+0.013377im
    -0.126921+0.149269im     0.00472383+0.221031im      0.107505-0.145857im      0.112324-0.0216788im     0.026981+0.198415im        0.045737-0.341376im       0.132131+0.246536im     -0.0646406+0.0371652im     -0.189381-0.15083im       -0.120126+0.0864715im    -0.0920601+0.0410494im      0.0242146+0.127165im    -0.00668034+0.234782im      -0.15016+0.250124im     -0.0280246+0.122752im    -0.135564-0.0101796im    -0.0366619-0.0441457im    -0.101314-0.0239301im      0.123577+0.00366511im  -0.00684787+0.0288776im     0.102574-0.0537385im   -0.0917698+0.00673666im   -0.0370233+0.255966im     0.0828857+0.177661im    -0.0942816+0.0140614im    -0.0554358-0.153401im    -0.0835796-0.0724407im   -0.0505467+0.166327im     0.0591654-0.0578471im     0.124851+0.123489im      0.102901+0.18188im       -0.153731-0.0401735im
   -0.0587243+0.0549175im      0.042588-0.00476495im   0.0128775+0.00616046im  -0.0182071-0.057438im     0.0201052+0.108718im        0.153566-0.0900026im      0.268529-0.0267116im     0.0402266+0.0116733im     0.0426154-0.145426im      0.0384851-0.00773968im      0.11565-0.183536im       -0.160129+0.0806182im    -0.0450161-0.0177304im   -0.0183823+0.104132im     0.00575435+0.205407im     0.120573-0.165171im      0.0768377-0.0107928im    0.0134353+0.157698im      -0.228991-0.158308im       0.183344-0.0332288im     0.106532-0.0684553im   -0.0728243-0.115481im    -0.00530389-0.0413527im    -0.199417-0.247659im       0.25252+0.257415im     -0.0962451-0.0822234im    -0.157188+0.144199im    0.00761983-0.150284im      0.174881+0.155443im     -0.164424+0.198957im     0.0889022-0.0744474im     0.0859336+0.175823im
    -0.140194-0.0630065im      0.172935+0.0635769im    -0.074802+0.0718808im    -0.134555-0.0808707im   -0.0768703-0.0758455im      0.0210394-0.044246im     -0.0145956+0.10838im       -0.105291+0.059298im      -0.126005+0.0919726im     -0.239113-0.0822487im     0.0362297-0.167214im       -0.063379-0.120622im      -0.305742-0.192185im     0.0386806+0.034421im      0.0265543+0.213244im    0.0334708+0.308991im       0.182175+0.180435im      0.120443-0.0828574im    -0.0397044-0.0669778im     -0.119557+0.171056im     -0.211196+0.00948918im    0.124439-0.00161im        0.133596+0.0832643im   -0.0487432+0.0932136im       0.2727-0.150494im     -0.0761377-0.0970216im    0.0023429+0.00392274im  -0.0277451-0.0225618im     0.106651-0.133102im    -0.0746514-0.0639893im    0.0304955-0.0328915im     -0.259037-0.0160727im
    0.0758165-0.0201943im     -0.138801+0.105554im     0.0356277-0.272178im      0.167644-0.0165518im    0.0141359+0.144591im      -0.0266414+0.0924931im    0.00174833+0.142212im     -0.0378212+0.115329im      -0.220145+0.156306im      0.0855334+0.234383im     -0.0348194-0.00860078im   -0.00448737+0.0639351im     0.0675896-0.169293im     -0.117587-0.337316im      -0.171845+0.0184027im  -0.0170186-0.0218348im     0.0693281+0.0850084im     0.108856+0.0635469im    -0.0412891+0.133277im      0.0639373+0.226464im     0.0452751+0.077431im     0.0814222-0.0345231im     0.0204893-0.0274479im    -0.179639-0.015598im    -0.0623754-0.0702534im    0.00801139+0.0584166im    0.0101905+0.41546im      0.0692999+0.0194829im    0.0513568-0.212974im     -0.114898-0.00729793im     0.16141+0.160616im      0.0756669+0.0320385im
     0.104175-0.0205561im       0.11625-0.197055im      0.168825-0.0354378im   -0.0661937+0.0714612im      0.22601+0.0644353im       0.171131+0.00489574im    -0.178457+0.160588im       0.091622+0.0313123im     0.0669576-0.15365im        0.105704+0.17756im      -0.0282492-0.0388505im      -0.130665-0.154526im        0.23134-0.232626im     -0.127659+0.0334805im     0.0949193+0.0655743im  -0.0295315-0.0453186im      0.123688+0.00873769im   -0.211473+0.00146438im    -0.218755+0.0828954im     0.0333481-0.146794im     0.0876901+0.254326im     0.0393384+0.129985im       0.100661+0.137519im     0.0332422+0.0777404im     0.135097-0.0240092im     0.0771244-0.0414208im     0.118391-0.206844im     0.0430521+0.110447im      0.145163-0.142077im     0.0411623-0.15688im       0.199601-0.135646im     -0.0215731+0.0462437im
    0.0341917+0.120593im        0.18192+0.232831im      0.249635-0.141656im      0.150011+0.115588im    -0.0688665-0.078172im       0.0610856-0.0194412im    -0.0614141-0.0370651im      0.182189+0.155199im      0.0610412+0.0277022im     0.0185304-0.0687753im      0.154418+0.188132im        -0.11896+0.0266038im    -0.0987376+0.028065im    -0.0982714-0.164107im      0.0926355+0.0232932im   0.0864058-0.136075im       -0.21402+0.145784im    -0.0305237-0.115255im    -0.00501034+0.0402002im      0.153466-0.132918im      -0.17875-0.305752im    -0.0779037+0.146208im     -0.0395946-0.0323281im     0.127716-0.0494578im     0.257117-0.108458im      0.0770521+0.0658558im    -0.165603-0.0910222im   0.00427736-0.0521538im    -0.173897-0.221849im     -0.152209-0.0519995im    0.0622901-0.000878969im  -0.0327821+0.0137055im
     0.094415-0.0580994im       0.21642-0.0296904im     0.146975-0.187289im     -0.208272-0.120426im     -0.105341-0.129827im       -0.134696+0.133011im     -0.0192522+0.0726951im      0.248715+0.152974im    -0.00772503-0.16978im       -0.111606-0.130302im     -0.0287149+0.0688383im      0.0634845+0.176349im      0.0429297-0.10648im     -0.0258896-0.0998895im    -0.0941074+0.0490026im    0.102286-0.149429im       0.129006+0.064268im    -0.0867825-0.153568im      0.0249029-0.0186673im     -0.101532-0.00114198im    0.189573-0.0613314im    -0.115324-0.0268189im     0.0566094-0.0618575im    -0.194254+0.082585im      -0.15218+0.0394823im     -0.470661-0.0769923im     0.075048-0.0864608im     0.140245-0.102819im     0.0086039+0.0268205im    0.0786856-0.0353699im    -0.122982+0.100915im     -0.0438453-0.0662511im
    -0.303101+0.0420017im     0.0858039-0.0191093im     0.119871-0.0998713im     0.108348+0.136422im       0.25841+0.0720157im     -0.0923589+0.0898306im      0.059964+0.14256im      -0.0353807+0.00673591im    -0.101368+0.0183536im     -0.161567-0.157932im      -0.134429+0.0405004im       0.291386-0.00692112im   -0.0141894-0.10836im       0.171889-0.00990074im     0.143313-0.0196282im  0.00214529-0.0864697im      0.165811-0.0327217im    0.0618458+0.0486995im     0.0232505-0.144122im       0.185101-0.187992im     -0.114962+0.0727245im    0.0250749-0.127502im      -0.303524-0.167376im     -0.222108+0.0813488im   -0.0423068+0.0064112im      0.173402-0.108051im     -0.103391-0.0496756im     0.186025+0.0253836im   -0.0874317+0.0575611im    -0.040428-0.214227im     0.0515395-0.046101im     -0.0123032-0.0359503im
  -0.00710081-0.310577im       0.158798+0.00240004im    0.130456+0.127706im      0.246325-0.00688785im    -0.21867+0.0793466im    -0.00326667-0.0248252im      0.131384-0.0699599im     0.0854351-0.0465703im    -0.0854095+0.0264335im     0.0411093+0.106835im      -0.283606-0.0555758im      -0.198458-0.141456im      0.0190239-0.132396im      0.021625+0.0906695im     0.0444668-0.0803556im   -0.146222-0.114309im     -0.0119829-0.141783im      0.082772-0.0164463im   -0.00171067-0.143752im      -0.222283-0.203335im    -0.0708553-0.0511049im    -0.120441-0.0900257im     -0.041297-0.0306761im   -0.0179947-0.152143im    -0.0210151+0.120393im     -0.0112931-0.0678198im     0.230055+0.0969167im    -0.056014-0.00150396im   -0.164556-0.171158im    0.00208844-0.110172im    -0.0420084+0.18062im       -0.203305+0.199675im
    -0.139454-0.112945im      -0.104286+0.25185im     -0.0905154+0.132818im      0.124421-0.0841432im     -0.04679-0.11579im        0.0404492+0.206397im      -0.134022+0.076258im      -0.151719+0.104555im     -0.0406759+0.0781112im      0.142342+0.295917im      0.0323648-0.0842483im       0.168379+0.109418im       0.126397+0.0202119im   -0.0784839+0.17848im      -0.0300054-0.196158im   -0.0442773+0.154162im       0.130253-0.0139099im    -0.257059-0.0478629im      -0.16919+0.019412im     0.00960834-0.178508im     0.0122972-0.098477im    -0.0995572-0.0981841im    0.00803339-0.186603im    -0.0419902+0.0255249im       0.1752-0.187813im      -0.233185-0.0660408im    -0.172826-0.0939367im    -0.112317-0.142903im    -0.0914031+0.092946im     0.0212981-0.0277297im     0.116004+0.0474748im     0.0183913+0.00947209im
   0.00636301+0.0453166im      0.110315+0.0216041im     -0.12732+0.0233418im    0.0137833-0.0952631im     0.141962+0.10128im        -0.131316+0.141145im      -0.233889+0.281168im      0.0488574-0.0297541im     -0.195008+0.0896273im     -0.118933-0.0657999im     0.0744445-0.0552902im     -0.0563505+0.0975619im    -0.0902498-0.111971im     -0.231449-0.0794134im     0.0830472-0.0425112im    0.152481-0.0498851im     -0.283714-0.220954im      0.153351+0.193716im     -0.0516587-0.304557im     -0.0578876-0.127665im    0.00653432+0.0136201im   -0.0932015-0.0191028im     0.0655091-0.155068im      0.222937-0.00267244im   0.0259728-0.0752858im     -0.088346-0.0235655im    0.0759061-0.0278227im     -0.15068+0.222791im      0.151878+0.0479143im  -0.00387333+0.0688948im   -0.0854301+0.0314176im      0.161977+0.0532026im
 -0.000398917+0.150302im     -0.0310685-0.129681im     -0.144941+0.138176im    -0.0792799-0.00155856im    0.081689+0.199021im      -0.0417254-0.212834im      0.0883766+0.143819im      0.0998619+0.0416111im     -0.124791-0.0915142im     0.0840789-0.00721911im   -0.0116342-0.143621im       0.0749839-0.0238387im     -0.135728-0.119931im     0.0290645-0.291113im      -0.200972-0.396021im    -0.139119+0.0537482im    -0.0587471+0.0924139im   -0.0836157-0.173117im      0.0290476+0.145015im       0.230907-0.0948598im   -0.0948287-0.141573im     -0.170189-0.109077im      0.0773353+0.0102135im   0.00404657-0.155037im     0.0408523-0.0166582im    -0.0353957+0.0641857im     0.136324-0.111399im     0.0788323+0.0501568im    0.0682848+0.149605im    -0.0316499+0.0228067im   -0.0299178-0.0431856im     -0.257623+0.0769211im
   -0.0971191+0.124331im      -0.162341-0.0157079im    0.0477568-0.0736535im    0.0492112+0.0923995im   -0.0798549-0.0216795im     -0.0371868-0.254406im       -0.17345-0.148035im      0.0801434-0.154015im       0.134123+0.111844im      -0.101088-0.113222im     -0.0126975-0.0522883im       0.143423-0.0814052im    -0.0410557-0.116647im     -0.120878+0.079665im       0.115864-0.0580936im    0.227717+0.171204im      0.0270043+0.122495im    -0.0450758+0.298557im      -0.232019-0.0440195im    0.00603913-0.092928im      0.024648-0.0226474im    -0.264348-0.111305im       0.185278+0.169659im    -0.0645864-0.150391im     -0.191479-0.0632006im    -0.0472302+0.0625521im     0.126384-0.00596612im    0.113198-0.0792073im   -0.0753381-0.0718055im   -0.0596038-0.0286993im     0.149425+0.242779im      0.0169444-0.183321im
      0.18085-0.000511587im  -0.0319773-0.316973im     -0.160831-0.0239812im     0.179812+0.0450713im   -0.0323375+0.0418671im      -0.131013+0.156755im     -0.0131458+0.0856079im      -0.20562+0.0998376im      0.142424-0.0213084im   -0.00876571-0.332003im      -0.151386+0.136024im         0.11942+0.0706462im     0.0648389-0.0823061im    0.0471607+0.142066im      -0.214449+0.20459im     0.0120119-0.130871im     -0.0153481+0.0472741im   -0.0355717+0.0279865im     -0.119137+0.136609im       0.119212+0.0976873im    0.0216841+0.051073im     -0.235445-0.172931im     -0.0529088+0.07862im       0.227382-0.00207624im    0.218746-0.13394im     0.000147217-0.0775543im     -0.04482+0.061884im     -0.159328-0.01253im     -0.0957857-0.0649358im  -0.00305475+0.0105911im   0.00937788+0.112887im      -0.149055+0.0922588im
    -0.173032-0.016901im     -0.0990759+0.0321281im    -0.130593+0.00185272im     -0.0291+0.267728im      0.184691-0.126814im      -0.0641226+0.0627506im    -0.0639234+0.20694im        0.220137+0.0938661im      0.117799-0.139133im        0.14704-0.00631529im   -0.0750813+0.127013im      -0.0579042+0.0624078im    -0.0531296+0.0787111im     0.161526+0.0855251im     -0.140191-0.0138151im  -0.0280505+0.00605923im    0.0410033-0.199837im     0.0168696-0.170519im      0.0870422-0.255281im     -0.0706905-0.0842695im    -0.107537+0.186918im    0.00912613+0.104589im       0.199421+0.187493im    -0.0971533-0.170604im      0.182438+0.00353368im   -0.0538349+0.194281im   -0.00609225+0.217379im      0.002757+0.0153452im   -0.0952589-0.0435744im   -0.0611536+0.148301im     0.0472798+0.114043im     -0.0273984-0.242761im
    -0.215168-0.0365647im      0.022108+0.0124862im   -0.0752503-0.0569712im    0.0790324+0.168383im        0.1204-0.0312889im       0.121091-0.092335im      0.0303084+0.149568im     -0.0592605+0.0837028im      0.229692+0.0185789im    -0.0579325+0.0528166im      0.102823-0.0696441im       0.120094+0.0928371im     -0.071786+0.0673419im     0.106805-0.238008im      -0.121136+0.0266396im  0.00203258-0.0331178im    0.00859589+0.295523im     0.0341377+0.108961im     -0.0655862-0.0226255im     -0.157769-0.145447im     0.0325483-0.029873im     0.0160636-0.0741562im      0.158627+0.0828206im      0.01106+0.0907948im   -0.0829409+0.234071im     -0.0635205+0.0248651im    0.0499725+0.0253136im    -0.319754-0.0141029im    -0.149935-0.157276im      0.289108-0.113305im     -0.134492-0.144047im       0.143671+0.263405im
    -0.119115-0.145619im     -0.0513775-0.095745im    -0.0270759-0.0710878im     0.353453-0.00861623im   0.0456623+0.0602945im       0.125901-0.0684659im       0.20247-0.17599im       0.0272649-0.144285im       0.134764+0.0397424im    -0.0459786+0.00971473im    0.0495788+0.0188743im      0.0043936+0.0723182im     0.0572006-0.00129435im   -0.016056-0.0843269im     -0.160557-0.17252im      0.275014-0.00577245im    0.0839547-0.0687756im    0.0815174+0.101072im       0.113936-0.0527608im      0.157971+0.0628479im   -0.0552697+0.0818im        0.110404+0.327789im      -0.108193-0.0634016im     0.105256-0.0215074im     0.141767-0.0829313im     -0.345471-0.115376im     0.0953071-0.0902521im   -0.0324133+0.0511328im     0.171316-0.063488im      0.147004-0.0618153im   0.00577822-0.0493902im     -0.138395-0.198584im
     0.130792-0.134319im      -0.174519+0.0962227im   -0.0602834-0.018826im     0.0706024+0.028387im      0.203566+0.00336081im     0.0556885-0.147375im     -0.0856977+0.14567im       0.0805447-0.0755517im     -0.112423-0.0243367im     -0.136818-0.106155im     -0.0660914+0.00132374im     -0.124548-0.0867416im      0.154684+0.160821im      0.099298+0.233049im     -0.0859969-0.0704983im    0.264762-0.0148971im    -0.0297525+0.148473im     -0.131219-0.160419im      -0.117748-0.0680141im    -0.0140374+0.0858713im   -0.0197106-0.245765im      0.072479+0.00215068im     -0.13543+0.0545513im   -0.0183498+0.1634im      0.00416401-0.070491im     -0.0849875+0.096747im      0.272219+0.192171im     0.0198651-0.00736173im  -0.0143532+0.123905im     -0.270972-0.22844im      -0.101244-0.127901im        0.10111+0.153806im
   -0.0312805-0.063882im      -0.146277-0.0664918im     0.224276+0.0935502im   -0.0337047-0.00722184im   -0.113124+0.0603028im     0.00655433-0.032279im      0.0368431-0.120326im     -0.0376735+0.144557im      -0.367817+0.092027im      0.0332506-0.225084im     -0.0669492+0.113097im      -0.0428565+0.00442341im   -0.0516902+0.031868im    -0.0871276-0.0287493im      -0.10001-0.0634255im  -0.0633631-0.115872im       0.225444+0.129718im     0.0464969-0.123566im      -0.292284-0.16012im       0.0475147-0.13637im     -0.0179272+0.0755762im    0.0846612+0.0358402im      0.138028-0.0228508im     0.288128+0.0523099im    -0.155825+0.129141im     -0.0564938+0.038541im     -0.072766+0.0754817im    -0.159949+0.0202975im   -0.0890712+0.0741199im  -0.00013571+0.0649332im     0.158611-0.262702im      0.0337754-0.250179im
    -0.158882-0.0319335im     0.0965256-0.0166526im     0.123043+0.0433394im    -0.176752-0.0181993im   -0.0503052+0.106964im       -0.127618+0.00643021im     0.134065+0.119973im      -0.121823-0.00413346im     0.117012-0.02844im       -0.134466-0.0616409im     -0.141354-0.062677im        0.088114-0.0730617im     0.0414728+0.177259im     -0.107064-0.0368814im    -0.0315625+0.0339756im   -0.173493+0.0181424im     -0.326292-0.0887994im   -0.0825391+0.132722im     -0.0119331+0.215709im       0.141445-0.140847im      0.017435+0.074043im      0.260644+0.155453im       0.217581-0.0656651im    0.0644664-0.029018im     0.0692453+0.00163315im    -0.127885-0.123219im      0.139845+0.16366im     -0.0575673-0.283385im    -0.0401147+0.0488404im    -0.230628-0.229032im    0.00735795+0.0763356im     0.0915239-0.126731im
    0.0532068-0.00644611im    0.0561998+0.173422im     0.0148245+0.207122im     0.0875928+0.0209641im    0.0181001+0.12934im        -0.265103+0.257845im      0.0245459-0.0767806im      0.181833+0.0644359im      0.107685-0.0385062im    -0.0255252-0.148256im      0.0351517-0.217955im      -0.0403972+0.187703im      -0.171752+0.116281im     0.0588021-0.0365718im     0.0721628-0.208172im    -0.130769+0.0434874im      0.169582+0.135309im    -0.0771582+0.246569im      -0.030243+0.012559im     -0.0671339+0.0178974im      0.34188+0.0184206im     0.144917+0.0655141im     -0.216368+0.249276im      0.100265+0.087im         0.087899+0.0354491im     0.0152156+0.12167im       0.049748-0.0226762im    0.0292134+0.0988582im    0.0147381-0.0795982im    -0.157304-0.00874146im    0.123824+0.0381485im    -0.0556155+0.0277567im
    -0.107697+0.153353im       0.087981-0.168043im     0.0299929+0.186767im    -0.0581762+0.0810114im   -0.0345834-0.290192im       0.0591924+0.0372685im     -0.129377+0.0305771im     -0.128041-0.0311591im      -0.28526+0.202657im      0.0402657+0.0337368im     0.0947539+0.110612im        -0.09369+0.18501im      -0.0200895+0.131373im     -0.116986+0.0286874im     0.0488392-0.0257923im    0.105805-0.269153im      0.0711554+0.0378694im   -0.0205217+0.147235im       0.305351+0.152384im      -0.028974+0.0128922im     0.032668-0.0205037im   -0.0372948-0.0410831im    -0.0336137+0.21653im      -0.138243-0.199756im      0.101924+0.0434323im    -0.0291648-0.0289496im      0.17035+0.0891842im   -0.0767297+0.0113477im    0.0196111+0.146596im     0.0568203-0.257975im      0.182662-0.0403608im    -0.0900359+0.0137872im
    -0.117558-0.0245447im    -0.0975515-0.117799im    -0.0384996+0.0766182im   -0.0812609-0.214263im      -0.14496-0.0731124im   -0.000584168-0.109217im    -0.00617828+0.15069im        0.271266-0.0394555im     0.0220799+0.233815im       -0.18048-0.155699im      0.0308942-0.000656745im    -0.207717-0.219718im       0.246409+0.0579867im    0.0693105+0.00728358im    -0.101562-0.144001im    0.0373707-0.0239093im   -0.00947418+0.0429354im    0.0897849+0.0329004im      0.116708+0.125654im       0.106924-0.143499im     0.0959409+0.0445642im      0.12149-0.15544im       0.0181138-0.0814525im   -0.0720938+0.234136im      0.239498+0.0703039im   0.000944237+0.0504639im    -0.182405-0.00609033im   0.0608342+0.120291im     -0.116047-0.0682384im     0.173092+0.14409im       0.183462+0.190442im        0.10779+0.0593007im
    -0.301884+0.130426im     -0.0889012-0.166687im     0.0398559+0.129645im       0.12841+0.0305204im   -0.0158105-0.0912938im      -0.271336-0.0282761im     -0.165889+0.0977894im      0.256172+0.0091729im    -0.0682464+0.00522159im  -0.00922941+0.0368703im     0.0216659-0.253101im       0.0421353-0.112833im        0.21531-0.0428877im   -0.0467768+0.000968111im   -0.010548+0.161998im   -0.0964664+0.0299004im    -0.0646059-0.0112152im   0.00650774-0.12275im       0.0318128-0.00158444im   -0.0193229+0.268535im     0.0350465-0.10683im     -0.0660727+0.137936im      -0.236855-0.0129181im    0.0786494-0.16457im        -0.1209+0.0195404im    -0.0414017-0.142526im     0.0277008-0.0327991im   -0.0907316-0.249127im      -0.03814-0.191539im    0.00128603+0.165629im     0.0585324-0.250372im      0.0511301+0.0223442im
      0.12687-0.142405im      0.0115081+0.262561im     0.0365389-0.0886427im    -0.029616+0.0759581im    0.0922945-0.171653im       0.0828695-0.164732im     -0.0151723+0.081071im       0.120818-0.018293im     -0.0213356+0.0516468im    0.00714761-0.0880121im      -0.19854-0.0542028im     -0.0527656+0.0484286im      0.138914+0.0688575im   -0.0700567-0.117622im       0.123391+0.0150025im   -0.185671+0.0660686im    -0.0390957+0.0619197im     0.328727+0.0988225im    -0.0305072-0.00921214im     0.105854+0.16577im     0.00230127+0.342966im     -0.130814-0.0558348im     -0.113242+0.0411236im     0.112698-0.0820726im    0.0517889-0.0843244im     -0.134147+0.205965im    -0.0782053-0.155307im    -0.0517278-0.254975im    -0.0427595+0.285675im     0.0832977-0.0916413im    0.0260654-0.0292124im    -0.0994931+0.128349im
    -0.277816-0.0884133im     -0.187748+0.0570736im    0.0994993-0.0367555im    -0.159853+0.12886im     -0.0324472-0.117966im       -0.208374+0.157808im      0.0602865-0.038343im       0.145384-0.0914953im      0.117853-0.122323im        0.25455+0.00436137im     0.117058+0.142722im       0.0413446-0.0837707im     0.0274834-0.0111519im    -0.208081+0.0936667im     0.0802038-0.0576629im  -0.0248527-0.10973im      0.00622218+0.0846644im     0.206399+0.0762034im     -0.166537+0.0962605im     0.0664765+0.0470921im    -0.206811-0.0991707im    0.0731404-0.0202662im     0.0647578+0.0830043im    0.0759217+0.182924im    -0.0568355-0.0737839im    -0.0408016-0.191357im     0.0175304+0.146301im     0.0559089+0.184074im      0.159878+0.148772im     0.0447953+0.0346798im   -0.0686523+0.0555312im     -0.204683+0.281337im

and then generate the state $ψ$

psi = P[:, 3]
32-element Vector{ComplexF64}:
  -0.03811175052834256 - 0.04308746355134663im
   -0.1268240056742122 - 0.04164638093124611im
   0.22433457173796428 - 0.01224784119135243im
 -0.047318143880821416 - 0.17589691670867im
   0.05872938504487633 + 0.1891846803974299im
   0.16080634021432333 - 0.15177737745476017im
    0.0173747821650781 + 0.03386877056493146im
  0.040653711277208654 + 0.15875644464531702im
 -0.016968697451176892 + 0.07630523717832369im
   0.07660327505157014 - 0.09574651032755518im
 -0.015887585891929318 + 0.13214674060764364im
  0.061648570501402086 + 0.28535581358860634im
  -0.20836874954157905 - 0.23434355422711195im
  -0.08944619879984558 + 0.004049090775458661im
   0.09446154940977645 - 0.12033990020282954im
  0.048164068676900304 + 0.13676689258451163im
  -0.04695870506493076 - 0.06897291862785376im
   -0.1528972406956424 - 0.22224058661550933im
 -0.019907449556633802 + 0.16818490455534835im
 -0.009965408845410976 - 0.05795129415142168im
  -0.09068167549299745 + 0.10577781479208588im
   -0.0867930518876916 - 0.03115372716620451im
   0.16858820683384837 - 0.055437501287022684im
   0.11971675236218077 - 0.07637427002863617im
    0.2846364706383585 + 0.08004009068919828im
   0.08445300273174541 + 0.09754638832542377im
  -0.20730754428312947 + 0.008011983660290128im
  0.038220358736171196 + 0.11524798997631855im
  -0.09594533968468119 + 0.010201300566593956im
  0.003913353453256593 + 0.015847677804556096im
    0.3508650193797296 + 0.0im
    0.0760479869824906 + 0.11017421776995755im

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.