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.218734+0.094038im      0.0213994+0.101275im     -0.0928351-0.0078242im    -0.127505-0.079878im      -0.181056+0.0115726im       0.0208499+0.341985im    0.0326693-0.0424602im    -0.157093+0.151681im       0.0705073-0.0712933im      -0.196631-0.159633im     -0.0359342-0.0705352im       0.2268+0.00709808im   -0.199155-0.0119471im     -0.173334+0.0176986im    0.187418-0.0237489im    0.0885377-0.031073im       0.123045-0.102305im    -0.0195493+0.0354185im    -0.0926951+0.259912im     -0.0542065-0.0752357im     0.134272-0.115727im    -0.0316227+0.165843im    -0.0193105-0.0410508im     0.012681-0.0243462im      0.0922186+0.0561299im      0.226195+0.0501915im     -0.0538163+0.0479852im      0.168402-0.226165im     -0.227285-0.254143im    -0.00747954-0.0639341im    -0.0311363-0.0096661im    0.0188115+0.0850201im
   -0.104173-0.11451im       -0.114581-0.265491im     -0.0384958+0.163139im    -0.0570433+0.0129259im    -0.0562963-0.0817311im       0.0977054+0.162591im    0.0229801-0.132863im     -0.453507-0.190172im       0.0808894-0.0150016im    -0.00748734+0.123883im      -0.179732+0.151914im     -0.256817-0.11146im      0.0556168+0.0544623im    -0.0258291+0.0247179im  -0.0119678-0.156462im       0.11395-0.10235im      -0.0954545-0.0870053im    -0.109457-0.0480492im     0.0998418+0.173336im       0.275493-0.175395im     -0.140235+0.190717im     0.0557945+0.0174366im    0.0166016-0.134738im     0.0858894+0.0716765im   -0.000506219+0.0030567im     -0.150176-0.0646989im      -0.175125-0.0725777im    0.00733912-0.0382533im    0.0923767-0.022894im      0.0197106-0.017316im      0.0191565+0.0166414im   -0.0323234+0.00484588im
  -0.0222282-0.0904142im     -0.201016-0.0919456im     -0.140636+0.0438661im    0.0679816+0.0427968im        -0.263+0.0283983im       0.0858417+0.0444872im    0.210416-0.117567im    -0.0227546-0.00465183im   0.000895792+0.0912896im      -0.114481+0.190114im      0.0377761-0.0335783im     0.165973-0.0323737im   -0.0297235+0.00267126im     0.312349-0.029833im   -0.0895147+0.30642im      0.0271325-0.0401583im    -0.0712733-0.103791im    -0.0501891-0.119272im    -0.00835503-0.082388im      -0.115497-0.134331im      0.100573-0.223241im    -0.0901478-0.14026im       0.149593-0.0598688im    -0.161606-0.0103193im      0.0166819-0.116196im     -0.0131281+0.0434073im      0.0906002-0.0104863im     0.0205884-0.204819im      0.172732+0.160534im     -0.0723793-0.0866195im      -0.15442+0.10258im      -0.307496+0.0971989im
   -0.149421+0.091602im     -0.0933914+0.227463im     -0.0381302+0.028421im     -0.188675-0.193116im     0.00962766+0.150947im       -0.0681763+0.0407356im    0.334387+0.0798599im    0.0115311-0.0503265im     -0.0347925-0.08983im       -0.0777465+0.0161114im     0.0775452-0.086994im      0.104447-0.24454im      -0.126957+0.0102392im     0.0113941-0.0172601im   -0.291866-0.0171138im    0.0920193-0.0552079im      0.121277+0.0446312im    0.0962243-0.229997im     -0.0213091+0.00323729im  -0.00191784-0.0439441im   -0.0275309+0.199405im      0.170179+0.0128483im   -0.0493328+0.031077im     0.0919388+0.063529im       -0.145286-0.146542im     -0.0633818+0.0328865im     -0.0267439+0.30838im       -0.133527+0.115315im      0.145101-0.025769im       0.178384+0.200204im       0.128515+0.13601im     0.00544628+0.00509193im
  -0.0704121+0.0210787im     0.0267917-0.0441757im      0.217802-0.0722117im    0.0459925-0.177045im      -0.111895-0.233795im         0.162478+0.0356783im   0.0734144-0.240581im     0.0905957+0.0775im         -0.206443+0.032018im       0.0838934+0.0380629im     0.0413991+0.249828im    -0.0436789-0.124623im     0.0172051-0.137813im      -0.153439+0.179174im    0.0233477+0.0503683im     0.050221-0.0238918im      0.112485+0.165671im      0.129922-0.0181529im    -0.0883439+0.0542816im     -0.286587+0.149137im     -0.149133-0.10355im       0.115397+0.0646983im    -0.039045-0.192374im      0.182609+0.070371im       0.0206615-0.103683im      0.0233223-0.0621073im     -0.0794298-0.0860372im      0.288817+0.126848im     0.0868581+0.185685im       0.146067-0.100457im       0.019457+0.0121989im    -0.112394+0.059474im
    0.174564+0.147499im      -0.233681-0.111352im       0.123187-0.0272998im      0.20594+0.0985543im     -0.080757+0.119514im        -0.322506-0.0127145im   -0.107342+0.13078im      0.0860683-0.0797836im      -0.241561-0.0247052im     -0.0388302+0.188529im      -0.131961+0.0175971im    0.0112825-0.0607851im   -0.0271603+0.10049im        -0.20007-0.0260452im  -0.0920893+0.104235im     0.0755606-0.171453im       0.128465+0.0658429im     0.122046-0.0127861im      0.012639+0.0846778im     0.0486039-0.0498336im   -0.0486717-0.0427654im     0.213091+0.0155304im    0.0538455-0.208439im     0.0451733+0.0289547im       0.105816+0.177924im       0.154627+0.227559im       0.0289915+0.0554963im     -0.107912-0.137258im      0.109118-0.113158im        -0.1203-0.217757im       0.151216-0.0676259im  -0.00950677-0.0869746im
   0.0365447-0.0319191im    -0.0267035+0.227793im      -0.158473+0.0902681im    0.0771169-0.0202121im    0.00629335-0.148197im     -0.000923755+0.170785im    -0.111946-0.128651im      0.170832-0.158492im          0.1646-0.187159im       -0.196246-0.0986887im     -0.102689+0.0424444im   -0.0917101+0.0831404im     0.190333-0.130105im     -0.0878945-0.0664148im  -0.0869186+0.0545075im     0.135267+0.135055im      -0.141144-0.0666023im     0.011606+0.140987im       0.144662-0.0246155im     0.0326602+0.0867345im    0.0478521-0.0526059im    0.0346395-0.199144im     -0.214825-0.1278im     -0.00684285+0.0355063im     -0.0101452-0.117964im   -0.000657235+0.060473im       0.0263097+0.252583im       0.168309-0.0402984im    0.0221899+0.134144im      -0.248776-0.0548253im      0.337461+0.161816im    0.00761519-0.025531im
    0.155534-0.18564im       -0.104703+0.0116609im      -0.34601-0.0926503im   -0.0642128+0.0118809im     0.0302484+0.107773im         0.111485-0.0566546im   -0.150487-1.25095e-5im   -0.161349-0.185733im      -0.0183684+0.132428im      -0.0282533+0.115297im     -0.0192803+0.172944im     0.0297837-0.0730584im    -0.056002+0.00773964im  -0.00493347+0.0582911im   -0.136143-0.291756im    -0.0338271+0.0609854im   -0.00873906-0.12022im       0.128304+0.100429im      -0.236962-0.188056im      -0.370479-0.0909818im    0.0722731-0.0461573im   -0.0116464+0.123236im    -0.0466004+0.0945572im    0.0564429+0.0756428im      -0.215425+0.0136192im      0.095512+0.0796277im      0.0471389-0.0422024im     0.0223698+0.0301128im   -0.0333746-0.120137im      0.0636157-0.225763im       0.125195+0.104034im     0.0534144-0.120496im
   -0.198423+0.019858im      -0.123669-0.0363162im     -0.201024-0.031827im    0.00236673-0.0385785im     0.0647372-0.0333651im       -0.142771+0.028382im    -0.129104+0.0558528im    0.0264082-0.00219825im     -0.231275-0.122998im       -0.123112-0.0514061im     0.0329744+0.00241796im    0.042302-0.116388im    -0.0912229+0.163628im      -0.228599-0.0204522im    0.120496+0.23028im     -0.0556217+0.133733im       -0.25064-0.00996414im   -0.110659-0.0729035im    -0.0451059-0.0760971im     -0.037029-0.119508im     0.0102652+0.107962im      0.264397-0.0188142im    -0.199025+0.30084im       0.100961-0.138413im      -0.0341683-0.13674im       -0.137173+0.0583714im      -0.062338-0.301082im    -0.00664809+0.0474963im   -0.0112924+0.177751im     -0.0838317-0.104422im     -0.0716434-0.0493532im    0.0280473+0.179433im
   -0.193746+0.0367105im      0.223327+0.0291132im      0.242231+0.0990272im    0.0911252+0.0616822im     0.0362813-0.00121123im      -0.243667+0.0549167im    0.101302-0.115742im    -0.0320641+0.0548323im     -0.0516094+0.191395im       -0.169638-0.0183808im    -0.0101807+0.0298146im    -0.082619+0.0105881im    -0.192136-0.165836im       0.241919+0.148151im     0.103856-0.145571im    -0.0597239-0.00270825im    0.0502292+0.0208954im   -0.0277408-0.0557641im     -0.162261-0.157852im     0.00984682-0.0757092im     0.116215+0.0500768im    0.0731058+0.102052im     -0.130934-0.162998im     -0.173485-0.100883im      -0.0995841-0.114019im      -0.105446-0.000652555im   -0.0460496-0.174718im      -0.225597-0.0181138im    -0.109608+0.0464415im      -0.21575-0.131489im       0.289921+0.099281im    -0.0506114-0.097766im
   -0.110984-0.0707203im     -0.107436+0.110757im       0.128218+0.00327462im   0.0712737+0.0651797im      0.241022-0.0184501im        0.179112+0.0414753im    0.114659-0.0481816im   -0.0202129-0.236149im        -0.11011+0.0370203im      -0.174457-0.0663596im    -0.0281272-0.141197im     0.0546218+0.0475046im    -0.160743-0.144394im       0.153138+0.0467562im   -0.111398-0.055774im     -0.208321+0.0805917im    -0.0995249+0.242305im    -0.0659877+0.141608im       0.223639+0.191037im    -0.00767011+0.128715im     0.0498842+0.0722422im    0.0913252+0.0617595im   -0.0891291-0.0338044im    0.0758508+0.269755im       -0.156857+0.0729206im      0.111226+0.152572im       0.0867448-0.0334588im    -0.0175939-0.0511569im     0.086293-0.0233579im     -0.110357-0.168647im        -0.3372-0.102425im       0.05944-0.00799424im
     0.13955-0.0299303im      0.138171+0.131558im       0.113588-0.0664313im     0.220593-0.159179im      -0.125355+0.187633im       -0.0533684-0.0993652im   0.0529503+0.25624im     -0.0404127+0.0296493im      0.0783021+0.0464475im      -0.150133+0.0706146im     -0.176684+0.202121im     -0.147374-0.0690204im    -0.176035-0.0433705im     0.0293141-0.227607im    -0.123143-0.0208692im    0.0573346+0.234579im      -0.133697+0.127446im     -0.130656+0.04337im       0.0135462+0.170144im     -0.0550636-0.0172022im     0.138434+0.0178665im    0.0215503-0.146842im     0.0532086-0.053235im    -0.0337266-0.125567im       0.0161302-0.202273im     -0.0382229-0.277462im      -0.0119005-0.0311981im      0.125161-0.0967525im    0.0197616-0.105204im       0.215962-0.159668im    -0.00894792-0.146418im      0.102993+0.111333im
    0.226942+0.0147626im     0.0255258-0.143884im      0.0404218+0.0345473im    -0.148327-0.0439227im     0.0184141-0.237781im        -0.211436-0.0853139im   -0.106852-0.0596341im   0.00476436+0.0889266im     -0.0632034+0.07602im        0.0057451+0.154428im      0.0920986+0.0606326im      0.28838+0.0549158im    -0.163952-0.156117im      -0.122228+0.0168184im   0.0364181+0.0341358im    0.0666775+0.0159862im     -0.264799-0.0402492im     -0.37801-0.117259im    -0.00572437+0.191703im      -0.146306+0.0211698im    0.0038729+0.214063im      -0.11944-0.032805im    -0.0276378-0.0255836im     0.083024+0.111457im      -0.0436738-0.0342961im      0.114826-0.189552im       0.0154956+0.17438im       -0.107667+0.00764689im   0.0309109-0.0224755im    -0.0930928+0.0310539im    -0.0476671+0.19213im     -0.0030393-0.221418im
  0.00985448+0.136327im       0.387398+0.167352im      -0.117681+0.0190473im    0.0809718+0.140359im      -0.197777+0.248636im        -0.188615+0.0101353im  -0.0781556-0.136608im     -0.132715-0.102747im        0.129969+0.0997515im      0.0888205-0.0271861im     0.0933931+0.0506677im      0.17946-0.0944193im     0.280048-0.00719895im    -0.180518-0.0559417im  -0.0801474-0.032205im     -0.133743-0.0412145im     0.0606235+0.173887im     0.0130806-0.0197214im      0.120637+0.0368415im    -0.0582134-0.0599019im    0.0793394+0.205484im    -0.0217063+0.00077696im   -0.102817+0.0537149im   -0.0274325+0.189485im      0.00624023+0.0441933im     0.0180169+0.0312632im       -0.16024-0.0650235im     0.0150111-0.117415im     0.0161364+0.227522im      0.0585064-0.0525513im     -0.115668-0.0418497im    -0.252345-0.058272im
   -0.214141+0.0860583im     -0.135588+0.00580461im     0.137312+0.0171925im     0.126442+0.259115im     0.00315646+0.0841199im        0.050958-0.0467524im   0.0642826+0.0853387im    -0.083458-0.262027im       -0.125121+0.059515im        0.151848-0.134338im       0.102394+0.0533878im   0.00934541+0.0794246im   -0.0714099+0.115768im      -0.120107-0.0152583im  -0.0545823-0.0634608im    0.0291699+0.0824692im      0.152083-0.0667052im    -0.255626-0.157524im     -0.0389283+0.0592611im     0.0212464+0.0071379im     0.129497-0.36508im      -0.294811-0.0663398im    -0.138326+0.102718im      0.207971+0.0916281im       0.141718-0.112871im     -0.0227417-0.0783585im      -0.073288+0.0802261im    -0.0531874-0.00767167im  0.00143749+0.190572im      0.0653561-0.0584374im      0.127061+0.056896im      0.157121-0.105192im
   0.0175402+0.037556im      0.0855632+0.0653im        0.0132714-0.120415im     -0.151198-0.0571469im    -0.0208238-0.0753158im      -0.0496107-0.048611im     0.218321+0.209613im     -0.168355+0.16334im         0.012466-0.237708im       0.0657292+0.0825992im    -0.0642444+0.0621246im    0.0930664-0.0242496im   -0.0606107-0.0164676im    -0.0320496-0.0845541im    0.249051-0.298911im     -0.360763-0.0149099im     -0.110589-0.15059im      0.0468343-0.0795332im      0.157441+0.0215556im     0.0321119+0.195077im    0.00614279-0.165879im     0.0105018-0.226595im      0.051992+0.0429479im    0.0641488+0.0467625im      0.0479113+0.0218496im      -0.09599+0.213192im       0.0334319-0.0700266im     0.0490385+0.0255481im      0.23054+0.00972627im   -0.0475055-0.16689im        0.148131+0.0467724im    -0.176181-0.0822706im
    0.166821-0.0634853im     0.0855945+0.0725347im    -0.0823997-0.22634im     -0.0703746+0.230648im      0.0200264+0.00744756im     -0.0772699+0.0711486im    0.025825+0.0648898im    -0.169513-0.0406628im      -0.115538-0.168411im       0.0280372+0.0531123im      0.180956-0.0165466im    -0.210268-0.0686443im   -0.0192081-0.0972474im      0.194815-0.144547im     0.148742+0.121685im    -0.0730574+0.0285826im      0.025349+0.157315im     -0.158328-0.091988im     0.00960705-0.125705im      -0.110391-0.0734885im   -0.0889907-0.122065im      0.243903+0.215755im      0.167456-0.0606943im     0.105696+0.134868im        0.035325-0.11788im       -0.068893-0.00632362im     -0.117409+0.140265im       0.230013-0.180571im     -0.140592+0.00920665im    -0.168113+0.232499im      0.0255221-0.0498289im     0.108195-0.1239im
  -0.0107512+0.0433623im    0.00560459-0.0579347im    -0.0779966-0.101558im      0.187443+0.00819675im    0.0665819-0.0372876im       0.0549758+0.0527369im  -0.0497319+0.137206im     0.0553816+0.0495309im      -0.117656-0.0921037im       -0.23144-0.315258im     -0.0763621+0.083573im    -0.0894432-0.140067im     0.0053852+0.0434048im     0.0225921-0.117043im    -0.104289-0.0201329im    0.0137472-0.449844im     -0.0787187+0.069449im     -0.133796-0.183494im      0.0574011-0.15886im      -0.0979953+0.152049im    -0.0296191-0.0630544im    -0.191177-0.124803im     -0.097452-0.0722199im    -0.033702-0.0427363im       -0.25029+0.176092im      0.0354135-0.0966402im      -0.217472-0.113176im      0.0466981-0.0162722im   -0.0388729-0.157677im       0.024618+0.110343im     -0.0786239+0.119798im     -0.150125-0.10671im
  -0.0823691-0.0149366im      -0.17859-0.0790262im   -0.00583119-0.0760475im    0.0451549+0.0647056im       0.10227+0.139929im        -0.144665+0.0570149im    0.133925-0.0603187im     0.100806+0.192522im        0.104224-0.102286im       -0.110404+0.177513im     -0.0532516-0.116118im     0.0897936+0.119475im      0.290558+0.0487643im      0.168281+0.053832im     0.203394-0.0874928im  -0.00922065+0.0175249im   -0.00197519+0.19698im       0.102411-0.0753477im     -0.137644-0.00899106im     0.106418-0.135483im     -0.025921+0.0076944im   -0.0495424-0.0568307im    -0.135956+0.102123im      0.305189+0.0620988im      -0.225809+0.10627im        0.104999-0.408174im       0.0412771+0.0266227im      0.159663-0.0727683im    0.0582177+0.0177056im     0.0304757-0.144818im      0.0776583-0.0628942im    0.0122317-0.0618021im
   0.0318851+0.213653im      0.0499585-0.0740565im     -0.255795+0.143455im      0.097958-0.0235004im    -0.0150589+0.0163908im       0.0177809-0.259361im     0.126494+0.0224965im     0.150781-0.120832im        0.254943-0.127982im       0.0619726-0.0615334im     -0.144871-0.0654903im    -0.129289+0.0143458im    -0.284177+0.0940151im      0.031511+0.330595im     0.123211+0.12427im     -0.0971545+0.102308im     -0.0143791+0.112701im     0.0411654-0.00221925im     -0.02839+0.105429im      -0.216324-0.222015im    -0.0726889+0.0140919im    -0.120522-0.0771386im    -0.115964-0.168413im      0.171784+0.0383642im      0.0744946+0.0495715im     -0.153892+0.0769932im     -0.0739827-0.0102043im     0.0338656+0.00990624im  -0.0183755-0.12905im      -0.0561329+0.121902im    -0.00106698-0.0955995im    -0.122559-0.14385im
  -0.0333705-0.126841im       0.140943+0.0679916im    0.00885988+0.136376im     -0.114777+0.111413im      0.0888215+0.10634im         -0.220318+0.101262im    -0.135028+0.0622085im     0.143097+0.11372im     -0.000851128+0.143856im       0.0504639+0.11879im       -0.200378+0.136013im     -0.150292+0.0610833im    -0.152434-0.0371284im     0.0152644-0.0145174im   -0.134521-0.012726im     -0.169049-0.174391im     0.00405719-0.00629119im   0.0772751+0.0497721im    -0.0458946+0.213459im       0.120139-0.180773im     -0.162487-0.228417im    -0.0717069+0.0849202im    -0.141898+0.120198im     0.0849312-0.170649im      -0.0901848-0.122339im      0.0557216+0.143173im       0.0643584+0.067124im        0.24511+0.0441381im     0.118225+0.105439im      -0.015011+0.138842im      -0.242987+0.263983im   -0.00525619-0.00681982im
   -0.160693+0.140832im     -0.0476857-0.101847im      -0.152231-0.0264905im    -0.200245-0.0710405im       0.10331-0.114031im        0.0042656-0.0528448im    -0.14981+0.228911im    -0.0541723+0.143362im       -0.167838+0.053394im       0.0118807-0.0937019im     -0.251715-0.00108267im  -0.0752626-0.0545715im     0.100036+0.113657im      0.0788198-0.0998104im  -0.0687727+0.0549837im   -0.0952962+0.0332852im      0.351485+0.0758288im   -0.0381015+0.0696831im     0.0184845+0.0979105im    -0.0995598-0.00107132im  0.00319096+0.229956im     -0.258869+0.0456548im    0.0911489-0.0696068im    -0.105801+0.204547im      -0.0360345-0.279147im      0.0443539-0.0868176im        0.20234-0.023558im      0.0552826-0.0618263im    0.0385534+0.125456im      -0.216462-0.0346246im      0.128692-0.0915868im   -0.0828866+0.0325071im
    0.166576+0.213502im    -0.00879715-0.138035im     -0.0266058+0.0842581im    -0.229472-0.0795768im     -0.212591-0.000258451im   -0.00230847+0.0216491im    0.197999+0.119746im     -0.152692-0.156601im      -0.0539294-0.0443373im       0.205158-0.0606326im    -0.0663376-0.373519im     -0.099678+0.221803im     0.0345537-0.191144im     -0.0790716-0.121931im     -0.16354-0.0387795im   -0.0333968-0.0516709im    -0.0264122+0.126568im     -0.036535+0.0686638im     0.0618264-0.0262894im     -0.145902-0.0656437im   -0.0709932-0.152723im      0.122572+0.0495993im    -0.197727-0.0283114im   -0.0968664-0.196241im      -0.0919638+0.0671876im      0.136512-0.219029im     -0.00531563-0.147522im    -0.00481554+0.102523im    -0.0270127+0.0800396im    -0.0950945-0.0880931im     0.0263307+0.107653im     0.0190851+0.118777im
   0.0977377+0.144674im      -0.128745+0.0818106im     -0.138411+0.00804105im    0.147434+0.0106257im      0.118794+0.0574035im       0.0829877-0.123446im    0.0124215-0.0567898im   -0.0699924-0.0535998im      0.0787639-0.0702093im       0.135497-0.098906im      0.0051443+0.259522im     0.0254697+0.0965533im     -0.23782+0.0464243im      -0.16163+0.0527719im     0.17286-0.148811im     0.0424363-0.0401232im     0.0406251+0.152847im    -0.0770186-0.182284im     -0.0542398-0.0551855im      0.251055-0.00786495im    0.156298+0.00760493im    0.140381+0.143604im      0.162917-0.0675119im    -0.192824-0.0834745im      -0.215616+0.0584372im      0.119906-0.109601im        0.202674+0.188199im       0.117666+0.120956im    -0.0139248+0.21479im       -0.137845-0.00991302im   -0.0641805+0.0235162im    -0.191066+0.183365im
  -0.0305825-0.0235247im   -0.00134602+0.0286037im    -0.0664227-0.0371082im     0.231077+0.17451im      -0.0661518-0.212654im        -0.215138-0.0232865im   0.0926556-0.203356im    -0.0474514-0.0389912im     -0.0765112-0.0903033im     -0.0662472+0.022954im       0.192001-0.14245im      -0.258141-0.00860692im   -0.195108+0.0509813im     -0.115653-0.0849629im   0.0312985-0.116354im     -0.108273-0.205648im     -0.0437223-0.137541im      0.381016+0.0751516im      0.068672+0.104171im      -0.181637-0.0163859im    0.0689002+0.121092im     -0.175149-0.0196066im     0.099065+0.158194im    -0.0896975+0.0525799im      0.0693211-0.0991082im     0.0218482-0.265148im      0.00444753+0.13921im      -0.0382721+0.0586584im       0.1028-0.0180083im    -0.0802486-0.0148192im    -0.0632726-0.0319642im     0.104783+0.159574im
   0.0477458+0.117874im     -0.0219565+0.0791344im     0.0919421+0.25953im      -0.173369-0.0289046im     0.0361792-0.191339im       -0.0192784+0.186176im    -0.166434-0.0175638im   0.00646018-0.0827041im      0.0390885-0.0825424im       0.144433-0.113109im      0.0141952+0.06077im       0.123243-0.0995844im     -0.11572+0.180277im      0.0352687-0.0952762im  -0.0296749+0.0917209im    -0.258913+0.0289677im    -0.0247288-0.0153782im     0.110731+0.153802im      -0.175389-0.287299im       0.118949-0.0201968im   -0.0230296-0.10699im      0.0461612-0.0380308im    0.0116812-0.161001im    -0.0111751-0.0521889im     -0.0870734-0.126406im    -0.00612878-0.22691im        -0.202921+0.190504im     -0.0864578-0.119241im      0.125129-0.0461327im     0.0873999-0.198847im       -0.18322-0.207249im   -0.00981617-0.182335im
    0.276918-0.00424561im   -0.0845359+0.167088im     -0.0296649+0.0676104im     -0.12943-0.0652807im      0.164032+0.139309im         0.164503+0.0597393im   -0.130826-0.0922002im    0.0664505+0.0477383im      -0.186486+0.000615271im    -0.105425-0.0842545im      0.209175-0.103995im     -0.146529+0.208286im     -0.123049+0.016105im     -0.0105644-0.102118im    0.0487786+0.0461097im    0.0833053+0.0620997im      0.012607+0.0683841im     0.163421-0.0194487im      0.035662+0.221913im       0.162122-0.107089im      0.099476-0.041482im    -0.0368992+0.0386133im     0.114705+0.0547326im    0.0506004+0.0978983im       0.076699-0.127113im     0.00807003-0.0858681im      -0.179124-0.287525im     -0.0808625+0.0214398im    0.0818727-0.04145im        0.106672-0.0194959im      0.166221+0.120633im     -0.361741-0.177346im
  -0.0343516+0.218459im      0.0590725+0.0813297im     -0.201741-0.196948im    -0.0653345+0.181899im      0.0905333-0.198268im        -0.131815+0.0945436im  -0.0362113+0.0398397im   -0.0610023+0.014622im       0.0214921+0.0305358im       0.078531-0.00768235im     -0.14863+0.148899im    -0.0345578+0.218262im     0.0600689-0.0447158im      0.116486+0.200744im   -0.0779332+0.0121586im     0.160306-0.0840053im     -0.141529+0.187705im     0.0130432+0.0140971im     -0.120762+0.0138418im     0.0315892+0.148614im     -0.050632-0.175222im      0.138179-0.014303im      -0.06556+0.0992957im   -0.0410812+0.223928im        0.159102-0.11068im       -0.121424-0.0593997im      0.0799225+0.0269062im     -0.278237-0.0981996im    0.0370087-0.211448im       0.217132-0.0477885im     -0.042269+0.0788954im    -0.109931+0.258207im
   -0.123939+0.0462545im   -0.00208359-7.35079e-5im    0.0125034+0.0662402im      0.21506-0.0444637im    -0.0492389+0.0554573im      -0.0677124-0.134004im   -0.0428826+0.00943808im  0.00749159-0.0424721im      -0.279091-0.180863im        0.237237+0.160826im     -0.0179703-0.0476853im    0.0657183-0.0333005im    0.0458485-0.128148im      0.0586442+0.150665im   -0.0218242+0.0594553im   -0.0340271+0.0981136im      0.113718-0.2851im      -0.0635037+0.211618im      0.0501723+0.0914209im      0.146377+0.00998777im  0.00194107-0.0693126im      0.11613-0.115523im     -0.019261+0.127087im     -0.195581+0.202511im       -0.298581-0.0877943im    -0.0383719-0.106718im       -0.145161+0.0305558im      0.167935+0.0545325im     -0.24507-0.262084im      0.0341307+0.0428191im    -0.0159764+0.0903542im    -0.177268-0.0178037im
  -0.0765522+0.0760542im      0.189563+0.095503im      -0.133044+0.105961im      0.081623+0.0925813im   -0.00998772+0.14116im          0.117185+0.185392im    0.0312377+0.212443im     0.0700183+0.0763268im      -0.196499-0.00814334im     0.0653176+0.132973im      0.0426962-0.0142699im    0.0149161+0.121206im     -0.142006+0.101221im        0.17672-0.0485269im   0.0839876-0.0106544im     0.271812+0.0142575im    -0.0342928-0.156528im    -0.0707058+0.0462734im     0.0458637-0.194953im     -0.0205569+0.0445126im   -0.0968467+0.217937im    -0.0369434+0.169714im     -0.162733-0.0926243im   -0.0518268+0.107456im        0.258739+0.190214im     -0.0446904-0.0884521im     -0.0281138+0.0681677im      0.206365+0.255073im      0.236001-0.00676918im   -0.0368234-0.211898im     -0.0903417+0.0431315im   0.00439166-0.040183im
   -0.167855-0.0435463im    -0.0378878+0.00940827im     0.146817+0.149673im      -0.13888-0.0903343im     -0.218474+0.113266im        -0.102606-0.016912im    -0.046106-0.0408506im     0.204885-0.0738744im        0.16417+0.0196261im      -0.149775-0.123558im    -0.00932614+0.0797666im    -0.207127+0.134597im    -0.0453377-0.0308462im    -0.0932594-0.0608569im  0.00474637-0.147926im     0.0639049-0.0621793im      0.114154-0.0492078im    -0.215249+0.0079948im     0.0535958-0.225121im      -0.131686-0.0515975im    -0.197703-0.0403875im     0.192875-0.111841im      0.274258+0.264406im      0.139564+0.236547im       0.0762342-0.0081128im     0.0377834-0.0836159im       0.154414+0.00263599im   -0.0421803+0.0904442im   -0.0554079-0.111167im      -0.128551-0.0956682im     -0.127724-0.0540345im    -0.193527-0.0658739im
 -0.00240465+0.250818im      -0.227908-0.114453im     -0.0141102+0.185981im    -0.0233254+0.127105im       0.212493+0.00417344im       -0.10991+0.0425035im    -0.10594+0.0354564im    -0.140224+0.0183127im       0.109109+0.243488im       -0.180999+0.134325im       0.251535-0.0558767im    0.0654267-0.141665im    -0.0383457-0.161865im      -0.106391-0.111245im     0.053129-0.110112im     0.0333446+0.120222im      0.0492463+0.0991946im     0.121391-0.107039im       0.178606-0.116738im     -0.0330672+0.0525005im    -0.170616-0.0978913im     -0.04044-0.155938im     -0.152948-0.0823494im    -0.171297-0.00605235im     0.0845158-0.0877259im      -0.16101+0.0161143im       0.178539-0.0373474im      0.259255+0.0804963im    -0.149876-0.141224im       0.134118+0.0523666im    -0.0548395-0.0592479im   -0.0653055-0.0215778im

