class_docstr: 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)
class_docstr_tok: ["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\u207a","(","0",")","a","(","1",")","+","3.1","*","a\u207a","(","1",")","a","(","2",")"]
docstr: Multiply two Fermi sentences by iterating over each sentence and multiplying the Fermi
  words pair-wise
docstr_tok: ["Multiply","two","Fermi","sentences","by","iterating","over","each","sentence","and","multiplying","the","Fermi","words","pair-wise"]
code: def __mul__(self, other):
      r"""Multiply two Fermi sentences by iterating over each sentence and multiplying the Fermi
      words pair-wise"""
  
      if isinstance(other, FermiWord):
          other = FermiSentence({other: 1})
  
      if isinstance(other, FermiSentence):
          if (len(self) == 0) or (len(other) == 0):
              return FermiSentence({FermiWord({}): 0})
  
          product = FermiSentence({})
  
          for fw1, coeff1 in self.items():
              for fw2, coeff2 in other.items():
                  product[fw1 * fw2] += coeff1 * coeff2
  
          return product
  
      if isinstance(other, (Number, ndarray)):
          if isinstance(other, ndarray) and qml.math.size(other) > 1:
              raise ValueError(
                  f"Arithmetic Fermi operations can only accept an array of length 1, "
                  f"but received {other} of length {len(other)}"
              )
          vals = [i * other for i in self.values()]
          return FermiSentence(dict(zip(self.keys(), vals)))
  
      raise TypeError(
          f"Cannot multiply FermiSentence by {type(other)}."
      )
  
imports: import re
  from copy import copy
  from numbers import Number
  from numpy import ndarray
  import pennylane
label_desc: Use image node_id 10 for calling the FermiSentence obj's underlying member method code with example usage: obj.__mul__(other) and returns: product, FermiSentence, FermiSentence