Repository: Qiskit/qiskit

Issue:
QuantumCircuit.initialize()  no longer accepts single instance of Qubit
### Environment

Used to work in Qiskit v0.34.2, tested to not work in v0.37. Appears to have been broken by commit https://github.com/Qiskit/qiskit-terra/commit/3591fa635db75e3d7f1afea19359acb2fb3a6740

### What is happening?

We used to be able to `circuit.initialize([0,1], qr[0])` but now that raises an error `TypeError: 'Qubit' object is not iterable`

Changing to `circuit.initialize([0,1], [qr[0]])` works as the `qubits` parameter is now a list. Prior to commit https://github.com/Qiskit/qiskit-terra/commit/3591fa635db75e3d7f1afea19359acb2fb3a6740 the `QuantumCircuit._bit_argument_conversion()` function was called on the passed in `qubits` param. Should that still be called?

### How can we reproduce the issue?

```
# Successful with Qiskit v0.34.2, raises error with v0.35.0+
qr = qiskit.QuantumRegister(1)
circuit = qiskit.circuit.QuantumCircuit(qr)
circuit.initialize([0, 1], qr[0])
```

### What should happen?

Unless there is a need to not convert single `Qubit` into a list automatically, I would have expected the `circuit.initialize([0,1], qr[0])` to work.

### Any suggestions?

It appears `QuantumCircuit._bit_argument_conversion()` still exists. Maybe adding the `qubits = self._bit_argument_conversion(qubits, self.qubits)` call back to `initialize()` will restore the expected functionality?
QuantumCircuit.initialize()  no longer accepts single instance of Qubit
### Environment

Used to work in Qiskit v0.34.2, tested to not work in v0.37. Appears to have been broken by commit https://github.com/Qiskit/qiskit-terra/commit/3591fa635db75e3d7f1afea19359acb2fb3a6740

### What is happening?

We used to be able to `circuit.initialize([0,1], qr[0])` but now that raises an error `TypeError: 'Qubit' object is not iterable`

Changing to `circuit.initialize([0,1], [qr[0]])` works as the `qubits` parameter is now a list. Prior to commit https://github.com/Qiskit/qiskit-terra/commit/3591fa635db75e3d7f1afea19359acb2fb3a6740 the `QuantumCircuit._bit_argument_conversion()` function was called on the passed in `qubits` param. Should that still be called?

### How can we reproduce the issue?

```
# Successful with Qiskit v0.34.2, raises error with v0.35.0+
qr = qiskit.QuantumRegister(1)
circuit = qiskit.circuit.QuantumCircuit(qr)
circuit.initialize([0, 1], qr[0])
```

### What should happen?

Unless there is a need to not convert single `Qubit` into a list automatically, I would have expected the `circuit.initialize([0,1], qr[0])` to work.

### Any suggestions?

It appears `QuantumCircuit._bit_argument_conversion()` still exists. Maybe adding the `qubits = self._bit_argument_conversion(qubits, self.qubits)` call back to `initialize()` will restore the expected functionality?


Discussion:

Resolving patch:
diff --git a/qiskit/circuit/library/data_preparation/state_preparation.py b/qiskit/circuit/library/data_preparation/state_preparation.py
--- a/qiskit/circuit/library/data_preparation/state_preparation.py
+++ b/qiskit/circuit/library/data_preparation/state_preparation.py
@@ -17,7 +17,7 @@
 import numpy as np
 
 from qiskit.exceptions import QiskitError
-from qiskit.circuit import QuantumCircuit, QuantumRegister
+from qiskit.circuit import QuantumCircuit, QuantumRegister, Qubit
 from qiskit.circuit.gate import Gate
 from qiskit.circuit.library.standard_gates.x import CXGate, XGate
 from qiskit.circuit.library.standard_gates.h import HGate
@@ -427,8 +427,9 @@ def prepare_state(self, state, qubits=None, label=None):
               to :math:`|1\rangle`. Example: setting params to 5 would initialize qubit 0 and qubit 2
               to :math:`|1\rangle` and qubit 1 to :math:`|0\rangle`.
 
-        qubits (QuantumRegister or int):
+        qubits (QuantumRegister or Qubit or int):
             * QuantumRegister: A list of qubits to be initialized [Default: None].
+            * Qubit: Single qubit to be initialized [Default: None].
             * int: Index of qubit to be initialized [Default: None].
             * list: Indexes of qubits to be initialized [Default: None].
         label (str): An optional label for the gate
