QuantumBFS / YaoLang.jl

YaoLang: The next DSL for Yao and quantum programs.
https://yaoquantum.org/YaoLang.jl/dev/
Apache License 2.0
31 stars 6 forks source link

use function signature in exec! when dispatching generic circuit #1

Closed Roger-luo closed 4 years ago

Roger-luo commented 4 years ago

currently this stack overflows

@device function qft(l::Int, n::Int)
    l => H
    for k in l:n
        control(k, l=>Shift(2π/2^(k-l)))
    end

    if n > l
        l+1:n => qft(l+1, n)
    end
end

@device qft(n::Int) = 1:n => qft(1, n)