Skip to content

Commit

Permalink
Fix registers.
Browse files Browse the repository at this point in the history
  • Loading branch information
fdmalone committed Sep 19, 2023
1 parent 4421bfa commit f32f15b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions qualtran/bloqs/chemistry/thc.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,15 +389,23 @@ def build_composite_bloq(self, bb: 'BloqBuilder', **regs: SoquetT) -> Dict[str,
plus_a = bb.add(Hadamard(), q=regs['plus_a'])
plus_b = bb.add(Hadamard(), q=regs['plus_b'])
# negative cotrol on flag register
less_than, flag_plus = add_from_bloq_register_flat_qubits(
bb, cz, less_than=less_than, flag_plus=flag_plus
less_than, plus_a = add_from_bloq_register_flat_qubits(
bb, cz, less_than=less_than, plus_a=plus_a
)
flag_plus, mu, nu = bb.add(CSwapApprox(bitsize=log_mu), ctrl=flag_plus, x=mu, y=nu)
plus_a, mu, nu = bb.add(CSwapApprox(bitsize=log_mu), ctrl=plus_a, x=mu, y=nu)
bb.free(bb.join(np.array([less_than, alt_theta])))
bb.free(s)
bb.free(sigma)
bb.free(keep)
bb.free(alt_mu)
bb.free(alt_nu)
out_regs = {'mu': mu, 'nu': nu, 'theta': theta, 'plus_a': plus_a, 'plus_b': plus_b}
out_regs = {
'mu': mu,
'nu': nu,
'theta': theta,
'plus_a': plus_a,
'plus_b': plus_b,
'succ': succ,
'eq_nu_mp1': eq_nu_mp1,
}
return out_regs

0 comments on commit f32f15b

Please sign in to comment.