quri_parts.circuit.transpile.unitary_matrix_decomposer module#

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]]]

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 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]