qiskit-metapackage
qiskit-metapackage copied to clipboard
QuantumCircuit doesn't have set_density_matrix()
Informations
- Qiskit version: 0.37
- Python version: 3.8.0
- Operating system: Ubuntu 18.04
What is the current behavior?
Calling the set_density_matrix()
method on a QuantumCircuit object returns an error, saying that there is no such attribute. The documentation, on the other hand, does list this function: https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.set_density_matrix.html
Steps to reproduce the problem
Run the following commands in a python console:
>>> from qiskit import QuantumCircuit
>>> circ = QuantumCircuit(2)
>>> 'set_density_matrix' in dir(circ)
The last line outputs False
.
What is the expected behavior?
QuantumCircuit
does possess a function set_density_matrix()
Thanks for reporting this issue. the method set_density_matrix
is added after Qiskit Aer is imported. Please see related discussions in https://github.com/Qiskit/qiskit-terra/issues/6346
This is expected behaviour; Aer monkey-patches this method onto QuantumCircuit
. People can fix this by doing import qiskit_aer
. I'll close this now as not a bug, and would be the domain of Aer anyway.