quri_parts.circuit.transpile.transpiler module#
- CircuitTranspiler#
CircuitTranspiler Interface. A function or callable object that can map NonParametricQuantumCircuit to NonParametricQuantumCircuit.
alias of
Callable
[[NonParametricQuantumCircuit
],NonParametricQuantumCircuit
]
- class CircuitTranspilerProtocol(*args, **kwargs)#
Bases:
Protocol
Protocol of callable class that transpiles NonParametricQuantumCircuit to NonParametricQuantumCircuit.
- class SequentialTranspiler(transpilers)#
Bases:
CircuitTranspilerProtocol
CircuitTranspiler, which applies CircuitTranspilers in sequence.
- Parameters:
transpilers (Sequence[CircuitTranspiler]) – Sequence of CircuitTranspilers.
Examples
transpiler = SequentialTranspiler( [ ATranspiler(), BTranspiler(arg..), .. ] ) circuit = transpiler(circuit)
- class GateDecomposer(*args, **kwargs)#
Bases:
CircuitTranspilerProtocol
,ABC
Abstract class that represents CircuitTranspiler, such that target gates are selected by decision function and each target gate is replaced by a sequence of multiple gates.
- abstract is_target_gate(gate)#
Determine if a given gate is subject to decomposition.
- Parameters:
gate (QuantumGate) – Gates in the circuit that are scanned from the front.
- Return type:
bool
- abstract decompose(gate)#
Describe the specific decomposition process. Only the target gates satisfying is_target_gate() method are passed.
- Parameters:
gate (QuantumGate) – The gates to be decomposed.
- Return type:
Sequence[QuantumGate]
- class GateKindDecomposer(*args, **kwargs)#
Bases:
GateDecomposer
,ABC
Abstract class that represents CircuitTranspiler, such that each gate is identified by its gate name and the target gate is replaced by a sequence of multiple gates.
Classes inheriting from this class can be used for ParallelDecomposer.
- abstract property target_gate_names: Sequence[str]#
Returns the set of gate names to be decomposed.
- is_target_gate(gate)#
Determine if a given gate is subject to decomposition.
- Parameters:
gate (QuantumGate) – Gates in the circuit that are scanned from the front.
- Return type:
bool
- class ParallelDecomposer(decomposers)#
Bases:
CircuitTranspilerProtocol
CircuitTranspiler, which executes given GateKindDecomposer within a single loop traversing the gate from the front.
- Parameters:
decomposers (Sequence[GateKindDecomposer]) – Sequence of GateKindDecomposer with no duplicate gate types to act on.