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

[Feature Request]: Enhance TrotterGroup.apply() with Second-Order Trotterization and Rust Integration #2

Open
9 tasks
evmckinney9 opened this issue Nov 17, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@evmckinney9
Copy link
Member

evmckinney9 commented Nov 17, 2023

Description

This issue focuses on two key enhancements to the TrotterGroup class:

  1. Implementing second-order Trotterization for continuous quantum operators.
  2. Adding an optional parameter to offload Trotterization calculations to Rust for performance optimization.

Background

  • First-Order Trotterization (current implementation):
    $$e^{A+B} \approx \left(e^{A/N} e^{B/N}\right)^N$$
  • Second-Order Trotterization (proposed enhancement):
    $$e^{A+B} \approx \left(e^{A/2N} e^{B/N} e^{A/2N}\right)^N$$
  • Rust Integration: Previously implemented but lost in refactoring, it allows offloading intensive computations to Rust for performance optimization.

Proposed Changes

  • Modify the apply method in the TrotterGroup class to implement second-order Trotterization.
  • Add an optional parameter in apply method to choose between Python and Rust for Trotterization computation.
  • Ensure compatibility with existing data structures like CPTPMap, Channel, and Qobj.
  • Update dimensionality checks and error handling for second-order approximation.

Rust Code Reference

#[pyfunction]
fn apply_operators_in_place(
    py: Python,
    state: &PyArray2<Complex64>,
    num_steps: usize,
    operator_groups: Vec<Vec<&PyArray2<Complex64>>>,
) -> PyResult<PyObject> {

Python-Rust Integration

  • The Rust function apply_operators_in_place should be callable from the Python apply method, with appropriate data structure conversion and error handling.
  • Test the integration thoroughly to ensure consistency in results between Python and Rust implementations.

Additional Resources

Testing

  • Implement unit tests for the second-order Trotterization in Python.
  • Test the Rust integration to verify its functionality and performance benefits.
  • Validate the results against first-order approximation and theoretical expectations.
@evmckinney9 evmckinney9 added the enhancement New feature or request label Nov 17, 2023
@evmckinney9 evmckinney9 self-assigned this Nov 17, 2023
@evmckinney9 evmckinney9 changed the title [Feature Request]: Handle trotterization in rust [Feature Request]: Enhance TrotterGroup.apply() with Second-Order Trotterization and Rust Integration Nov 17, 2023
@evmckinney9
Copy link
Member Author

There should be some refactoring involved with the TrotterGroup class. Currently, the behavior is to alternate over an arbitrarily sized list of "background" operators (A) with a single unitary (B). We should make A a single operator, by enforcing that the operators assigned to the class are commuting.

Otherwise, we could trotterize more than 2 operators, e.g. A,B,C with one another, but I'm not sure if the higher-order trotterizations are defined with this idea in mind.

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