Degrees of freedom and mode indexing#

DoF#

Public names: edinpy.fermion.DoF and edinpy.boson.DoF.

class edinpy.fermion.DoF(size, name=None, labels=None)[source]#

Discrete degree of freedom used to label single-particle modes.

Parameters:
  • size (int) – Number of allowed values of the degree of freedom.

  • name (str, optional) – Descriptive name such as "site", "spin", "species", "orbital", "layer", or "valley".

  • labels (iterable of str, optional) – Names for the individual values of the degree of freedom. Their order is the same as the canonical integer indices 0, 1, ..., size - 1.

Notes

DoF is statistics-independent. It only specifies discrete labels and does not represent a quantum state or Hilbert space by itself.

Shared mode-indexing interface#

FermionModes and BosonModes use the same ordered Cartesian-product indexing of their DoF objects.

FermionModes.dofs#

Degrees of freedom defining the modes.

Type:

tuple[DoF, …]

FermionModes.strides#

Mixed-radix strides for the DoF indices.

Type:

tuple[int, …]

FermionModes.n_modes#

Total number of modes.

Type:

int

FermionModes.resolve(indices)#

Map degree-of-freedom coordinates to a zero-based mode index.

Parameters:

indices (int or iterable of int) – Coordinate along each degree of freedom. A single integer is accepted when the mode set contains only one degree of freedom.

Returns:

Flat mode index in the canonical mixed-radix ordering.

Return type:

int

FermionModes.unravel(mode)#

Map a zero-based mode index to degree-of-freedom coordinates.

Parameters:

mode (int) – Flat mode index in [0, n_modes).

Returns:

Coordinate along each degree of freedom in the order supplied to FermionModes or BosonModes.

Return type:

tuple[int, …]