quri_parts.circuit.transpile package#

class CircuitTranspilerProtocol(*args, **kwargs)#

Bases: Protocol

Protocol of callable class that transpiles NonParametricQuantumCircuit to NonParametricQuantumCircuit.

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.

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)
RZSetTranspiler()#

CircuitTranspiler to transpile a QuntumCircuit into another QuantumCircuit containing only X, SqrtX, CNOT, and RZ. (UnitaryMatrix gate for 3 or more qubits are not decomposed.)

RotationSetTranspiler()#

CircuitTranspiler to transpile a QuntumCircuit into another QuantumCircuit containing only RX, RY, RZ, and CNOT. (UnitaryMatrix gate for 3 or more qubits are not decomposed.)

class CliffordRZSetTranspiler(epsilon=1e-09)#

Bases: SequentialTranspiler

CircuitTranspiler to transpile a QuntumCircuit into another QuantumCircuit containing only H, X, Y, Z, SqrtX, SqrtXdag, SqrtY, SqrtYdag, S, Sdg, RZ, CZ, and CNOT.

Since this transpiler involves fusing rotation gates, converting rotation gates to named gates with a certain precision, and removing Identity gates, the action of the circuit before and after the conversion may not be completely equivalent.

Parameters:

epsilon (float) –

class CliffordApproximationTranspiler(*args, **kwargs)#

Bases: GateDecomposer

CircuitTranspiler, which replaces the non_clifford gate into sequence of non-parametric Clifford gates.

If the input gate has angles, this transpiler replaces them with the closest value in the set \(\{\pi n /2| n\in\mathbb{Z}\}\). Then by using the rotation gate transpilers, it is decomposed into a sequence of non-parametric Clifford gates.

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

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

Bases: CircuitTranspilerProtocol

Generate a new circuit by removing all Identity gates from the given circuit.

class IdentityInsertionTranspiler#

Bases: CircuitTranspilerProtocol

If there are qubits to which any gate has not been applied, Identity gates are added for those qubits.

The application of this transpiler ensures that every qubit has at least one gate acting on it.

class Identity2RZTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which converts Identity gates into 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 PauliDecomposeTranspiler#

Bases: GateKindDecomposer

CircuitTranspiler, which decompose multi-qubit Pauli gates into X, Y, and Z 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 PauliRotationDecomposeTranspiler#

Bases: GateKindDecomposer

CircuitTranspiler, which decompose multi-qubit PauliRotation gates into H, RX, RZ, and CNOT 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 CNOT2CZHTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes CNOT gates into sequences of H and CZ 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 CZ2CNOTHTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes CZ gates into sequences of H and CNOT 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 CZ2RXRYCNOTTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes CZ gates into sequences of RX, RY, and CNOT 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 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 H2RXRYTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes H gates into sequences of 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 H2RZSqrtXTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes H gates into sequences of RZ and SqrtX 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 QubitRemappingTranspiler(qubit_mapping)#

Bases: CircuitTranspilerProtocol

Remap qubits in the circuit with the specified mapping.

The mapping qubit_mapping should be specified with “from” qubit indices as keys and “to” qubit indices as values. For example, if you want to convert a circuit using qubits 0, 1, 2, 3 by mapping them as 0 → 4, 1 → 2, 2 → 5, 3 → 0, then the qubit_mapping should be {0: 4, 1: 2, 2: 5, 3: 0}. The qubit_count of the converted circuit is determined by the largest destination qubit index. In the above example, the largest index is 5, so the converted circuit is for 6 qubits.

Parameters:

qubit_mapping (Mapping[int, int]) –

class RX2RZSqrtXTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes RX gates into sequences of RZ and SqrtX 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 RY2RZSqrtXTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes RY gates into sequences of RZ and SqrtX 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 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]

class S2RZTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes S gates into of 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 Sdag2RZTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes Sdag gates into 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 SingleQubitUnitaryMatrix2RYRZTranspiler(*args, **kwargs)#

Bases: GateDecomposer

CircuitTranspiler, which decomposes single qubit UnitaryMatrix gates into gate sequences containing RY and RZ gates.

Ref:
[1]: Tomonori Shirakawa, Hiroshi Ueda, and Seiji Yunoki,

Automatic quantum circuit encoding of a given arbitrary quantum state, arXiv:2112.14524v1, p.22, (2021).

[2]: Main functions are ported from the source code wrtitten by Sota Morisaki

in QunaSys intern project.

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

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

Bases: GateKindDecomposer

CircuitTranspiler, which converts SqrtX gates into RX 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 SqrtX2RZHTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes SqrtX gates into sequences of 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 SqrtXdag2RXTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which converts SqrtXdag gates into RX 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 SqrtXdag2RZSqrtXTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes SqrtXdag gates into sequences of RZ and SqrtX 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 SqrtY2RYTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which converts SqrtY gates into 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 SqrtY2RZSqrtXTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes SqrtY gates into sequences of RZ and SqrtX 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 SqrtYdag2RYTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

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

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes SqrtYdag gates into sequences of RZ and SqrtX 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 SWAP2CNOTTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes SWAP gates into sequences of CNOT 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 T2RZTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes T gates into 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 Tdag2RZTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes Tdag gates into 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 TOFFOLI2HTTdagCNOTTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes TOFFOLI gates into sequences of H, T, TDag, and CNOT 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 TwoQubitUnitaryMatrixKAKTranspiler(*args, **kwargs)#

Bases: GateDecomposer

CircuitTranspiler, which decomposes two qubit UnitaryMatrix gates into gate sequences containing H, S, RX, RY, RZ, and CNOT gates.

Raises:

ValueError – Depending on the nature of the unitary matrix of the input UnitaryMatrix gate, the decomposition may fail and throw an error.

Ref:
[1]: Tomonori Shirakawa, Hiroshi Ueda, and Seiji Yunoki,

Automatic quantum circuit encoding of a given arbitrary quantum state, arXiv:2112.14524v1, pp.4-5, (2021).

[2]: Main functions are ported from the source code wrtitten by Sota Morisaki

in QunaSys intern project.

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

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

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes U1 gates into 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 U2ToRXRZTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes U2 gates into sequences of 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 U2ToRZSqrtXTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes U2 gates into sequences of RZ and SqrtX 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 U3ToRXRZTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes U3 gates into sequences of 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 U3ToRZSqrtXTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes U3 gates into sequences of RZ and SqrtX 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 X2HZTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes X gates into sequences of H and Z 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 X2RXTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which converts X gates into RX 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 X2SqrtXTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes X gates into sequences of SqrtX 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 Y2RYTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which converts Y gates into 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 Y2RZXTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes Y gates into sequences of RZ and T 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 Z2HXTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes Z gates into sequences of H and X 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 Z2RZTranspiler(*args, **kwargs)#

Bases: GateKindDecomposer

CircuitTranspiler, which decomposes Z gates into 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]

su2_decompose(ut, eps=1e-15)#
Parameters:
  • ut (Sequence[Sequence[complex]]) –

  • eps (float) –

Return type:

ndarray[Any, dtype[float64]]

su4_decompose(ut, eiglim=1e-10)#
Parameters:
  • ut (Sequence[Sequence[complex]]) –

  • eiglim (float) –

Return type:

tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]]

Submodules#