pdhoolia / qiskit

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
https://www.ibm.com/quantum/qiskit
Apache License 2.0
0 stars 0 forks source link

Add a Rust representation of Expr #5

Closed pdhoolia closed 7 hours ago

pdhoolia commented 7 hours ago

The Expr class for representing classical expressions is part of the core data model for control flow which is defined in Python. With https://github.com/Qiskit/qiskit/issues/13271 moving controflow expressions to rust we'll also need to move the Expr class to rust otherwise control flow ops will rely on calling back to Python when working with control flow using expressions.

pdhoolia commented 7 hours ago

To address the issue of moving the Expr class from Python to Rust, we will need to make several changes across the suggested files. Below is a detailed plan for each file, including the necessary changes and reasoning:

1. expr.py

Reason: This file likely contains the implementation of the Expr class. We need to transition this functionality to Rust.

Suggested Changes:

2. control_flow_ops.py

Reason: This file may use the Expr class, so it will need updates to interact with the Rust implementation.

Suggested Changes:

3. data_model.py

Reason: This file might define related structures that interact with Expr.

Suggested Changes:

4. utils.py

Reason: Utilities for control flow might interact with Expr.

Suggested Changes:

5. tests/test_expr.py

Reason: Tests for Expr will need updates to ensure compatibility with Rust changes.

Suggested Changes:

New Rust Code

Reason: We need a Rust implementation of the Expr class.

Suggested New Code:

Integration

By following these steps, we can effectively transition the Expr class from Python to Rust while maintaining compatibility and performance within the Qiskit control flow module.