Skip to main content

Spin-½ Operators

This page details the specific operators available for spin-½ systems (qubits). These operators implement the general Operator interface described in the Operators concept guide.

Sites versus Support

All spin-½ operators possess at least one specific attribute: sites. It is crucial to distinguish this from the support of an operator.

  • Sites: An ordered list of indices determining which qubits the operator targets when applied to a state. The order matters for operators that involve interactions (like CNOT, where the first site is target and the second is control) or for mapping matrix elements to qubits.
  • Support: A set (unordered, unique) of indices representing the qubits involved in the operation.

For example, CNOT(1, 2) acting on sites 1 and 2 has sites = [1, 2] and support = {1, 2}.

var m = matrix([[0..4]], as_real)
CNOT(0, 1) * m // [[0, 1, 3, 2]]
CNOT(1, 0) * m // [[0, 3, 2, 1]]

Static Operators

Static operators are purely symbolic and require no numerical parameters, only the site indices they act upon. They represent common quantum gates and standard physics operators.

These are consistent in that they are lighter-weight objects defined entirely by their type and target sites.

Factory FunctionSites (Min)Description
ID()0Identity operator (global)
X(site)1Pauli-X σx\sigma^x
Y(site)1Pauli-Y σy\sigma^y
Z(site)1Pauli-Z σz\sigma^z
SX(site)1Spin-X Sx=12σxS^x = \frac{1}{2}\sigma^x
SY(site)1Spin-Y Sy=12σyS^y = \frac{1}{2}\sigma^y
SZ(site)1Spin-Z Sz=12σzS^z = \frac{1}{2}\sigma^z
Splus(site)1Raising operator S+=Sx+iSyS^+ = S^x + iS^y
Sminus(site)1Lowering operator S=SxiSyS^- = S^x - iS^y
Proj0(site)1Projector onto 00\| 0\rangle\langle 0 \|
Proj1(site)1Projector onto 11\| 1\rangle\langle 1 \|
Hgate(site)1Hadamard gate
Sgate(site)1S gate (PP gate, Z\sqrt{Z})
Tgate(site)1T gate (S\sqrt{S})
XX(site1, site2)2Ising interaction XiXjX_i X_j
YY(site1, site2)2Ising interaction YiYjY_i Y_j
ZZ(site1, site2)2Ising interaction ZiZjZ_i Z_j
XXPYY(site1, site2)2Exchange interaction XiXj+YiYjX_i X_j + Y_i Y_j
CNOT(control, target)2Controlled-NOT gate
SWAP(site1, site2)2SWAP gate
ZN(sites)N (1\ge 1)Sum of local Z terms: iZi\sum_{i} Z_i
ZZNN(sites)N (2\ge 2)Nearest-neighbour ZZ sum: iZiZi+1\sum_{i} Z_i Z_{i+1}
ZZNNN(sites)N (3\ge 3)Next-nearest-neighbour ZZ sum: iZiZi+2\sum_{i} Z_i Z_{i+2}

Parametrized Operators

Parametrized operators are characterized by one or more continuous variables (typically real numbers), representing angles, phases, or coupling constants.

These operators are consistent as they all carry floating-point parameters defining their action (e.g. rotation angles).

Factory FunctionParametersSitesDescription
Phase(phi)phi (real)0Global phase eiϕe^{-i\phi}
RotX(phi, site)phi (real)1Rotation around X: eiϕ2Xe^{-i\frac{\phi}{2} X}
RotY(phi, site)phi (real)1Rotation around Y: eiϕ2Ye^{-i\frac{\phi}{2} Y}
RotZ(phi, site)phi (real)1Rotation around Z: eiϕ2Ze^{-i\frac{\phi}{2} Z}
RotEuler(phi, theta, omega, site)phi, theta, omega1RZ(ω)RX(θ)RZ(ϕ)RZ(\omega)RX(\theta)RZ(\phi)
UnitaryXYZ(Js, sites)Js (vec3)2ei(JxXX+JyYY+JzZZ)e^{-i(J_x XX + J_y YY + J_z ZZ)}
Floquet(Js, sites)Js (vec3)2ei(JxX+JyY+JzZ)Ze^{-i(J_x X + J_y Y + J_z Z) \otimes Z}
DualUnitary(J, sites)J (real)2ei(π4(XX+YY)+JZZ)e^{i(\frac{\pi}{4} (XX + YY) + J ZZ)}

Matrix Operators

Matrix operators are defined explicitly by their matrix elements. This category encompasses dense, sparse, and diagonal matrices.

These operators allow for arbitrary custom actions defined by the values in the matrix.

Factory FunctionParametersDescription
operator_dense(matrix, sites)matrix, sitesDense matrix operator.
operator_sparse(matrix, sites)matrix, sitesSparse matrix operator.
operator_diagonal(diag, sites)diag, sitesDiagonal operator from vector.

Permutation Operators

Permutation operators rearrange the basis states of the system rather than mixing them via complex arithmetic.

These operators are efficient and consistent in that they represent index shuffles or bitwise operations on the state.

Factory FunctionParametersSitesDescription
Flip(site)None1Flips spin at site.
Flip(sites)NoneNFlips spins at sites.
FlipAll()NoneGlobalFlips all spins.
Reflect()NoneGlobalSpatial reflection about center.
Translate(shift)shift (int)GlobalSpatial translation.
Permute(p, sites)p (vec), sitesNArbitrary permutation p on sites.

Pauli Strings

Pauli strings construct operators from sequences of Pauli matrices.

Consistency: Defined by string literals representing the tensor product structure.

Factory FunctionParametersDescription
pauli_string(word, sites)word (string), sitese.g. "XZ" applies X to first site, Z to second.

Generic Operators

Generic operators connect the high-level interface with user-defined low-level logic.

Consistency: Defined by a callback function f(matrix, indices) allowing arbitrary in-place modification.

Factory FunctionParametersDescription
operator_generic(func, sites)func, sitesApplies func to state elements at sites.

Documentation Contributors

Jonathon Riddell

Eunji Yoo

Sebastien J Avakian

Vincent Michaud-Rioux