From f32f15bb79dd9d5404be24aba9eb37536193b569 Mon Sep 17 00:00:00 2001 From: Fionn Malone Date: Tue, 19 Sep 2023 05:42:39 +0000 Subject: [PATCH] Fix registers. --- qualtran/bloqs/chemistry/thc.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/qualtran/bloqs/chemistry/thc.py b/qualtran/bloqs/chemistry/thc.py index 5cbcdf75a..5aa0f5fed 100644 --- a/qualtran/bloqs/chemistry/thc.py +++ b/qualtran/bloqs/chemistry/thc.py @@ -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