-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Environment
- `qiskit-terra: '0.21.0':
python: '3.9.12'
:- Ubuntu-20.04 windows subsystem for Linux running on Windows 10:
numpy: 1.21.5
What is happening?
QuantumCircuit.compose()
errors when qubits
argument is a list of numpy.int64
instead of int
.
How can we reproduce the issue?
from qiskit import QuantumCircuit
from qiskit.converters.circuit_to_dag import circuit_to_dag
import numpy as np
qc0 = QuantumCircuit(1)
qc1 = QuantumCircuit(1)
qc0.x(0)
qc1.x(0)
# First, let's try qubits = [0] (vanilla python `int`)
qc_vanilla_int = qc0.compose(qc1, qubits=[0])
# `QuantumCircuit.compose` does not error even when the `qubits` argument is invalid, so we need to check the DAG
circuit_to_dag(qc_vanilla_int) # does not error
# Now let's try qubits = [np.int64(0)]
qc_numpy_int = qc0.compose(qc1, qubits=[np.int64(0)]) #np.arange(0) does the same thing.
circuit_to_dag(qc_numpy_int) #this one errors
Here is the error:
DAGCircuitError: "(qu)bit 0 not found in OrderedDict([(Qubit(QuantumRegister(1, 'q'), 0),
DAGOutNode(wire=Qubit(QuantumRegister(1, 'q'), 0)))])"
What should happen?
qc0.compose
should return a QuantumCircuit
object that can be converted to a DAG.
Any suggestions?
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working