Skip to content

Add C API interface for adding a UnitaryGate to a circuit #14238

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

Open
mtreinish opened this issue Apr 23, 2025 · 2 comments · May be fixed by #14334
Open

Add C API interface for adding a UnitaryGate to a circuit #14238

mtreinish opened this issue Apr 23, 2025 · 2 comments · May be fixed by #14334
Assignees
Labels
C API Related to the C API Rust This PR or issue is related to Rust code in the repository type: feature request New feature or request
Milestone

Comments

@mtreinish
Copy link
Member

What should we add?

Since #14006 merged we now have a representation of a circuit in the C API. However in that PR one component we didn't include was the function to add a UnitaryGate to the circuit. We can take a pointer to an array from the C caller and pass that to ndarray to create a UnitaryGate object. Right now UnitaryGate only supports an owned array type ArrayType::NDArray this could be extended to store an ArrayView2 and leave the array in the caller managed memory, but doing this would have implications for lifetime tracking in the circuit so it might not be worth it. Considering we return a copy of the array when Operation::matrix() is called, the overhead of copying the array once from the C caller into what we put on the circuit doesn't seem like the worst tradeoff.

@mtreinish mtreinish added C API Related to the C API Rust This PR or issue is related to Rust code in the repository type: feature request New feature or request labels Apr 23, 2025
@mtreinish mtreinish added this to the 2.1.0 milestone Apr 23, 2025
@maximizemaxwell
Copy link

Can I work for this?

@mtreinish
Copy link
Member Author

@maximizemaxwell Sure go ahead and give it a try.

@maximizemaxwell maximizemaxwell linked a pull request May 9, 2025 that will close this issue
@eliarbel eliarbel linked a pull request May 15, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C API Related to the C API Rust This PR or issue is related to Rust code in the repository type: feature request New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants