Skip to content

Expose operation conversion methods to other crates.#12698

Merged
jlapeyre merged 2 commits into
Qiskit:mainfrom
raynelfss:expose-operation-struct-methods
Jul 1, 2024
Merged

Expose operation conversion methods to other crates.#12698
jlapeyre merged 2 commits into
Qiskit:mainfrom
raynelfss:expose-operation-struct-methods

Conversation

@raynelfss
Copy link
Copy Markdown
Contributor

@raynelfss raynelfss commented Jul 1, 2024

Summary

After #12459 merged, a couple of conversion methods were introduced to be able to represent operations in Rust. These commits aim to expose these methods so that they can be used on other crates within qiskit._accelerate. One example of its use is for #12585.

Details and comments

  • Expose operation_type_to_py, operation_type_and_data_to_py, convert_py_to_operation_type, methods to other rust crates.
  • Expose OperationTypeConstruct struct to other crates.

- Expose `operation_type_to_py`, `operation_type_and_data_to_py`, `convert_py_to_operation_type`, methods to other rust crates.
- Expose `OperationTypeConstruct` struct to other crates.
@raynelfss raynelfss requested a review from a team as a code owner July 1, 2024 15:28
@qiskit-bot
Copy link
Copy Markdown
Collaborator

One or more of the following people are relevant to this code:

  • @Qiskit/terra-core
  • @kevinhartman
  • @mtreinish

@raynelfss raynelfss added the Rust This PR or issue is related to Rust code in the repository label Jul 1, 2024
@jlapeyre
Copy link
Copy Markdown
Contributor

jlapeyre commented Jul 1, 2024

Can you add some motivation? Is there something in the works that intends to use these methods?

@raynelfss
Copy link
Copy Markdown
Contributor Author

raynelfss commented Jul 1, 2024

@jlapeyre, Here's one use case:

https://github.com/raynelfss/qiskit/blob/77dbec896677a67df3ab350448c537b23df973f9/crates/circuit/src/equivalence.rs#L237-L252

This is the way we represent gates within the EquivalenceLibrary as we still need to check the parameters that are used within each Operation.

@coveralls
Copy link
Copy Markdown

coveralls commented Jul 1, 2024

Pull Request Test Coverage Report for Build 9747010175

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • 28 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.03%) to 89.811%

Files with Coverage Reduction New Missed Lines %
qiskit/transpiler/passes/synthesis/unitary_synthesis.py 2 88.2%
crates/qasm2/src/lex.rs 2 92.62%
crates/qasm2/src/parse.rs 24 96.23%
Totals Coverage Status
Change from base Build 9745765969: -0.03%
Covered Lines: 64388
Relevant Lines: 71693

💛 - Coveralls

@jlapeyre jlapeyre added this pull request to the merge queue Jul 1, 2024
Merged via the queue into Qiskit:main with commit 5db984a Jul 1, 2024
@raynelfss raynelfss deleted the expose-operation-struct-methods branch July 1, 2024 20:07
@ElePT ElePT added the Changelog: None Do not include in the GitHub Release changelog. label Jul 30, 2024
Procatv pushed a commit to Procatv/qiskit-terra-catherines that referenced this pull request Aug 1, 2024
…#12698)

- Expose `operation_type_to_py`, `operation_type_and_data_to_py`, `convert_py_to_operation_type`, methods to other rust crates.
- Expose `OperationTypeConstruct` struct to other crates.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Changelog: None Do not include in the GitHub Release changelog. Rust This PR or issue is related to Rust code in the repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants