quri_parts.circuit.transpile.fuse module#

class TwoGateFuser(*args, **kwargs)#

Bases: CircuitTranspilerProtocol, ABC

Abstract base class of adjacent gates fusing transpilers.

abstract is_target_pair(left, right)#
Parameters:
Return type:

bool

abstract fuse(left, right)#
Parameters:
Return type:

Sequence[QuantumGate]

class FuseRotationTranspiler(*args, **kwargs)#

Bases: TwoGateFuser

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

is_target_pair(left, right)#
Parameters:
Return type:

bool

fuse(left, right)#
Parameters:
Return type:

Sequence[QuantumGate]

class NormalizeRotationTranspiler(cycle_range=(0.0, 6.283185307179586), epsilon=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 (tuple[float, float]) – Specify a range of width 2PI in the form of (lower limit,

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

  • epsilon (float) –

property target_gate_names: Sequence[str]#

Returns the set of gate names to be decomposed.

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 RX2NamedTranspiler(epsilon=1e-09)#

Bases: GateKindDecomposer

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

Parameters:

epsilon (float) –

property target_gate_names: Sequence[str]#

Returns the set of gate names to be decomposed.

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 RY2NamedTranspiler(epsilon=1e-09)#

Bases: GateKindDecomposer

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

Parameters:

epsilon (float) –

property target_gate_names: Sequence[str]#

Returns the set of gate names to be decomposed.

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 RZ2NamedTranspiler(epsilon=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.

Parameters:

epsilon (float) –

property target_gate_names: Sequence[str]#

Returns the set of gate names to be decomposed.

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]