mindquantum.algorithm.compiler.u3_decompose

查看源文件
mindquantum.algorithm.compiler.u3_decompose(gate: U3, method: str = 'standard')[源代码]

将U3门分解为Z-X-Z-X-Z旋转序列。

分解可以遵循以下两种方法之一:

  1. 标准方法:U3(θ,φ,λ) = Rz(φ)Rx(-π/2)Rz(θ)Rx(π/2)Rz(λ)

  2. 替代方法:U3(θ,φ,λ) = Rz(φ)Rx(π/2)Rz(π-θ)Rx(π/2)Rz(λ-π)

当任何旋转角度为常数且等于0时,相应的RZ门将被省略。

参数:
  • gate (U3) - 需要被分解的U3门。

  • method (str) - 使用的分解方法,可以是'standard'或'alternative'。默认值:'standard'。

返回:

Circuit,使用ZXZXZ序列实现U3门的量子线路。

异常:
  • ValueError - 当method既不是'standard'也不是'alternative'时。