mindquantum.core.operators.normal_ordered

View Source On Gitee
mindquantum.core.operators.normal_ordered(fermion_operator)[source]

Calculate and return the normal order of the FermionOperator.

By convention, normal ordering implies terms are ordered from highest mode index (on left) to lowest (on right). Also, creation operators come first then follows the annihilation operator. e.g 3 4^ \(\rightarrow\) - 4^ 3.

Parameters

fermion_operator (FermionOperator) – Only Fermion type Operator has such forms.

Returns

FermionOperator, the FermionOperator with normal order.

Examples

>>> from mindquantum.core.operators import FermionOperator, normal_ordered
>>> op = FermionOperator("3 4^", 'a')
>>> normal_ordered(op)
-a [4^ 3]