Two Qnodes Chained


Two questions:

  1. If I have two chained Qnodes (both using the same device) where output of first is fed as an input of second, and both contains an n-qubit circuit. if n is same in both Qnodes, then am I utilizing 2n qubits or n qubits.

  2. while using the lightning.qubit device, I am unable to go beyond 21 qubits, is there any limit to use the number of qubits?

Thanks in anticipation.

Hi @Muhammad_Kashif,

Regarding your first question, because they are different qnodes then think of using a same device for executing different circuits. If the device is set with ‘n’ wires then you are using ‘n’ qubits. You’re just using the device twice, but each time with ‘n’ qubits :smiley:

Regarding your second question, there’s no hard limit on the number of qubits you can use. The limit is usually on the capacity of your computer. Usually after 20 qubits you start running out of memory on a laptop.

I hope this helps!