mindquantum.algorithm.library.qutrit_symmetric_ansatz

View Source On Gitee
mindquantum.algorithm.library.qutrit_symmetric_ansatz(gate: UnivMathGate, basis: str = 'zyz', with_phase: bool = False)[source]

Construct a qubit ansatz that preserves the symmetry of encoding for arbitrary qutrit gate.

Reference: Synthesis of multivalued quantum logic circuits by elementary gates, Optimal synthesis of multivalued quantum circuits.

Parameters
  • gate (UnivMathGate) – symmetry-preserving qubit gate encoded by qutrit gate.

  • basis (str) – decomposition basis, can be one of "zyz" or "u3". Default: "zyz".

  • with_phase (bool) – whether return global phase in form of a GlobalPhase gate on the qubit circuit. Default: False.

Returns

Circuit, qubit ansatz that preserves the symmetry of qutrit encoding.

Examples

>>> from scipy.stats import unitary_group
>>> from mindquantum.core.circuit import Circuit
>>> from mindquantum.core.gates import UnivMathGate
>>> from qudit_mapping import qutrit_symmetric_ansatz, qudit_symmetric_encoding
>>> qutrit_unitary = unitary_group.rvs(3)
>>> qutrit_projector = np.eye(4) - qudit_symmetric_encoding(np.eye(3))
>>> qubit_unitary = qudit_symmetric_encoding(qutrit_unitary) + qutrit_projector
>>> qubit_gate = UnivMathGate('U', qubit_unitary).on([0, 1])
>>> print(Circuit() + qubit_gate)
q0: ──U──

q1: ──U──
>>> print(qutrit_symmetric_ansatz(qubit_gate))
q0: ──●────RY(π/2)────●─────────RZ(U_RZ01_0)────RY(U_RY01_0)────RZ(U_Rz01_0)─────────●────RY(-π/2)────●────X──>>
      │       │       │              │               │               │               │       │        │       >>
q1: ──X───────●───────X────X─────────●───────────────●───────────────●──────────X────X───────●────────X───────>>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
q0: <<──●────X────RZ(U_RZ02_1)────RY(U_RY02_1)────RZ(U_Rz02_1)────X────●────X────●────RY(-π/2)────●──>>
    <<  │              │               │               │               │         │       │        │  >>
q1: <<──X──────────────●───────────────●───────────────●───────────────X─────────X───────●────────X──>>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
q0: <<──RZ(U_RZ12_2)────RY(U_RY12_2)────RZ(U_Rz12_2)────●────RY(π/2)────●──
    <<       │               │               │          │       │       │
q1: <<───────●───────────────●───────────────●──────────X───────●───────X──