class_docstr: Immutable dictionary used to represent a Pauli Word,
  associating wires with their respective operators.
  Can be constructed from a standard dictionary.
  
  .. note::
  
      An empty :class:`~.PauliWord` will be treated as the multiplicative
      identity (i.e identity on all wires).
  
  **Examples**
  
  Initializing a Pauli word:
  
  >>> w = PauliWord({"a": 'X', 2: 'Y', 3: 'Z'})
  >>> w
  X(a) @ Y(2) @ Z(3)
  
  When multiplying Pauli words together we obtain the resulting word and the scalar coefficient.
  
  >>> w1 = PauliWord({0:"X", 1:"Y"})
  >>> w2 = PauliWord({1:"X", 2:"Z"})
  >>> w1 @ w2
  (Z(1) @ Z(2) @ X(0), -1j)
  
  We can multiply scalars to Pauli words or add/subtract them, resulting in a :class:`~PauliSentence` instance.
  
  >>> 0.5 * w1 - 1.5 * w2 + 2
  0.5 * X(0) @ Y(1)
  + -1.5 * X(1) @ Z(2)
  + 2 * I
class_docstr_tok: ["Immutable","dictionary","used","to","represent","a","Pauli","Word",",","associating","wires","with","their","respective","operators",".","Can","be","constructed","from","a","standard","dictionary",".","..","note",":",":","An","empty",":","class",":","`","~.PauliWord","`","will","be","treated","as","the","multiplicative","identity","(","i.e","identity","on","all","wires",")",".","*","*","Examples","*","*","Initializing","a","Pauli","word",":",">",">",">","w","=","PauliWord","(","{","``","a","''",":","'","X","'",",","2",":","'","Y","'",",","3",":","'","Z","'","}",")",">",">",">","w","X","(","a",")","@","Y","(","2",")","@","Z","(","3",")","When","multiplying","Pauli","words","together","we","obtain","the","resulting","word","and","the","scalar","coefficient",".",">",">",">","w1","=","PauliWord","(","{","0",":","''","X","''",",","1",":","''","Y","''","}",")",">",">",">","w2","=","PauliWord","(","{","1",":","''","X","''",",","2",":","''","Z","''","}",")",">",">",">","w1","@","w2","(","Z","(","1",")","@","Z","(","2",")","@","X","(","0",")",",","-1j",")","We","can","multiply","scalars","to","Pauli","words","or","add\/subtract","them",",","resulting","in","a",":","class",":","`","~PauliSentence","`","instance",".",">",">",">","0.5","*","w1","-","1.5","*","w2","+","2","0.5","*","X","(","0",")","@","Y","(","1",")","+","-1.5","*","X","(","1",")","@","Z","(","2",")","+","2","*","I"]
docstr: Returns the matrix representation.
  
  Keyword Args:
      wire_order (iterable or None): The order of qubits in the tensor product.
      format (str): The format of the matrix. It is "dense" by default. Use "csr" for sparse.
      coeff (float): Coefficient multiplying the resulting matrix.
  
  Returns:
      (Union[NumpyArray, ScipySparseArray]): Matrix representation of the Pauli word.
  
  Raises:
      ValueError: Can't get the matrix of an empty PauliWord.
docstr_tok: ["Returns","the","matrix","representation",".","Keyword","Args",":","wire_order","(","iterable","or","None",")",":","The","order","of","qubits","in","the","tensor","product",".","format","(","str",")",":","The","format","of","the","matrix",".","It","is","``","dense","''","by","default",".","Use","``","csr","''","for","sparse",".","coeff","(","float",")",":","Coefficient","multiplying","the","resulting","matrix",".","Returns",":","(","Union","[","NumpyArray",",","ScipySparseArray","]",")",":","Matrix","representation","of","the","Pauli","word",".","Raises",":","ValueError",":","Ca","n't","get","the","matrix","of","an","empty","PauliWord","."]
code: def to_mat(self, wire_order=None, format="dense", coeff=1.0):
      """Returns the matrix representation.
  
      Keyword Args:
          wire_order (iterable or None): The order of qubits in the tensor product.
          format (str): The format of the matrix. It is "dense" by default. Use "csr" for sparse.
          coeff (float): Coefficient multiplying the resulting matrix.
  
      Returns:
          (Union[NumpyArray, ScipySparseArray]): Matrix representation of the Pauli word.
  
      Raises:
          ValueError: Can't get the matrix of an empty PauliWord.
      """
      wire_order = (
          self.wires if wire_order is None else Wires(wire_order)
      )
      if not wire_order.contains_wires(self.wires):
          raise ValueError(
              "Can't get the matrix for the specified wire order because it "
              f"does not contain all the Pauli word's wires {self.wires}"
          )
  
      if len(self) == 0:
          if not wire_order:
              raise ValueError(
                  "Can't get the matrix of an empty PauliWord."
              )
          return (
              np.diag([coeff] * 2 ** len(wire_order))
              if format == "dense"
              else coeff
              * sparse.eye(
                  2 ** len(wire_order),
                  format=format,
                  dtype="complex128",
              )
          )
  
      if format == "dense":
          return coeff * reduce(
              math.kron, (mat_map[self[w]] for w in wire_order)
          )
  
      return self._to_sparse_mat(wire_order, coeff)
  
imports: import warnings
  from copy import copy
  from functools import reduce, lru_cache
  from typing import Iterable
  import numpy
  from scipy import sparse
  import pennylane
  from pennylane import math
  from pennylane.typing import TensorLike
  from pennylane.wires import Wires
  from pennylane.operation import Tensor
  from pennylane.ops import Hamiltonian, Identity, PauliX, PauliY, PauliZ, prod, s_prod
label_desc: Use image node_id 19 for calling the PauliWord obj's underlying member method code with example usage: obj.to_mat(wire_order, format, coeff) and returns: self, unknown, unknown