mindquantum.algorithm.compiler.u3_decompose#
- mindquantum.algorithm.compiler.u3_decompose(gate: U3, method: str = 'standard')#
Decompose a U3 gate into a sequence of Z-X-Z-X-Z rotations.
The decomposition follows one of two methods: 1. standard: U3(θ,φ,λ) = Rz(φ)Rx(-π/2)Rz(θ)Rx(π/2)Rz(λ) 2. alternative: U3(θ,φ,λ) = Rz(φ)Rx(π/2)Rz(π-θ)Rx(π/2)Rz(λ-π)
When any rotation angle is a constant value and equals to 0, the corresponding RZ gate will be omitted.
- Parameters:
gate (U3) – The U3 gate to be decomposed.
method (str) – The decomposition method to use, either ‘standard’ or ‘alternative’. Default: ‘standard’
- Returns:
A quantum circuit implementing the U3 gate using ZXZXZ sequence.
- Return type:
- Raises:
ValueError – If the method is not ‘standard’ or ‘alternative’.