Skip to content

Commit

Permalink
concentrate -> subroutine
Browse files Browse the repository at this point in the history
  • Loading branch information
Roger-luo committed Jul 7, 2020
1 parent 4451252 commit 5f03189
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions quick-start/2.qft-phase-estimation/main.jl
Expand Up @@ -134,14 +134,14 @@ ControlU(n, m, U) = chain(n+m, control(k, n+1:n+m=>matblock(U^(2^(k-1)))) for k
# 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 `Concentrator`, which creates a context of
# 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
concentrate(Hadamards(n), 1:n), # apply H in local scope
subroutine(Hadamards(n), 1:n), # apply H in local scope
ControlU(n, m, U),
concentrate(QFT(n)', 1:n))
subroutine(QFT(n)', 1:n))

# 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
Expand Down
2 changes: 1 addition & 1 deletion quick-start/4.shor-algorithm/main.jl
Expand Up @@ -108,7 +108,7 @@ feeding input `|1>⊗|0>` will get the resulting quantum register with the desir
function order_finding_circuit(x::Int, L::Int; nbit::Int, ncbit::Int)
N = nbit+ncbit
chain(N, repeat(N, H, 1:ncbit), KMod{N, ncbit}(x, L),
concentrate(N, QFTCircuit(ncbit)', 1:ncbit))
subroutine(N, QFTCircuit(ncbit)', 1:ncbit))
end

# The circuit for order finding is consisted of three parts
Expand Down

0 comments on commit 5f03189

Please sign in to comment.