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 non-vectorized SuperOp simulation for Lindblad simulation #101

Open
DanPuzzuoli opened this issue May 10, 2022 · 1 comment
Open

Add non-vectorized SuperOp simulation for Lindblad simulation #101

DanPuzzuoli opened this issue May 10, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@DanPuzzuoli
Copy link
Collaborator

What is the expected behavior?

Currently, if a Solver is instantiated with Lindblad data, calling Solver.solve with y0 being a SuperOp will only work if evaluation_mode is set to a vectorized option, and otherwise it will raise an error explaining this.

The internal behaviour of Solver.solve should be updated so that the simulation is still carried forward even if evaluation_mode is not vectorized by:

  • Converting the SuperOp to a 3d array representing a list of input matrices to the un-vectorized Lindblad equation.
  • Passing this as the initial state to the call to solve_lmde
  • Converting the output back to a SuperOp by inverting the first transformation.

Notes

The second bullet point above should work due to the LindbladModel.evaluate_rhs being "vectorized" in the array-programming sense: evaluating it on a 3d array is functionally equivalent to looping over the first index and applying the RHS function to each entry.

  • Part of this PR will involve more carefully testing/verifying the components that go into this. There don't seem to be any tests for this in test_lindblad_model.py, but the test test_multiple_density_matrix_evaluation in test.dynamics.models.test_operator_collections.TestDenseLindbladCollection tests this at the operator collection level. The LindbladModel array-vectorized rhs operation should therefore work assuming that the RotatingFrame operator frame transformation functions are also vectorized (which I think they are).

Additionally, once working, it would be good to test out some examples comparing vectorized evaluation_mode v.s. non-vectorized, to get a sense of the performance difference (though this isn't technically required for this).

@DanPuzzuoli DanPuzzuoli added the enhancement New feature or request label May 10, 2022
@DanPuzzuoli
Copy link
Collaborator Author

DanPuzzuoli commented May 10, 2022

Doing some tests locally it seems like:

  • The array-vectorized solving for a 3d array representing a list of density matrices works if both Hamiltonian operators and Lindblad operators only contain a single entry, but fails with multiple entries, so where this is failing will need to be identified.
  • In the case that it is working, the vectorized version actually appears to be faster, though this is using numpy so the comparison should be done with JAX.

This makes me wonder if we should automatically vectorize in Solver.solve to do a SuperOp simulation?

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

No branches or pull requests

1 participant