added 104 characters in body
Source Link
Egretta.Thula
  • 2.1k
  • 1
  • 3
  • 10

You can simply merge the lists of qubits from two quantum registers or more as any python lists using "+" sign. For example

gate = UnitaryGate(random_unitary(2 ** 4).data, 'RND-U16')

qr1 = QuantumRegister(2, 'q')
qr2 = QuantumRegister(3, 'a')
circ = QuantumCircuit(qr1, qr2) 

circ.mct(qr1[0:2] + qr2[0:2], qr2[2])
circ.append(gate, qr1[1:2] + qr2[0:3])

The result:

enter image description hereenter image description here

You can simply merge the lists of qubits from two quantum registers or more as any python lists using "+" sign. For example

qr1 = QuantumRegister(2, 'q')
qr2 = QuantumRegister(3, 'a')
circ = QuantumCircuit(qr1, qr2)
circ.mct(qr1[0:2] + qr2[0:2], qr2[2])

The result:

enter image description here

You can simply merge the lists of qubits from two quantum registers or more as any python lists using "+" sign. For example

gate = UnitaryGate(random_unitary(2 ** 4).data, 'RND-U16')

qr1 = QuantumRegister(2, 'q')
qr2 = QuantumRegister(3, 'a')
circ = QuantumCircuit(qr1, qr2) 

circ.mct(qr1[0:2] + qr2[0:2], qr2[2])
circ.append(gate, qr1[1:2] + qr2[0:3])

The result:

enter image description here

Source Link
Egretta.Thula
  • 2.1k
  • 1
  • 3
  • 10

You can simply merge the lists of qubits from two quantum registers or more as any python lists using "+" sign. For example

qr1 = QuantumRegister(2, 'q')
qr2 = QuantumRegister(3, 'a')
circ = QuantumCircuit(qr1, qr2)
circ.mct(qr1[0:2] + qr2[0:2], qr2[2])

The result:

enter image description here