openfermion.transforms.normal_ordered

Compute and return the normal ordered form of a FermionOperator, BosonOperator, QuadOperator, or InteractionOperator.

Used in the notebooks

Used in the tutorials

Due to the canonical commutation/anticommutation relations satisfied by these operators, there are multiple forms that the same operator can take. Here, we define the normal ordered form of each operator, providing a distinct representation for distinct operators.

In our convention, normal ordering implies terms are ordered from highest tensor factor (on left) to lowest (on right). In addition:

  • FermionOperators: a^\dagger comes before a
  • BosonOperators: b^\dagger comes before b
  • QuadOperators: q operators come before p operators,

operator an instance of the FermionOperator, BosonOperator, QuadOperator, or InteractionOperator classes.
hbar float

the value of hbar used in the definition of the commutator [q_i, p_j] = i hbar delta_ij. By default hbar=1. This argument only applies when normal ordering QuadOperators.