Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HammingWeightPhasing Trotter costs #763

Closed
wants to merge 29 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
f5d3386
Add two-qubit fermionic FT gate and S gate.
fdmalone Mar 1, 2024
8449c9d
Update docstring.
fdmalone Mar 1, 2024
31a9f16
Add notebooks.
fdmalone Mar 1, 2024
f1a5646
Fix format.
fdmalone Mar 1, 2024
9719ef4
Fix test.
fdmalone Mar 3, 2024
422a6a2
Lint.
fdmalone Mar 3, 2024
5500386
Move ising model example to test bloq.
fdmalone Mar 4, 2024
3af59f1
Add bloq to build trotterized unitary.
fdmalone Mar 4, 2024
2ea89ae
Update notebook gen.
fdmalone Mar 4, 2024
77c5eef
Tidy docstring.
fdmalone Mar 4, 2024
769e0d6
Merge branch 'main' into more_basic_gates
fdmalone Mar 4, 2024
a04c3f4
Merge branch 'main' into add_trotterization_bloq
fdmalone Mar 5, 2024
678dac2
Merge branch 'main' into add_trotterization_bloq
fdmalone Mar 7, 2024
6c95cac
Add hubbard plaq bloqs.
fdmalone Mar 4, 2024
4ac866d
Update notebook.
fdmalone Mar 4, 2024
405094b
Merge branch 'more_basic_gates' into add_plaq_bloqs
fdmalone Mar 5, 2024
2a33cd9
Fix notebook + whitespace.
fdmalone Mar 5, 2024
2357558
WIP on notebook.
fdmalone Mar 5, 2024
3c4d38f
WIP.
fdmalone Mar 6, 2024
f123f2e
Updates.
fdmalone Mar 6, 2024
5bf4925
WIP.
fdmalone Mar 7, 2024
697f0c9
Finish up notebook.
fdmalone Mar 7, 2024
f4d92e2
Fix hubbard notebook.
fdmalone Mar 7, 2024
cb1d6fa
Fix notebook.
fdmalone Mar 7, 2024
3192b2e
WIP testing.
fdmalone Mar 8, 2024
bbb89f5
WIP.
fdmalone Mar 8, 2024
20f0173
Merge branch 'main' into add_hwp_plaq_bloqs
fdmalone Mar 8, 2024
b45ee22
Add HWP Trotter bloq costs.
fdmalone Mar 8, 2024
1a855c6
Compare to hamming weight phasing and reference values.
fdmalone Mar 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add HWP Trotter bloq costs.
fdmalone committed Mar 8, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit b45ee22c71c0fc710e4a1064f58bc7d2c7831830
2 changes: 2 additions & 0 deletions dev_tools/autogenerate-bloqs-notebooks-v2.py
Original file line number Diff line number Diff line change
@@ -220,7 +220,9 @@
bloq_specs=[
qualtran.bloqs.chemistry.trotter.hubbard.hopping._HOPPING_DOC,
qualtran.bloqs.chemistry.trotter.hubbard.hopping._PLAQUETTE_DOC,
qualtran.bloqs.chemistry.trotter.hubbard.hopping._HOPPING_TILE_HWP_DOC,
qualtran.bloqs.chemistry.trotter.hubbard.interaction._INTERACTION_DOC,
qualtran.bloqs.chemistry.trotter.hubbard.interaction._INTERACTION_HWP_DOC,
],
directory=f'{SOURCE_DIR}/bloqs/chemistry/trotter/hubbard',
),
8 changes: 4 additions & 4 deletions qualtran/bloqs/chemistry/trotter/hubbard/hopping.py
Original file line number Diff line number Diff line change
@@ -265,7 +265,7 @@ def build_call_graph(self, ssa: 'SympySymbolAllocator') -> Set['BloqCountT']:
# We use Hamming weight phasing to apply all 2 * L^2/4 (two for spin
# here) for both of these rotations.
return {
# (TwoBitFFFT(0, 1, self.eps), 4 * self.length**2 // 2),
(TwoBitFFFT(0, 1, self.eps), 4 * self.length**2 // 2),
(HammingWeightPhasing(2 * self.length**2 // 4, self.tau * self.angle, eps=self.eps), 2)
}

@@ -304,12 +304,12 @@ def _plaquette() -> HoppingPlaquette:
def _hopping_tile_hwp() -> HoppingTileHWP:
length = 8
angle = 0.15
plaquette = HoppingTileHWP(length, angle)
return plaquette
hopping_tile_hwp = HoppingTileHWP(length, angle)
return hopping_tile_hwp


_HOPPING_TILE_HWP_DOC = BloqDocSpec(
bloq_cls=HoppingTileHWP,
import_line='from qualtran.bloqs.chemistry.trotter.hubbard.hopping import HoppingPlaquetteHWP',
import_line='from qualtran.bloqs.chemistry.trotter.hubbard.hopping import HoppingTileHWP',
examples=(_hopping_tile_hwp,),
)
6 changes: 4 additions & 2 deletions qualtran/bloqs/chemistry/trotter/hubbard/hopping_test.py
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@
Ryy,
)
from qualtran.bloqs.qft.two_bit_ffft import TwoBitFFFT
from qualtran.bloqs.rotations.hamming_weight_phasing import HammingWeightPhasing
from qualtran.bloqs.util_bloqs import ArbitraryClifford
from qualtran.resource_counting.generalizers import PHI

@@ -142,6 +143,7 @@ def test_hopping_tile_hwp_t_counts():
bloq = _hopping_tile_hwp()
_, counts = bloq.call_graph(generalizer=catch_rotations)
n_rot_par = bloq.length**2 // 2
print(counts, 2 * 4 * (n_rot_par - n_rot_par.bit_count()) - counts[TGate()])
assert counts[Rz(PHI)] == 2 * n_rot_par.bit_length()
assert counts[TGate()] == 8 * bloq.length**2 // 2 + 2 * 4 * (n_rot_par - n_rot_par.bit_count())
assert counts[TGate()] == 8 * bloq.length**2 // 2 + 2 * 4 * (
n_rot_par - n_rot_par.bit_count() + 1
)
Loading