quri_parts.circuit.transpile.unitary_matrix_decomposer module#

quri_parts.circuit.transpile.unitary_matrix_decomposer.su2_decompose(ut: Sequence[Sequence[complex]], eps: float = 1e-15) ndarray[Any, dtype[float64]]#
quri_parts.circuit.transpile.unitary_matrix_decomposer.su4_decompose(ut: Sequence[Sequence[complex]], eiglim: float = 1e-10) tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]]#
class quri_parts.circuit.transpile.unitary_matrix_decomposer.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: QuantumGate) bool#

Determine if a given gate is subject to decomposition.

Parameters:

gate – Gates in the circuit that are scanned from the front.

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.unitary_matrix_decomposer.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: QuantumGate) bool#

Determine if a given gate is subject to decomposition.

Parameters:

gate – Gates in the circuit that are scanned from the front.

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.