-
Notifications
You must be signed in to change notification settings - Fork 76
Open
Description
Describe the bug
An error is raised when using qml.QubitStateVector(...).inv() with any of the Qiskit devices.
The error is:
CircuitError: "Invalid param type <class 'complex'> for gate initialize_dg."
To Reproduce
import pennylane as qml
import numpy as np
dev = qml.device("qiskit.aer", wires=1)
state = np.array([1, 1]) / np.sqrt(2)
@qml.qnode(dev)
def f():
qml.QubitStateVector(state, wires=0).inv()
return qml.expval(qml.PauliZ(0))
f()Expected behavior
The above error is not raised.
We could raise a different error because we don't want to support inverses of state preparations (see PennyLaneAI/pennylane#2666).
Additional context
The error itself is linked to the use of Qiskit's Initialize here, which does not support inverses.
This issue was found by @QFer when working on a separate plugin that inherits from the Qiskit plugin. The error occurs in this test in the device test suite when QubitStateVector is added as a supported operation.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels