Operator Representations

This module provides various data structures for representing fermionic operators in different bases.

Fermion Operator

This operator represents fermionic operators in terms of the second-quantization creation and annihilation operators.

FermionAction

A fermionic creation or annihilation action.

FermionOperator(coeffs, actions, modes, ...)

A spin-less fermionic operator.

cre(mode)

Constructs a creation action on the fermionic mode at mode.

ann(mode)

Constructs an annihilation action on the fermionic mode at mode.

Majorana Operator

This operator represents fermionic operators in terms of Majorana fermions.

MajoranaAction

The MajoranaAction type.

MajoranaOperator(coeffs, modes, boundaries)

A Majorana fermion operator.

gamma(mode, is_prime)

Create a majorana fermion.

Interaction Operators

Many commonly used operators can be expressed as interaction operators which can express operators with even fermionic parity. Such operators are defined in terms of pairs of Majorana actions \(\gamma_k\gamma'_k\) or, equivalently, are generated by the quadratic fermionic operators \(a_i a_j\), \(a_i^\dagger a_j\), \(a_i a^\dagger_j\), and \(a^\dagger_i a^\dagger_j\).

This package provides two different data structures expressing operators of this type in terms of Hermitian generators:

EdgeAction

The EdgeAction type.

TransferAction

The TransferAction type.

EdgeVertexOperator(coeffs, left_indices, ...)

An edge-vertex operator.

TransferVertexOperator(coeffs, left_indices, ...)

A transfer-vertex operator.

Protocol

All operator classes provides by this submodule implement at least those methods specified by the protocol below:

class OperatorTrait(*args, **kwargs)

Bases: Protocol

A protocol indicating all methods implemented by operator classes.

classmethod zero()

Constructs the additive identity operator.

Return type:

Self

classmethod one()

Constructs the multiplicative identity operator.

Return type:

Self

__iadd__(other)

Adds another operator to this one.

Parameters:

other (Self)

__add__(other)

Adds two operators.

Parameters:

other (Self)

Return type:

Self

__isub__(other)

Subtracts another operator from this one.

Parameters:

other (Self)

__sub__(other)

Subtracts two operators.

Parameters:

other (Self)

Return type:

Self

__imul__(other)

Multiplies this operator by a scalar.

Parameters:

other (complex)

__mul__(other)

Multiplies an operator by a scalar.

Parameters:

other (complex)

Return type:

Self

__idiv__(other)

Divides this operator by a scalar.

Parameters:

other (complex)

__div__(other)

Divides an operator by a scalar.

Parameters:

other (complex)

Return type:

Self

__neg__()

Negates this operator.

Return type:

Self

__iand__(other)

Composes (left-multiplies) another operator onto this one.

Parameters:

other (Self)

__and__(other)

Composes (left-multiplies) two operators.

Parameters:

other (Self)

Return type:

Self

__imatmul__(other)

Takes the dot-product (right-multiplication) of another operator onto this one.

Parameters:

other (Self)

__matmul__(other)

Takes the dot-product (right-multiplication) two operators.

Parameters:

other (Self)

Return type:

Self

__pow__(exponent, modulo)

Exponentiates this operator by the integer exponent.

Parameters:
  • exponent (int)

  • modulo (int | None)

Return type:

Self

__len__()

Returns the length of this operator.

Return type:

int

iter_terms()

Iterates over the terms of this operator.

Return type:

Iterator

classmethod from_terms(terms)

Constructs a new operator from an iterator (see also iter_terms()).

Parameters:

terms (Iterable)

Return type:

Self

iter_terms_with_groups()

Iterates over the terms of this operator with their group indices.

Return type:

Iterator

classmethod from_terms_with_groups(terms)

Constructs a new operator from an iterator (see also iter_terms_with_groups()).

Parameters:

terms (Iterable)

Return type:

Self

equiv(other, atol)

Checks this operator with another for equivalence up to the specified absolute tolerance.

Parameters:
Return type:

bool

ichop(atol)

Trims coefficients below the absolute tolerance from this operator.

Parameters:

atol (float)

simplify(atol)

Simplifies the terms of this operator, discarding those below the absolute tolerance.

Parameters:

atol (float)

Return type:

Self

adjoint()

Returns the adjoint of this operator.

Return type:

Self

get_support()

Returns the set of mode indices which this operator acts upon.

Return type:

frozenset[int]

relabel_modes(permutation)

Relabels the modes of the operator.

Parameters:

permutation (list[int])

Return type:

Self

normal_ordered(*args, **kwargs)

Returns the normal-ordered form of this operator.

Note

A specific implementation of this method may take additional arguments.

Return type:

Self

get_coeffs()

Returns the term coefficients.

Return type:

list[complex]

property groups: list[int] | None

Returns the groups indices.

num_groups()

Returns the number of groups.

Return type:

int | None

split_out_groups()

Splits this operator into an optional list of new operators based on its groups.

Return type:

list[Self]