quri_parts.circuit.transpile.gateset module#

class CliffordConversionTranspiler(target_gateset)#

Bases: CircuitTranspilerProtocol

A CircuitTranspiler that converts Clifford gates in a circuit into the desired Clifford gate sequences.

Convert the Clifford gates in the circuit into gate sequences containing only the user-specified Clifford gates. Such conversions are done on a best-effort basis and may leave non target Clifford gates in the output.

Clifford gates that could not be converted or non-Clifford gates will remain in place.

Parameters:

target_gateset (Iterable[CliffordGateNameType]) – A Sequence of Clifford gate names to output.

class RZ2RXRYTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

A CircuitTranspiler that converts RZ gates in a circuit into the gate sequences containing RX and RY gates.

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 RY2RXRZTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

A CircuitTranspiler that converts RY gates in a circuit into the gate sequences containing RX and RZ gates.

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 RX2RYRZTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

A CircuitTranspiler that converts RX gates in a circuit into the gate sequences containing RY and RZ gates.

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 RX2RZHTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

A CircuitTranspiler that converts RX gates in a circuit into the gate sequences containing RZ and H gates.

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 RY2RZHTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

A CircuitTranspiler that converts RY gates in a circuit into the gate sequences containing RZ and H gates.

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 IdentityTranspiler(*args, **kwargs)#

Bases: CircuitTranspilerProtocol

A CircuitTranspiler returns the same circuit as the input.

class RotationConversionTranspiler(target_rotation, favorable_clifford=())#

Bases: CircuitTranspilerProtocol

A CircuitTranspiler that converts rotation gates (RX, RY, and RZ) in a circuit to each other.

Convert rotation gates in a circuit into the gate sequences containing only specified kinds of rotation gates and Clifford gates.

If there are 2 permitted rotation gate kinds, the rotation gates are converted into the rotation gates only; if there is 1 permitted rotation gate kind, the rotation gates are converted into the rotation gates and Clifford gates.

The more favorable Clifford gates can be indicated. However, the choice of Clifford gates is made on a best-effort basis. Clifford gate kinds included in the output is not guaranteed.

Parameters:
  • target_rotation (Iterable[GateNameType]) – A Sequence of rotation gate names to output.

  • favorable_clifford (Iterable[CliffordGateNameType]) – A Sequence of Clifford gate names to be prioritesed as an output.

class GateSetConversionTranspiler(target_gateset)#

Bases: CircuitTranspilerProtocol

A CircuitTranspiler that converts the gate set of a circuit into the specified one.

Depending on the target gate set and the input circuit, the decomposition may fail and an exception may be raised.

Parameters:

target_gateset (Iterable[GateNameType]) – A Sequence of allowed output gate names.