openfermion.transforms.symmetric_ordering

Apply the symmetric ordering to a BosonOperator or QuadOperator.

Used in the notebooks

Used in the tutorials

The symmetric ordering is performed by applying McCoy's formula directly to polynomial terms of quadrature operators:

q^m p^n -> (1/ 2^n) sum_{r=0}^{n} Binomial(n, r) q^r p^m q^{n-r}

In this case, Hermiticity cannot be guaranteed - as such, by default term coefficients and identity operators are ignored. However, this behavior can be modified via keyword arguments describe below if necessary.

operator either a BosonOperator or QuadOperator. ignore_coeff (bool): By default, the coefficients for each term are ignored; S(a q^m p^n) = S(q^m p^n), and the returned operator is always Hermitian. If set to False, then instead the coefficients are taken into account; S(q^m p^n) = a S(q^m p^n). In this case, if a is a complex coefficient, it is not guaranteed that the the returned operator will be Hermitian. ignore_identity (bool): By default, identity terms are ignore; S(I) = 0. If set to False, then instead S(I) = I.

transformed_operator an operator of the same class as in the input.

Warning:

The runtime of this method is exponential in the maximum locality of the original operator.