toqito.matrices.shift

toqito.matrices.shift(dim)[source]

Produce a dim-by-dim shift matrix [WikShift].

Returns the shift matrix of dimension dim described in [WikShift]. The shift matrix generates the following dim-by-dim matrix:

\[\begin{split}\Sigma_{1, d} = \begin{pmatrix} 0 & 0 & 0 & \ldots & 0 & 1 \\ 1 & 0 & 0 & \ldots & 0 & 0 \\ 0 & 1 & 0 & \ldots & 0 & 0 \\ 0 & 0 & 1 & \ldots & 0 & 0 \\ \vdots & \vdots & \vdots & \ddots & \vdots & \vdots \\ 0 & 0 & 0 & \ldots & 1 & 0 \end{pmatrix}\end{split}\]

The shift matrix is primarily used in the construction of the generalized Pauli operators.

Examples

The shift matrix generated from \(d = 3\) yields the following matrix:

\[\begin{split}\Sigma_{1, 3} = \begin{pmatrix} 0 & 0 & 1 \\ 1 & 0 & 0 \\ 0 & 1 & 0 \end{pmatrix}\end{split}\]
>>> from toqito.matrices import shift
>>> shift(3)
[[0., 0., 1.],
 [1., 0., 0.],
 [0., 1., 0.]]

References

[WikShift] (1,2)

Wikipedia: Generalizations of Pauli matrices (https://en.wikipedia.org/wiki/Generalizations_of_Pauli_matrices.

Parameters:

dim – Dimension of the matrix.

Returns:

dim-by-dim shift matrix.