Closed pdhoolia closed 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:
expr.py
Reason: This file likely contains the implementation of the Expr
class. We need to transition this functionality to Rust.
Suggested Changes:
Expr
class and its methods in expr.py
.Expr
class. This will involve writing a Rust module that mimics the behavior and structure of the Expr
class in Python.Expr
class in expr.py
and replace it with a Python wrapper that calls the Rust implementation.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:
Expr
to use the new Rust-based implementation.Expr
objects to use the FFI interface to the Rust code.Expr
features is compatible with the Rust implementation.data_model.py
Reason: This file might define related structures that interact with Expr
.
Suggested Changes:
Expr
.Expr
.utils.py
Reason: Utilities for control flow might interact with Expr
.
Suggested Changes:
Expr
class.Expr
implementation.tests/test_expr.py
Reason: Tests for Expr
will need updates to ensure compatibility with Rust changes.
Suggested Changes:
Expr
implementation.Expr
class.Reason: We need a Rust implementation of the Expr
class.
Suggested New Code:
Expr
class. This crate should define the same methods and behavior as the Python class.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.
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 theExpr
class to rust otherwise control flow ops will rely on calling back to Python when working with control flow using expressions.