Skip to main content

OperatorNamed

Represents a named spin-1/2 operator acting on specified sites. Create instances using factory functions like X(), Y(), Z(), CNOT(), SWAP(), etc.

Factories

CNOT(const List<integer> sites) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for the CNOT (controlled-NOT) gate, taking a vector of site indices.

Parameters

  • sites: Vector of two site indices: [control, target].

Example

var cnot2 = CNOT([1, 2])

CNOT(integer site0, integer site1) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for the CNOT (controlled-NOT) gate, taking two individual site indices.

Parameters

  • site0: The control qubit site index.
  • site1: The target qubit site index.

Example

var cnot1 = CNOT(0, 1)

Hgate(integer site) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for the Hadamard gate.

Parameters

  • site: The site index where the operator acts (exactly 1 site required).

Example

var h0 = Hgate(0)

ID() -> OperatorNamed

Returns a spin-1/2 OperatorNamed for the Identity operator. No site parameter is required as it acts globally.

Example

var id = ID()

Proj0(integer site) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for the projector 00|0\rangle\langle 0|.

Parameters

  • site: The site index where the operator acts (exactly 1 site required).

Example

var p0_op = Proj0(0)

Proj1(integer site) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for the projector 11|1\rangle\langle 1|.

Parameters

  • site: The site index where the operator acts (exactly 1 site required).

Example

var p1_op = Proj1(1)

SWAP(const List<integer> sites) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for the SWAP gate, taking a vector of site indices.

Parameters

  • sites: Vector of two site indices where the operator acts.

Example

var swap2 = SWAP([2, 3])

SWAP(integer site0, integer site1) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for the SWAP gate, taking two individual site indices.

Parameters

  • site0: The first site index.
  • site1: The second site index.

Example

var swap1 = SWAP(0, 1)

SX(integer site) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for Spin-X operator.

Parameters

  • site: The site index where the operator acts (exactly 1 site required).

Example

var sx0 = SX(0)

SY(integer site) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for Spin-Y operator.

Parameters

  • site: The site index where the operator acts (exactly 1 site required).

Example

var sy1 = SY(1)

SZ(integer site) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for Spin-Z operator.

Parameters

  • site: The site index where the operator acts (exactly 1 site required).

Example

var sz2 = SZ(2)

Sgate(integer site) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for the S gate.

Parameters

  • site: The site index where the operator acts (exactly 1 site required).

Example

var s0 = Sgate(0)

Sminus(integer site) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for Spin-minus operator.

Parameters

  • site: The site index where the operator acts (exactly 1 site required).

Example

var sm1 = Sminus(1)

Splus(integer site) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for Spin-plus operator.

Parameters

  • site: The site index where the operator acts (exactly 1 site required).

Example

var sp0 = Splus(0)

Tgate(integer site) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for the T gate.

Parameters

  • site: The site index where the operator acts (exactly 1 site required).

Example

var t0 = Tgate(0)

X(integer site) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for Pauli-X operator.

Parameters

  • site: The site index where the operator acts (exactly 1 site required).

Example

var px0 = X(0)

XX(const List<integer> sites) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for XiXjX_i \cdot X_j operator, taking a vector of site indices.

Parameters

  • sites: Vector of exactly two site indices [i,j][i, j] where the operator acts.

Example

var pxx2 = XX([2, 3])

XX(integer site0, integer site1) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for XiXjX_i \cdot X_j operator, taking two individual site indices.

Parameters

  • site0: The first site index (ii).
  • site1: The second site index (jj).

Example

var pxx1 = XX(1, 2)

XXPYY(const List<integer> sites) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for XiXj+YiYjX_i \cdot X_j + Y_i \cdot Y_j operator, taking a vector of site indices.

Parameters

  • sites: Vector of two site indices where the operator acts.

Example

var xxpyy2 = XXPYY([2, 3])

XXPYY(integer site0, integer site1) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for XiXj+YiYjX_i \cdot X_j + Y_i \cdot Y_j operator, taking two individual site indices.

Parameters

  • site0: The first site index.
  • site1: The second site index.

Example

var xxpyy1 = XXPYY(0, 1)

Y(integer site) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for Pauli-Y operator.

Parameters

  • site: The site index where the operator acts (exactly 1 site required).

Example

var py1 = Y(1)

YY(const List<integer> sites) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for YiYjY_i \cdot Y_j operator, taking a vector of site indices.

Parameters

  • sites: Vector of two site indices where the operator acts.

Example

var pyy2 = YY([1, 3])

YY(integer site0, integer site1) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for YiYjY_i \cdot Y_j operator, taking two individual site indices.

Parameters

  • site0: The first site index.
  • site1: The second site index.

Example

var pyy1 = YY(0, 1)

Z(integer site) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for Pauli-Z operator.

Parameters

  • site: The site index where the operator acts (exactly 1 site required).

Example

var pz2 = Z(2)

ZN(const List<integer> sites) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for isitesZi \sum_{i \in \text{sites}} Z_i operator.

Parameters

  • sites: Vector of site indices where the operator acts (minimum 1 site).

Example

var zn_s = ZN([0])     // Single site: use brackets (vector format) 
var zn_m = ZN([0, 1, 2, 3])
// ZN(0) would be INVALID - missing brackets

ZZ(const List<integer> sites) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for ZiZjZ_i \cdot Z_j operator, taking a vector of site indices.

Parameters

  • sites: Vector of two site indices where the operator acts.

Example

var pzz2 = ZZ([1, 2])

ZZ(integer site0, integer site1) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for ZiZjZ_i \cdot Z_j operator, taking two individual site indices.

Parameters

  • site0: The first site index.
  • site1: The second site index.

Example

var pzz1 = ZZ(0, 2)

ZZNN(const List<integer> sites) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for isitesZiZi+1 \sum_{i \in \text{sites}} Z_i \otimes Z_{i+1} operator.

Parameters

  • sites: Vector of site indices where the operator acts (minimum 2 sites).

Example

var zznn_s = ZZNN([0, 1])     // Minimum sites: use brackets (vector format)  
var zznn_m = ZZNN([0, 1, 2, 3])
// ZZNN(0, 1) would be INVALID - missing brackets

ZZNNN(const List<integer> sites) -> OperatorNamed

Returns a spin-1/2 OperatorNamed for isitesZiZi+2 \sum_{i \in \text{sites}} Z_i \otimes Z_{i+2} operator.

Parameters

  • sites: Vector of site indices where the operator acts (minimum 3 sites).

Example

var zznnn_s = ZZNNN([0, 1, 2])     //  use brackets (vector format)  
var zznnn_m = ZZNNN([0, 1, 2, 3, 4])
// ZZNNN(0, 1, 2) would be INVALID - missing brackets

Symbols

NameDescription
*Multiplies an OperatorNamed with a general Operator to create an OperatorProduct.
=Assignment operator for OperatorNamed.