qml.fermi.FermiSentence

class FermiSentence(operator)[source]

Bases: dict

Immutable dictionary used to represent a Fermi sentence, a linear combination of Fermi words, with the keys as FermiWord instances and the values correspond to coefficients.

>>> w1 = FermiWord({(0, 0) : '+', (1, 1) : '-'})
>>> w2 = FermiWord({(0, 1) : '+', (1, 2) : '-'})
>>> s = FermiSentence({w1 : 1.2, w2: 3.1})
>>> s
1.2 * a⁺(0) a(1)
+ 3.1 * a⁺(1) a(2)

wires

Return wires of the FermiSentence.

wires

Return wires of the FermiSentence.

simplify([tol])

Remove any FermiWords in the FermiSentence with coefficients less than the threshold tolerance.

simplify(tol=1e-08)[source]

Remove any FermiWords in the FermiSentence with coefficients less than the threshold tolerance.