class_docstr: The single qutrit Z rotation
  
  Performs the RZ operation on the specified 2D subspace. The subspace is
  given as a keyword argument and determines which two of three single-qutrit
  basis states the operation applies to.
  
  The construction of this operator is based on section 3 of
  `Di et al. (2012) <https://arxiv.org/abs/1105.5485>`_.
  
  .. math:: TRZ^{jk}(\phi) = \exp(-i\phi\sigma_z^{jk}/2),
  
  where :math:`\sigma_z^{jk} = |j\rangle\langle j| - |k\rangle\langle k|;`
  :math:`j, k \in \{0, 1, 2\}, j < k`.
  
  **Details:**
  
  * Number of wires: 1
  * Number of parameters: 1
  * Number of dimensions per parameter: (0,)
  
  Args:
      phi (float): rotation angle :math:`\phi`
      wires (Sequence[int] or int): the wire the operation acts on
      subspace (Sequence[int]): the 2D subspace on which to apply operation
      id (str or None): String representing the operation (optional)
  
  **Example**
  
  The specified subspace will determine which basis states the operation actually
  applies to:
  
  >>> qml.TRZ(0.5, wires=0, subspace=(0, 1)).matrix()
  array([[0.96891242-0.24740396j, 0.        +0.j        , 0.        +0.j        ],
         [0.        +0.j        , 0.96891242+0.24740396j, 0.        +0.j        ],
         [0.        +0.j        , 0.        +0.j        , 1.        +0.j        ]])
  
  >>> qml.TRZ(0.5, wires=0, subspace=(0, 2)).matrix()
  array([[0.96891242-0.24740396j, 0.        +0.j        , 0.        +0.j        ],
         [0.        +0.j        , 1.        +0.j        , 0.        +0.j        ],
         [0.        +0.j        , 0.        +0.j        , 0.96891242+0.24740396j]])
  
  >>> qml.TRZ(0.5, wires=0, subspace=(1, 2)).matrix()
  array([[1.        +0.j        , 0.        +0.j        , 0.        +0.j        ],
         [0.        +0.j        , 0.96891242-0.24740396j, 0.        +0.j        ],
         [0.        +0.j        , 0.        +0.j        , 0.96891242+0.24740396j]])
class_docstr_tok: ["The","single","qutrit","Z","rotation","Performs","the","RZ","operation","on","the","specified","2D","subspace",".","The","subspace","is","given","as","a","keyword","argument","and","determines","which","two","of","three","single-qutrit","basis","states","the","operation","applies","to",".","The","construction","of","this","operator","is","based","on","section","3","of","`","Di","et","al",".","(","2012",")","<","https",":","\/\/arxiv.org\/abs\/1105.5485",">","`","_",".","..","math",":",":","TRZ^","{","jk","}","(","\\phi",")","=","\\exp","(","-i\\phi\\sigma_z^","{","jk","}","\/2",")",",","where",":","math",":","`","\\sigma_z^","{","jk","}","=","|j\\rangle\\langle","j|","-","|k\\rangle\\langle","k|",";","`",":","math",":","`","j",",","k","\\in","\\","{","0",",","1",",","2\\","}",",","j","<","k","`",".","*","*","Details",":","*","*","*","Number","of","wires",":","1","*","Number","of","parameters",":","1","*","Number","of","dimensions","per","parameter",":","(","0",",",")","Args",":","phi","(","float",")",":","rotation","angle",":","math",":","`","\\phi","`","wires","(","Sequence","[","int","]","or","int",")",":","the","wire","the","operation","acts","on","subspace","(","Sequence","[","int","]",")",":","the","2D","subspace","on","which","to","apply","operation","id","(","str","or","None",")",":","String","representing","the","operation","(","optional",")","*","*","Example","*","*","The","specified","subspace","will","determine","which","basis","states","the","operation","actually","applies","to",":",">",">",">","qml.TRZ","(","0.5",",","wires=0",",","subspace=","(","0",",","1",")",")",".matrix","(",")","array","(","[","[","0.96891242-0.24740396j",",","0",".","+0.j",",","0",".","+0.j","]",",","[","0",".","+0.j",",","0.96891242+0.24740396j",",","0",".","+0.j","]",",","[","0",".","+0.j",",","0",".","+0.j",",","1",".","+0.j","]","]",")",">",">",">","qml.TRZ","(","0.5",",","wires=0",",","subspace=","(","0",",","2",")",")",".matrix","(",")","array","(","[","[","0.96891242-0.24740396j",",","0",".","+0.j",",","0",".","+0.j","]",",","[","0",".","+0.j",",","1",".","+0.j",",","0",".","+0.j","]",",","[","0",".","+0.j",",","0",".","+0.j",",","0.96891242+0.24740396j","]","]",")",">",">",">","qml.TRZ","(","0.5",",","wires=0",",","subspace=","(","1",",","2",")",")",".matrix","(",")","array","(","[","[","1",".","+0.j",",","0",".","+0.j",",","0",".","+0.j","]",",","[","0",".","+0.j",",","0.96891242-0.24740396j",",","0",".","+0.j","]",",","[","0",".","+0.j",",","0",".","+0.j",",","0.96891242+0.24740396j","]","]",")"]
code: def generator(self):
      if self.subspace == (0, 1):
          return qml.s_prod(
              -0.5, qml.GellMann(wires=self.wires, index=3)
          )
  
      if self.subspace == (0, 2):
          coeffs = [-0.25, -0.25 * np.sqrt(3)]
          obs = [
              qml.GellMann(wires=self.wires, index=3),
              qml.GellMann(wires=self.wires, index=8),
          ]
          return qml.dot(coeffs, obs)
  
      coeffs = [0.25, -0.25 * np.sqrt(3)]
      obs = [
          qml.GellMann(wires=self.wires, index=3),
          qml.GellMann(wires=self.wires, index=8),
      ]
      return qml.dot(coeffs, obs)
  
imports: import functools
  import numpy
  import pennylane
  from pennylane.operation import Operation
label_desc: Use image node_id 1 for calling the TRZ obj's underlying member method code with example usage: obj.generator() and returns: qml, qml, qml