// loop over all qubits and add the required registers
for q in register:
if not circuit.has_register(q[0]):
circuit.add_register(q[0])
else:
// if an actual register is given, add it
circuit.add_register(register)
After Change
if self._state is None or self._state == "random":
svc = StateVectorCircuit(self._state_vector)
svc.construct_circuit(circuit=circuit, qubits=qubits)
elif self._state == "uniform":
// in case `qubits` is a list of Qubits
if isinstance(qubits, list):
// loop over all qubits and add the required registers
for q in qubits:
if not isinstance(q, Qubit):
raise AquaError("Unexpected element type {} in qubit list.".format(type(q)))
if not circuit.has_register(q.register):
circuit.add_register(q.register)
// otherwise, if it is a QuantumRegister
elif isinstance(qubits, QuantumRegister):
if not circuit.has_register(qubits):
circuit.add_register(qubits)
else:
raise AquaError("Unexpected qubits type {}.".format(type(qubits)))
for i in range(self._num_qubits):