Closed
Description
Environment
- Qiskit Terra version: 0.19.2
- Python version: 3.8
- Operating system: Windows 10/Ubuntu 20.04
What is happening?
If I use the multi-controlled Z gate rotation I cannot use parameter binds to run a circuit. It fails to create the QOBJ.
How can we reproduce the issue?
from qiskit.circuit import QuantumCircuit, Parameter
from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister, ClassicalRegister
from qiskit import Aer
from qiskit import transpile, assemble
states = QuantumRegister(5, 'states')
ancilla = QuantumRegister(1, 'ancilla')
output = ClassicalRegister(1, 'reg_class')
# create the parameter
phi = Parameter('phi')
qc = QuantumCircuit(states,ancilla,output)
# parameterize the rotation
qc.mcrz(phi, states[:-1],states[-1])
qc.measure(ancilla,output)
simulator_backend = Aer.get_backend('aer_simulator')
qc = transpile(qc,simulator_backend)
qobj = assemble(qc,
shots=2,
parameter_binds = [{phi: 3.14}])
results = simulator_backend.run(qobj).result()
all_counts = results.get_counts()
print(all_counts)
What should happen?
If we ran the code, the exped result would be the counts of the outputs of the measured value. However, we get a message saying it failed to convert from python to C++ and returns a empty string.
ERROR: Failed to load qobj: Unable to cast Python instance to C++ type (compile in debug mode for details)
Any suggestions?
The controlled Z-gste seems to be working fine, maybe inspect it.