and then generate the state $ψ$

psi = P[:, 3]
32-element Vector{ComplexF64}:
    -0.1000022036469095 + 0.016990059102567664im
    0.06690165572079525 - 0.026860524409264855im
   -0.25615841833707226 - 0.206383364881423im
  -0.050388535722166214 + 0.07707598450060288im
   0.047229589185088613 - 0.261536007794936im
   -0.23006544466538165 + 0.11399671746434321im
    0.06354758942003738 - 0.028413723187323946im
 -0.0016779012468197615 + 0.12370446671983194im
    -0.1156760839572377 - 0.12667819603852373im
     0.2580379332046902 - 0.04492743300904126im
  -0.011569877580076687 + 0.02203343397711699im
   -0.05454289328370482 + 0.075504072279383im
    0.01877821759814146 - 0.027624591028043384im
    0.01989869940319203 - 0.015094665250017576im
    0.07500938662248616 + 0.02124181549682436im
   -0.16186355134637495 - 0.048364998887205336im
   -0.02263479720466484 + 0.04338276944860166im
    0.05631494684295382 - 0.23216923239209636im
    0.23428682044905302 - 0.023896915144058867im
   0.053166932323188094 + 0.07413632084907637im
   -0.03874520262404214 + 0.0694068356881054im
    0.04385782569778684 + 0.07193822977947678im
     0.1209698395850965 + 0.1040602388211353im
    -0.0157085660297708 - 0.07746486224615479im
   -0.00665969362617836 + 0.11765987718112064im
     0.3448123475288227 + 0.08132025277341436im
    0.03496262583007144 - 0.11907742676345995im
   -0.11380993917373612 - 0.053085522279883626im
   -0.11338520108168905 + 0.26566672685314696im
   0.014343321039668996 - 0.03349353512680017im
    0.11036391260311632 + 0.021912002695643758im
      0.362023353574526 + 0.0im

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.