Skip to content

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

@mtreinish

Description

@mtreinish

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.

Metadata

Metadata

Labels

C APIRelated to the C APIRustThis PR or issue is related to Rust code in the repositorytype: feature requestNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions