Search code examples
pythonquantum-computingqiskit

How to Calculate the Quantum Cost of Qiskit Circuit


I want to calculate the Quantum cost of this qiskit circuit, e.g as i know x-gate has the cost 1 and there are 4 x-gate so quantum cost for x-gate will be 4. What about ccx gate? How can i calculate its cost.?

    circuit.x(qr[1])
    circuit.x(qr[0])
    circuit.ccx(qr[0], qr[1], qr[2])
    circuit.x(qr[1])
    circuit.x(qr[0])
    circuit.ccx(qr[0], qr[1], qr[3])

Solution

  • The quantum cost of a Toffoli gate is assessed by taking into account the count of fundamental quantum gates it incorporates, which includes CNOT gates, controlled-V gates, and controlled-V+ gates. Specifically, the case of a Toffoli gate, encompasses two CNOT gates, two controlled-V gates, and one controlled-V+ gate. Consequently, the quantum cost and delay of a Toffoli gate are both measured at 5Δ. 1, 2

    It is to be noted that the cost and delay is 1Δ for all fundamental gates like CNOT gate, Controlled V- gate, and Controlled V+ gate 1, 2.

    [1]https://dl.acm.org/doi/abs/10.1145/1877745.1877748.

    [2]https://link.springer.com/article/10.1007/s10773-018-3886-0