-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
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.