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)
Attributes
Methods
code/api/pennylane.fermi.FermiSentence
Download Python script
Download Notebook
View on GitHub