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

Transpiling double bracket iterations into hamiltonian simulation #1294

Draft
wants to merge 151 commits into
base: master
Choose a base branch
from

Conversation

marekgluza
Copy link
Contributor

This is a draft (code works ok and preparing for review)

This PR delivers a workeable structure for further development.
The point is to:

  • show you the idea of the DBI transpiling
  • ask you for your opinion for the design structure
  • if you agree then to ask one of you to take it over and combine this with Circuit gate counting techniques
  • the next 2 weeks I will not be able to work on this so let's make plans on matrix how to move ahead with gate counting

More specifically

  • there are 2 new files in /dbi
  • the goal was to propose a workflow which is capable of explaininig how the DBI transpiling into circuits must work (see overleaf for the revision of my paper)
  • the idea is that there is now a class EvolutionOracle that can be working underneath with Circuit or numpy. Numpy we have in double_bracket.py so it's backwards compatible and Circuit e.g. for counting gates
  • then there is the group commutator iteration file which is showing how to run the oracles. For the transpiling the key idea is the class FrameShiftedEvolutionOracle which recursively implements
    $$e^{it H_k} = e^{itU^\dagger H_0 U} = U^\dagger e^{itH_0} U$$
    which is what I refer to as frame shifting
  • using that we have the evolution oracle of the iterated input hamiltonian so we know how to relate the group commutator step to
    $$V = e^{is D_k}e^{isH_k}e^{-is D_k}e^{-isH_k}$$
    the $H_0$ evolution
    $$V = e^{is D_k}U^\dagger e^{itH_0} Ue^{-is D_k}U^\dagger e^{-itH_0} U$$

Checklist:

  • Reviewers confirm new code structure is reasonable.

Checklist:

  • Reviewers confirm new code works as expected.
  • Tests are passing.
  • Coverage does not decrease.
  • Documentation is updated.

Sam-XiaoyueLi and others added 30 commits January 25, 2024 14:17
…_scheduling_polynomial; test_double_bracket_iteration_scheduling_grid_hyperopt
#This will contain a class inheriting from double bracket and it will extend it by connecting to functionalities of TrotterHamiltonian
… the gaps. Next simplify, assume the oracles are numpy and then pass on to Matteo, Andrea, Edoardo to generalize the code to be backend independent
np.trace(Gamma_list[0] @ A) + np.trace(dGamma[0] @ d + Gamma_list[1] @ A) * s
)
for n in range(2, 4):
dGamma.append(dGamma_diDiagonal(d, H, n, i, dGamma, Gamma_list))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here dbi_object is missing as input of dGamma_diDiagonal. About the naming, follow Python convention (https://peps.python.org/pep-0008/#naming-conventions), i.e. function names should be lowercase.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wrightjandrew tomorrow Andrea will join us until 9:30 AM EU and we can ask more about your PR (your branch was merged into this one and this is something you might need to update in your PR cost function)

@marekgluza
Copy link
Contributor Author

@Edoardo-Pedicillo @MatteoRobbiati @andrea-pasquale we realized that this revert commit
e2232c0
unfortunately undid in #1269 the #1287 PR of Edoardo which outputs the the unitary of DBI - sorry!

This means that the master is affected to the pre #1287 state.

The suggested fix is to merge this PR: the branch dbi_fix was merged into it this preserved the git blame history etc https://github.com/qiboteam/qibo/blame/DBI-transpiling-into-Hamiltonian-Simulation/src/qibo/models/dbi/double_bracket.py so the contribution is intact

@andrea-pasquale
Copy link
Contributor

andrea-pasquale commented Jun 3, 2024

@Edoardo-Pedicillo @MatteoRobbiati @andrea-pasquale we realized that this revert commit e2232c0 unfortunately undid in #1269 the #1287 PR of Edoardo which outputs the the unitary of DBI - sorry!

This means that the master is affected to the pre #1287 state.

The suggested fix is to merge this PR: the branch dbi_fix was merged into it this preserved the git blame history etc https://github.com/qiboteam/qibo/blame/DBI-transpiling-into-Hamiltonian-Simulation/src/qibo/models/dbi/double_bracket.py so the contribution is intact

I see. I think that the easiest solution is just to open a small PR pointing to main that re-implements #1287.
Can you guys take care of it?
For the future, I know that tests were passing but I would let just coredevs merge PRs in master.

@marekgluza
Copy link
Contributor Author

Yep, this was some 'auto merge' workflow and coredevs should merge in the future.

We will prepare the PR.

@scarrazza scarrazza added this to the Qibo 0.2.11 milestone Jul 24, 2024
@scarrazza scarrazza removed this from the Qibo 0.2.12 milestone Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants