PennyLaneAI / pennylane-qiskit

The PennyLane-Qiskit plugin integrates the Qiskit quantum computing framework and IBM Q with PennyLane.
https://docs.pennylane.ai/projects/qiskit
Apache License 2.0
180 stars 64 forks source link

Support Qiskit parametrized circuits #41

Open josh146 opened 4 years ago

josh146 commented 4 years ago

Qiskit now support building parametrized quantum circuits, see https://qiskit.org/documentation/terra/custom_gates.html#parameterized-gates.

The advantage of parametrized circuits is that Qiskit only needs to compile it once, and then can re-use the same parametrized circuit for different parameter values. This can lead to a significant speedup when working with variational quantum circuits.

Once XanaduAI/PennyLane#221 is implemented in core PennyLane, the plugin will be able to access the dictionary mapping parameters to operations. The Qiskit plugin will then be able to construct a parametrized circuit, and simply reuse this circuit for different parameter values (until the QNode requests a different circuit topology).

antalszava commented 3 years ago

@josh146 this seems to be available by now, right?

josh146 commented 3 years ago

I don't believe so (unless I am mistaken) -- it looks like the plugin is still simply building a new numeric program every time:

https://github.com/PennyLaneAI/pennylane-qiskit/blob/1e152c7ecea78d2b51267d6a9f75393951449dcc/pennylane_qiskit/qiskit_device.py#L248