Suppose I have a series of quantum circuits, each of them has 2 qubits:
qc = QuantumCircuit(2)
qc.h(0)
qc.crz(np.pi/2,0,1)
circ_list = [...say this is a list with 10 elements, each of them has the same structure above...]
If I also have a larger quantum circuit:
qcl = QuantumCircuit(8,8)
I want to compose each of the 10 'small circuits' onto the large circuit, I think a standard method would be:
qcom = qcl.compose(circ_list[i],[2,3]) # [2,3] is a random choice
However, if I want to simultaneously compose 10 circuits, it looks like I need to repeat the argument 10 times. I'm wondering is there a simpler way I can do that? An analogy I can think of is the reduce
function:
n = [4,3,2,1]
a = reduce(lambda x,y: x*y, n)
Can I do something similar to the reduce function to compose everything at once? Thanks!!