quri_parts.circuit.transpile.fuse module#

class quri_parts.circuit.transpile.fuse.TwoGateFuser(*args, **kwargs)#

Bases: CircuitTranspilerProtocol, ABC

Abstract base class of adjacent gates fusing transpilers.

abstract is_target_pair(left: QuantumGate, right: QuantumGate) bool#
abstract fuse(left: QuantumGate, right: QuantumGate) Sequence[QuantumGate]#
class quri_parts.circuit.transpile.fuse.FuseRotationTranspiler(*args, **kwargs)#

Bases: TwoGateFuser

CircuitTranspiler, which fuses consecutive rotation gates of the same kind acting on the same qubit.

is_target_pair(left: QuantumGate, right: QuantumGate) bool#
fuse(left: QuantumGate, right: QuantumGate) Sequence[QuantumGate]#
class quri_parts.circuit.transpile.fuse.NormalizeRotationTranspiler(cycle_range: tuple[float, float] = (0.0, 6.283185307179586), epsilon: float = 1e-09)#

Bases: GateKindDecomposer

Normalize the parameters of the rotation gates (RX, RY, and RZ) so that they are in the specified range (0 to 2PI by default).

Parameters:
  • cycle_range – Specify a range of width 2PI in the form of (lower limit,

  • exclusive. (upper limit). Lower limit is inclusive and upper limit is) –

property target_gate_names: Sequence[str]#

Returns the set of gate names to be decomposed.”.

decompose(gate: QuantumGate) Sequence[QuantumGate]#

Describe the specific decomposition process. Only the target gates satisfying is_target_gate() method are passed.

Parameters:

gate – The gates to be decomposed.

class quri_parts.circuit.transpile.fuse.RX2NamedTranspiler(epsilon: float = 1e-09)#

Bases: GateKindDecomposer

Convert RX gate to Identity or X gate if it is equivalent to Identity, X, SqrtX, or SqrtXdag gate.

property target_gate_names: Sequence[str]#

Returns the set of gate names to be decomposed.”.

decompose(gate: QuantumGate) Sequence[QuantumGate]#

Describe the specific decomposition process. Only the target gates satisfying is_target_gate() method are passed.

Parameters:

gate – The gates to be decomposed.

class quri_parts.circuit.transpile.fuse.RY2NamedTranspiler(epsilon: float = 1e-09)#

Bases: GateKindDecomposer

Convert RY gate to Identity or Y gate if it is equivalent to Identity, Y, SqrtY, or SqrtYdag gate.

property target_gate_names: Sequence[str]#

Returns the set of gate names to be decomposed.”.

decompose(gate: QuantumGate) Sequence[QuantumGate]#

Describe the specific decomposition process. Only the target gates satisfying is_target_gate() method are passed.

Parameters:

gate – The gates to be decomposed.

class quri_parts.circuit.transpile.fuse.RZ2NamedTranspiler(epsilon: float = 1e-09)#

Bases: GateKindDecomposer

Convert RZ gate to Identity, Z, S, Sdag, T, or Tdag gate if it is equivalent to a sequence of these gates.

property target_gate_names: Sequence[str]#

Returns the set of gate names to be decomposed.”.

decompose(gate: QuantumGate) Sequence[QuantumGate]#

Describe the specific decomposition process. Only the target gates satisfying is_target_gate() method are passed.

Parameters:

gate – The gates to be decomposed.