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 leakage #720

Merged
merged 12 commits into from
Sep 13, 2024
Merged

Add leakage #720

merged 12 commits into from
Sep 13, 2024

Conversation

a-corni
Copy link
Collaborator

@a-corni a-corni commented Aug 9, 2024

Implements the "leakage" noise. When "leakage" is provided as a noise in the SimConfig:

  • Adds a state "x" in the eigenbasis of the computation.
  • Rebuilds, the basis, dim, op_matrix associated to the computational basis
  • Rebuilds the operators in Hamiltonian (see construct_hamiltonian) since they changed size
  • Modifies the initial state of QutipEmulator (defaults to "all-ground")

pulser-core/pulser/channels/base_channel.py Outdated Show resolved Hide resolved
pulser-simulation/pulser_simulation/hamiltonian.py Outdated Show resolved Hide resolved
pulser-simulation/pulser_simulation/hamiltonian.py Outdated Show resolved Hide resolved
pulser-simulation/pulser_simulation/simresults.py Outdated Show resolved Hide resolved
pulser-simulation/pulser_simulation/simresults.py Outdated Show resolved Hide resolved
pulser-simulation/pulser_simulation/simresults.py Outdated Show resolved Hide resolved
pulser-simulation/pulser_simulation/simulation.py Outdated Show resolved Hide resolved
@HGSilveri HGSilveri marked this pull request as draft August 9, 2024 08:10
@HGSilveri HGSilveri changed the title [Draft} Add leakage Add leakage Aug 9, 2024
Copy link
Collaborator

@HGSilveri HGSilveri left a comment

Choose a reason for hiding this comment

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

Are the recent changes in the Hamiltonian because the set_config() exists and thus the dimensions might change if leakage is added?

pulser-simulation/pulser_simulation/hamiltonian.py Outdated Show resolved Hide resolved
@a-corni
Copy link
Collaborator Author

a-corni commented Aug 12, 2024

Are the recent changes in the Hamiltonian because the set_config() exists and thus the dimensions might change if leakage is added?

Yes indeed :) I think I have covered everything on this side. However, if you feel it's too much trouble for a feature that is not too much used, another option could be to just raise an error when the user do set_config, with a Config having a different leakage than the previous config...

@HGSilveri
Copy link
Collaborator

Yes indeed :) I think I have covered everything on this side. However, if you feel it's too much trouble for a feature that is not too much used, another option could be to just raise an error when the user do set_config, with a Config having a different leakage than the previous config...

It's just that I think we'll want to deprecate set_config() so it seemed like hassle, but if you think you have covered everything then there is also no need to revert the changes

@a-corni a-corni marked this pull request as ready for review August 12, 2024 13:48
@a-corni
Copy link
Collaborator Author

a-corni commented Aug 12, 2024

Yes indeed :) I think I have covered everything on this side. However, if you feel it's too much trouble for a feature that is not too much used, another option could be to just raise an error when the user do set_config, with a Config having a different leakage than the previous config...

It's just that I think we'll want to deprecate set_config() so it seemed like hassle, but if you think you have covered everything then there is also no need to revert the changes

Okay I think I am good :)

@a-corni
Copy link
Collaborator Author

a-corni commented Aug 13, 2024

The execution is now consistent:

  • We obtain the same results as before with the same input
  • If the collapse operator provided with leakage does not have any term in associated with a projection on "x", then the result is the same as without leakage (and the CoherentResult state have 0 on all the terms associated with the "x" state).

@a-corni a-corni mentioned this pull request Aug 13, 2024
10 tasks
assert sim._initial_state == qutip.tensor(
[qutip.basis(2, 1) for _ in range(2)]
)
print("Final test")
Copy link
Collaborator

Choose a reason for hiding this comment

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

You forgot this

@HGSilveri HGSilveri added this to the v0.20 Release milestone Sep 11, 2024
@a-corni a-corni merged commit 393526f into develop Sep 13, 2024
7 checks passed
@a-corni a-corni deleted the add_leakage branch September 13, 2024 08:13
@HGSilveri HGSilveri mentioned this pull request Sep 20, 2024
HGSilveri added a commit that referenced this pull request Sep 20, 2024
**Main changes:**
- Reworking the NoiseModel interface (#710)
- Allow modification of the EOM setpoint without disabling EOM mode (#708)
- Enable definition of effective noise operators in all basis (#716)
- Add leakage (#720)
- Support differentiability through Torch tensors (#703)
- Add from_abstract_repr to Device and VirtualDevice (#727) 
- [FEAT] Handle batches with partial results (#707)
- Add open batches to pulser-pasqal (#701)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants