transpiled_circuit

transpiled_circuit#

iqm.qaoa.circuits.transpiled_circuit(qaoa, backend=AerSimulator('aer_simulator_statevector'), transpiler=None, seed=1337)[source]#

The function to return a QuantumCircuit tailored to backend.

This function has highly varying outputs based on which transpiler is used. If no transpiler is used, the perfect QuantumCircuit is returned using qiskit_circuit(). Otherwise, the QAOA circuit is transpiled using one of the transpilers, respecting the topology of backend.

Parameters:
  • qaoa (QUBOQAOA) – The QUBOQAOA object whose quantum circuit is constructed.

  • backend (BackendV2) – A backend that the circuit is to be run on. The connectivity of the backend is required for the transpilation.

  • transpiler (str | None) – A string that describes which algorithm should be used for transpilation (if any). Should be one of: None, “Default”, “HardwiredTranspiler”, “SparseTranspiler”, “SwapNetwork” or “MinimumVertexCover”.

  • seed (int) – A seed used for “Default” transpilation. It fixes the circuit produced by the stochastic qiskit transpiler. It can be used to ensure reproducibility of a transpilation.

Returns:

A quantum circuit transpiled to the topology of backend.

Raises:
  • TypeError – If the backend is not an IQM backend and a custom transpiler is selected (i.e., other than None or “Default”).

  • ValueError – If the provided transpiler is not one of the allowed transpilers.

Return type:

QuantumCircuit