@@ -505,7 +506,7 @@ def prepare_state(self, state, qubits=None, label=None):
 
     if qubits is None:
         qubits = self.qubits
-    elif isinstance(qubits, (int, np.integer, slice)):
+    elif isinstance(qubits, (int, np.integer, slice, Qubit)):
         qubits = [qubits]
 
     num_qubits = len(qubits) if isinstance(state, int) else None
diff --git a/qiskit/extensions/quantum_initializer/initializer.py b/qiskit/extensions/quantum_initializer/initializer.py
--- a/qiskit/extensions/quantum_initializer/initializer.py
+++ b/qiskit/extensions/quantum_initializer/initializer.py
@@ -18,6 +18,7 @@
 from qiskit.circuit import QuantumCircuit
 from qiskit.circuit import QuantumRegister
 from qiskit.circuit import Instruction
+from qiskit.circuit import Qubit
 from qiskit.circuit.library.data_preparation import StatePreparation
 
 _EPS = 1e-10  # global variable used to chop very small numbers to zero
@@ -106,8 +107,9 @@ class to prepare the qubits in a specified state.
               to :math:`|1\rangle`. Example: setting params to 5 would initialize qubit 0 and qubit 2
               to :math:`|1\rangle` and qubit 1 to :math:`|0\rangle`.
 
-        qubits (QuantumRegister or int):
+        qubits (QuantumRegister or Qubit or int):
             * QuantumRegister: A list of qubits to be initialized [Default: None].
+            * Qubit: Single qubit to be initialized [Default: None].
             * int: Index of qubit to be initialized [Default: None].
             * list: Indexes of qubits to be initialized [Default: None].
 
@@ -182,7 +184,7 @@ class to prepare the qubits in a specified state.
     """
     if qubits is None:
         qubits = self.qubits
-    elif isinstance(qubits, (int, np.integer, slice)):
+    elif isinstance(qubits, (int, np.integer, slice, Qubit)):
         qubits = [qubits]
     num_qubits = len(qubits) if isinstance(params, int) else None
 


Test patch:
diff --git a/test/python/circuit/library/test_state_preparation.py b/test/python/circuit/library/test_state_preparation.py
--- a/test/python/circuit/library/test_state_preparation.py
+++ b/test/python/circuit/library/test_state_preparation.py
@@ -19,7 +19,7 @@
 import numpy as np
 from ddt import ddt, data
 
-from qiskit import QuantumCircuit
+from qiskit import QuantumCircuit, QuantumRegister
 from qiskit.quantum_info import Statevector, Operator
 from qiskit.test import QiskitTestCase
 from qiskit.exceptions import QiskitError
@@ -54,6 +54,15 @@ def test_prepare_from_list(self):
         actual_sv = Statevector(qc)
         self.assertTrue(desired_sv == actual_sv)
 
+    def test_prepare_single_qubit(self):
+        """Prepare state in single qubit."""
+        qreg = QuantumRegister(2)
+        circuit = QuantumCircuit(qreg)
+        circuit.prepare_state([1 / math.sqrt(2), 1 / math.sqrt(2)], qreg[1])
+        expected = QuantumCircuit(qreg)
+        expected.prepare_state([1 / math.sqrt(2), 1 / math.sqrt(2)], [qreg[1]])
+        self.assertEqual(circuit, expected)
+
     def test_nonzero_state_incorrect(self):
         """Test final state incorrect if initial state not zero"""
         desired_sv = Statevector([1 / math.sqrt(2), 0, 0, 1 / math.sqrt(2)])
diff --git a/test/python/circuit/test_registerless_circuit.py b/test/python/circuit/test_registerless_circuit.py
--- a/test/python/circuit/test_registerless_circuit.py
+++ b/test/python/circuit/test_registerless_circuit.py
@@ -230,6 +230,18 @@ def test_circuit_initialize(self):
 
         self.assertEqual(circuit, expected)
 
+    def test_circuit_initialize_single_qubit(self):
+        """Test initialize on single qubit."""
+        init_vector = [numpy.sqrt(0.5), numpy.sqrt(0.5)]
+        qreg = QuantumRegister(2)
+        circuit = QuantumCircuit(qreg)
+        circuit.initialize(init_vector, qreg[0])
+
+        expected = QuantumCircuit(qreg)
+        expected.initialize(init_vector, [qreg[0]])
+
+        self.assertEqual(circuit, expected)
+
     def test_mixed_register_and_registerless_indexing(self):
         """Test indexing if circuit contains bits in and out of registers."""