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

Update model classes to use arraylias #294

Conversation

DanPuzzuoli
Copy link
Collaborator

@DanPuzzuoli DanPuzzuoli commented Dec 8, 2023

Summary

Updates the model classes to use arraylias.

Files to update:

  • generator_model.py
    • test_generator_model.py
  • hamiltonian_model.py
    • test_hamiltonian_model.py
  • lindblad_model.py
    • test_lindblad_model.py

Interface changes:

  • copy method has been removed
  • Setters for everything other than signals and in_frame_basis are being removed. I had wanted to make these classes fully immutable but the ability to set these two properties is used quite a bit throughout the solver infrastructure and I don't want to additionally make a change of this scale at this time. (In any case the main mutability issue had to do with the operators, so for now it's okay to keep signals and in_frame_basis as mutable.)
  • Changed evaluation_mode to array_library
    • For LindbladModel, will also add a “vectorized” boolean
  • To use array_library=“scipy_sparse” or "jax_sparse", a user MUST pass this as array_library.
    • This is how it used to be before so it isn't such a big deal - the user will need to pass the arrays in dense format, then they will be converted to sparse format internally. This isn't desirable but I'm willing to accept it for now as it would only be an issue for extremely large models.

Other to do:

  • Add breaking release note for these changes

Details and comments

General notes:

  • I changed around the way that HamiltonianModel relies on the methods GeneratorModel, but the actual user-side behaviour has not changed (aside from the same changes made to GeneratorModel).

Test files that need to run before merge:

  • test.dynamics.models.test_lindblad_model
  • test.dynamics.models.test_hamiltonian_model
  • test.dynamics.models.test_generator_model
  • test.dynamics.models.rotating_frame
  • test.dynamics.models.operator_collections
  • test.dynamics.arraylias (whole folder)

@DanPuzzuoli DanPuzzuoli changed the base branch from main to models_arraylias_integration December 8, 2023 20:15
@DanPuzzuoli DanPuzzuoli marked this pull request as ready for review December 13, 2023 02:55
@DanPuzzuoli DanPuzzuoli requested a review from to24toro December 13, 2023 03:00
Copy link
Contributor

@to24toro to24toro left a comment

Choose a reason for hiding this comment

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

Thanks, @DanPuzzuoli .
I added some minor change suggestions.

qiskit_dynamics/models/generator_model.py Outdated Show resolved Hide resolved
test/dynamics/models/test_hamiltonian_model.py Outdated Show resolved Hide resolved
qiskit_dynamics/models/lindblad_model.py Outdated Show resolved Hide resolved
test/dynamics/models/test_lindblad_model.py Outdated Show resolved Hide resolved
@DanPuzzuoli
Copy link
Collaborator Author

I've added a release note as well.

Copy link
Contributor

@to24toro to24toro left a comment

Choose a reason for hiding this comment

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

LGTM!

@DanPuzzuoli DanPuzzuoli merged commit 21f938e into qiskit-community:models_arraylias_integration Dec 14, 2023
2 checks passed
DanPuzzuoli added a commit that referenced this pull request Jan 19, 2024
DanPuzzuoli added a commit that referenced this pull request Jan 24, 2024
DanPuzzuoli added a commit that referenced this pull request Feb 5, 2024
DanPuzzuoli added a commit that referenced this pull request Feb 20, 2024
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