using LinearAlgebra
const m = 2
const M = 2^m ;
QFT⁻¹(f ::Function, ξ ::Int) :: Complex{Float64} = sum( x -> exp(-2π*im * x*ξ/M) * f(x) , 0:M-1) / sqrt(M) ;
T = [ 1 0 0 1
1 0 0 -1
0 1 1 0
0 1 -1 0 ]' / sqrt(2)
H = T * [ 0. 0. 0. 0.
0. 1/4 0. 0.
0. 0. 1/4+1/32 0.
0. 0. 0. 1/13 ] * T'
eigvecs(H)
Λ = eigvals(H)
println("Eigenvalues:")
println("λ₁ = ", bitstring(Int32(round( Λ[1] * 2^32 ))), " = 0")
println("λ₂ = ", bitstring(Int32(round( Λ[2] * 2^32 ))), " = 1/13")
println("λ₃ = ", bitstring(Int32(round( Λ[3] * 2^32 ))), " = 1/4" )
println("λ₄ = ", bitstring(Int32(round( Λ[4] * 2^32 ))), " = 1/4+1/32" )