qiskit_addon_cutting.qpd.decompose_qpd_instructions¶
- decompose_qpd_instructions(circuit, instruction_ids, map_ids=None, *, inplace=False)[source]¶
Replace all QPD instructions in the circuit with local Qiskit operations and measurements.
- Parameters:
circuit (QuantumCircuit) – The circuit containing QPD instructions
instruction_ids (Sequence[Sequence[int]]) – A 2D sequence, such that each inner sequence corresponds to indices of instructions comprising one decomposition in the circuit. The elements within a common sequence belong to a common decomposition and should be sampled together.
map_ids (Sequence[int] | None) – Indices to a specific linear mapping to be applied to the decompositions in the circuit. If no map IDs are provided, the circuit will be decomposed randomly according to the decompositions’ joint probability distribution.
- Return type:
QuantumCircuit
- Returns:
Circuit which has had all its
BaseQPDGate
instances decomposed into local operations.The circuit will contain a new, final classical register to contain the QPD measurement outcomes (accessible at
retval.cregs[-1]
).- Raises:
ValueError – An index in
instruction_ids
corresponds to a gate which is not aBaseQPDGate
instance.ValueError – A list within instruction_ids is not length 1 or 2.
ValueError – The total number of indices in
instruction_ids
does not equal the number ofBaseQPDGate
instances in the circuit.ValueError – Gates within the same decomposition hold different QPD bases.
ValueError – Length of
map_ids
does not equal the number of decompositions in the circuit.