cunqa.circuit.circuit_extensions.distr_ccx_ccz_cswap

cunqa.circuit.circuit_extensions.distr_ccx_ccz_cswap(instr: dict, upper_circuit: CunqaCircuit, lower_circuit: CunqaCircuit, n: int) None

Performs a either a Toffoli (ccx), or ccz, or cswap gate distributed between two circuits.

Cswap decomp. using ccx: CCZ decomp. using ccx: q_0: ───────■─────── q_0: ───────■───────

┌───┐ │ ┌───┐ │

q_1: ┤ X ├──■──┤ X ├ q_1: ───────■───────

└─┬─┘┌─┴─┐└─┬─┘ ┌───┐┌─┴─┐┌───┐

q_2: ──■──┤ X ├──■── q_2: ┤ H ├┤ X ├┤ H ├

└───┘ └───┘└───┘└───┘

Parameters:
  • instr (dict) – the instruction to divide

  • upper_circuit (CunqaCircuit) – circuit with the first n qubits of the original circuit

  • lower_circuit (CunqaCircuit) – circuit with the last num_qubits - n qubits of the original circuit

  • n (int) – number of qubits of the upper_circuit