mindquantum.algorithm.library.qudit_symmetric_decoding

View Source On Gitee
mindquantum.algorithm.library.qudit_symmetric_decoding(qubit: np.ndarray, n_qubits: int = 1)[source]

Qudit symmetric decoding, decodes a qubit symmetric state or matrix into a qudit state or matrix.

\[\begin{split}\begin{align} \ket{00\cdots00}&\to\ket{0} \\[.5ex] \frac{\ket{0\cdots01}+\ket{0\cdots010}+\ket{10\cdots0}}{\sqrt{d-1}}&\to\ket{1} \\ \frac{\ket{0\cdots011}+\ket{0\cdots0101}+\ket{110\cdots0}}{\sqrt{d-1}}&\to\ket{2} \\ \vdots&\qquad\vdots \\[.5ex] \ket{11\cdots11}&\to\ket{d-1} \end{align}\end{split}\]
Parameters
  • qubit (np.ndarray) – the qubit symmetric state or matrix that needs to be decoded, where the qubit state or matrix must preserve symmetry.

  • n_qubits (int) – the number of qubits in the qubit symmetric state or matrix. Default: 1.

Returns

np.ndarray, the qudit state or matrix obtained after the qudit symmetric decoding.

Examples

>>> import numpy as np
>>> from mindquantum.algorithm.library.qudit_mapping import qudit_symmetric_decoding
>>> qubit = np.array([1., 2., 2., 3.])
>>> qubit /= np.linalg.norm(qubit)
>>> print(qubit)
[0.23570226 0.47140452 0.47140452 0.70710678]
>>> print(qudit_symmetric_decoding(qubit))
[0.23570226+0.j 0.66666667+0.j 0.70710678+0.j]