mindquantum.algorithm.library.qudit_symmetric_decoding

查看源文件
mindquantum.algorithm.library.qudit_symmetric_decoding(qubit: np.ndarray, n_qubits: int = 1)[源代码]

对称性解码,将qubit对称态或矩阵解码成qudit态或矩阵。

\[\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}\]
参数:
  • qubit (np.ndarray) - 需要解码的qubit对称态或矩阵,qubit态或矩阵需满足对称性。

  • n_qubits (int) - qubit对称态或矩阵的量子比特数。默认值:1

返回:

np.ndarray,对称性解码后的qudit态或矩阵。

样例:

>>> 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]