Operator Basis Module

The operator_basis module provides fundamental operator definitions for different quantum systems.

Two-Level System (TLS)

class qepsilon.operator_basis.Pauli(n_qubits: int)[source]

Bases: Module

This class deals with Pauli operators.

__init__(n_qubits: int)[source]

Initialize internal Module state, shared by both nn.Module and ScriptModule.

along_u(u: FloatTensor)[source]

This function returns (Pauli vector dot u). u is a direction vector. :param u: the direction vector. Should be a real-valued tensor. Shape: (3) or (nbatch, 3)

Returns:

the (batched) Pauli operator. Shape: (2,2) or (nbatch, 2, 2)

Return type:

M

SU2_rotation(u: Tensor, theta: Tensor)[source]

This function returns the SU(2) rotation operator about the direction u by angle theta. :param u: the (batched) direction of the rotation. Shape: (3) or (nbatch, 3) :param theta: the (batched) angle of the rotation. Shape: (1) or (nbatch)

Returns:

the (batched) rotation operator. Shape: (2,2) or (nbatch, 2, 2)

Return type:

M

get_sequence_ops(name_sequence: str)[source]

This function returns a sequence of Pauli operators. :param name_sequence: a string of Pauli operator names. Example: “XYZI”

get_composite_ops(name_sequence: str)[source]

This function returns a composite Pauli operator.

class qepsilon.operator_basis.Kraus[source]

Bases: Pauli

This class deals with Kraus operators.

__init__()[source]

Initialize internal Module state, shared by both nn.Module and ScriptModule.

depolarizing_operators(p: float)[source]

This function returns the Kraus operators of the depolarizing channel. This channel represents a situation where the system is subject to a random unitary error with equal probability between X, Y, and Z.

dephasing_operators(gamma: float)[source]

This function returns the Kraus operators of the dephasing channel. This channel represents a situation where the system is subject to a random phase error.

amplitude_damping_operators(gamma: float)[source]

This function returns the Kraus operators of the amplitude damping channel. This channel represents a situation where the system experience energy dissipation, such as spontaneous emission.

Bosonic Operators

class qepsilon.operator_basis.Boson(nmax: int)[source]

Bases: Module

This class deals with boson operators.

__init__(nmax: int)[source]

Initialize internal Module state, shared by both nn.Module and ScriptModule.

get_sequence_ops(name_sequence: str)[source]

This function returns a sequence of boson operators for a bosonic system with multiple modes. :param name_sequence: a string of boson operator names. Example: “UDI” for creation of mode 0, annihilation of mode 1, identity of mode 2.

get_composite_ops(name_sequence: str)[source]

This function returns a composite boson operator.

Tight-Binding System

class qepsilon.operator_basis.TightBinding(n_sites: int, pbc: bool = True)[source]

Bases: Module

This class deals with tight binding operators and related operations.

__init__(n_sites: int, pbc: bool = True)[source]

Initialize internal Module state, shared by both nn.Module and ScriptModule.

get_composite_ops(name_sequence: str)[source]

Returns a composite tight binding operator as a matrix.

Parameters:

name_sequence (str) –

A string of tight binding operator names, one per site. Allowed characters are:

  • ”X”: identity operator on the site

  • ”L”: hopping to the left (from site i to site i-1)

  • ”R”: hopping to the right (from site i to site i+1)

  • ”N”: number operator on the site

The string must have length equal to the number of sites, and contain at most one non-“X” character.

Examples:

  1. ”XXLXX”: \(| 2\rangle\langle 3 |\), the particle on the third site hops to the left.

  2. ”XXRXX”: \(| 4\rangle\langle 3 |\), the particle on the third site hops to the right.

  3. ”XXNXX”: \(| 3\rangle\langle 3 |\), number operator for the third site.

  4. ”XXXXX”: Identity operator for all sites (sum of projectors onto each site).

Returns:

The operator matrix of shape (n_sites, n_sites).

Return type:

torch.Tensor