class_docstr: The Gell-Mann observables for qutrits
  
  The Gell-Mann matrices are a set of 8 linearly independent :math:`3 \times 3` traceless, Hermitian matrices which
  naturally generalize the Pauli matrices from :math:`SU(2)` to :math:`SU(3)`.
  
  .. math::
      \displaystyle \begin{align} \lambda_{1} &= \left(\begin{array}{ccc} 0 & 1 & 0 \\ 1 & 0 & 0\\ 0 & 0 & 0\end{array}\right) \;\;\;\;\;\;\;\;\;\;
      \lambda_{2} = \left(\begin{array}{ccc} 0 & -i & 0 \\ i & 0 & 0\\ 0 & 0 & 0\end{array}\right)\;\;\;\;\;\;\;\;\;\;
      \lambda_{3} = \left(\begin{array}{ccc} 1 & 0 & 0 \\ 0 & -1 & 0\\ 0 & 0 & 0\end{array}\right) \\
      \lambda_{4} &= \left(\begin{array}{ccc} 0 & 0 & 1 \\ 0 & 0 & 0\\ 1 & 0 & 0\end{array}\right)\;\;\;\;\;\;\;\;\;\;
      \lambda_{5} = \left(\begin{array}{ccc} 0 & 0 & -i \\ 0 & 0 & 0\\ i & 0 & 0\end{array}\right) \\
      \lambda_{6} &= \left(\begin{array}{ccc} 0 & 0 & 0 \\ 0 & 0 & 1\\ 0 & 1 & 0\end{array}\right)\;\;\;\;\;\;\;\;\;\;
      \lambda_{7} = \left(\begin{array}{ccc} 0 & 0 & 0 \\ 0 & 0 & -i\\ 0 & i & 0\end{array}\right)\;\;\;\;\;\;\;\;\;\;
      \lambda_{8} = \frac{1}{\sqrt{3}}\left(\begin{array}{ccc} 1 & 0 & 0 \\ 0 & 1 & 0\\ 0 & 0 & -2\end{array}\right)\\ \end{align}
  
  **Details:**
  
  * Number of wires: 1
  * Number of parameters: 0
  * Gradient recipe: None
  
  Args:
      wires (Sequence[int] or int): the wire(s) the observable acts on
      index (int): The index of the Gell-Mann matrix to be used. Must be between 1
          and 8 inclusive
      id (str or None): String representing the operation (optional)
  
  **Example:**
  
  >>> dev = qml.device("default.qutrit", wires=2)
  >>> @qml.qnode(dev)
  ... def test_qnode():
  ...     qml.TShift(wires=0)
  ...     qml.TClock(wires=0)
  ...     qml.TShift(wires=1)
  ...     qml.TAdd(wires=[0, 1])
  ...     return qml.expval(qml.GellMann(wires=0, index=1))
  >>> print(test_qnode())
  0.0
  >>> print(qml.draw(test_qnode)())
  0: ──TShift──TClock─╭●────┤  <GellMann(1)>
  1: ──TShift─────────╰TAdd─┤
class_docstr_tok: ["The","Gell-Mann","observables","for","qutrits","The","Gell-Mann","matrices","are","a","set","of","8","linearly","independent",":","math",":","`","3","\\times","3","`","traceless",",","Hermitian","matrices","which","naturally","generalize","the","Pauli","matrices","from",":","math",":","`","SU","(","2",")","`","to",":","math",":","`","SU","(","3",")","`",".","..","math",":",":","\\displaystyle","\\begin","{","align","}","\\lambda_","{","1","}","&","=","\\left","(","\\begin","{","array","}","{","ccc","}","0","&","1","&","0","\\\\","1","&","0","&","0\\\\","0","&","0","&","0\\end","{","array","}","\\right",")","\\",";","\\",";","\\",";","\\",";","\\",";","\\",";","\\",";","\\",";","\\",";","\\",";","\\lambda_","{","2","}","=","\\left","(","\\begin","{","array","}","{","ccc","}","0","&","-i","&","0","\\\\","i","&","0","&","0\\\\","0","&","0","&","0\\end","{","array","}","\\right",")","\\",";","\\",";","\\",";","\\",";","\\",";","\\",";","\\",";","\\",";","\\",";","\\",";","\\lambda_","{","3","}","=","\\left","(","\\begin","{","array","}","{","ccc","}","1","&","0","&","0","\\\\","0","&","-1","&","0\\\\","0","&","0","&","0\\end","{","array","}","\\right",")","\\\\","\\lambda_","{","4","}","&","=","\\left","(","\\begin","{","array","}","{","ccc","}","0","&","0","&","1","\\\\","0","&","0","&","0\\\\","1","&","0","&","0\\end","{","array","}","\\right",")","\\",";","\\",";","\\",";","\\",";","\\",";","\\",";","\\",";","\\",";","\\",";","\\",";","\\lambda_","{","5","}","=","\\left","(","\\begin","{","array","}","{","ccc","}","0","&","0","&","-i","\\\\","0","&","0","&","0\\\\","i","&","0","&","0\\end","{","array","}","\\right",")","\\\\","\\lambda_","{","6","}","&","=","\\left","(","\\begin","{","array","}","{","ccc","}","0","&","0","&","0","\\\\","0","&","0","&","1\\\\","0","&","1","&","0\\end","{","array","}","\\right",")","\\",";","\\",";","\\",";","\\",";","\\",";","\\",";","\\",";","\\",";","\\",";","\\",";","\\lambda_","{","7","}","=","\\left","(","\\begin","{","array","}","{","ccc","}","0","&","0","&","0","\\\\","0","&","0","&","-i\\\\","0","&","i","&","0\\end","{","array","}","\\right",")","\\",";","\\",";","\\",";","\\",";","\\",";","\\",";","\\",";","\\",";","\\",";","\\",";","\\lambda_","{","8","}","=","\\frac","{","1","}","{","\\sqrt","{","3","}","}","\\left","(","\\begin","{","array","}","{","ccc","}","1","&","0","&","0","\\\\","0","&","1","&","0\\\\","0","&","0","&","-2\\end","{","array","}","\\right",")","\\\\","\\end","{","align","}","*","*","Details",":","*","*","*","Number","of","wires",":","1","*","Number","of","parameters",":","0","*","Gradient","recipe",":","None","Args",":","wires","(","Sequence","[","int","]","or","int",")",":","the","wire","(","s",")","the","observable","acts","on","index","(","int",")",":","The","index","of","the","Gell-Mann","matrix","to","be","used",".","Must","be","between","1","and","8","inclusive","id","(","str","or","None",")",":","String","representing","the","operation","(","optional",")","*","*","Example",":","*","*",">",">",">","dev","=","qml.device","(","``","default.qutrit","''",",","wires=2",")",">",">",">","@","qml.qnode","(","dev",")","...","def","test_qnode","(",")",":","...","qml.TShift","(","wires=0",")","...","qml.TClock","(","wires=0",")","...","qml.TShift","(","wires=1",")","...","qml.TAdd","(","wires=","[","0",",","1","]",")","...","return","qml.expval","(","qml.GellMann","(","wires=0",",","index=1",")",")",">",">",">","print","(","test_qnode","(",")",")","0.0",">",">",">","print","(","qml.draw","(","test_qnode",")","(",")",")","0",":","\u2500\u2500TShift\u2500\u2500TClock\u2500\u256d\u25cf\u2500\u2500\u2500\u2500\u2524","<","GellMann","(","1",")",">","1",":","\u2500\u2500TShift\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2570TAdd\u2500\u2524"]
docstr: Representation of the operator as a canonical matrix in the computational basis (static method).
  
  The canonical matrix is the textbook matrix representation that does not consider wires.
  Implicitly, this assumes that the wires of the operator correspond to the global wire order.
  
  .. seealso:: :meth:`~.GellMann.matrix`
  
  Args:
      index (int): The index of the Gell-Mann matrix to be used. Must be between 1
      and 8 inclusive
  
  Returns:
      tensor_like: canonical matrix
  
  **Example**
  
  >>> qml.GellMann.compute_matrix(8)
  array([[ 0.57735027+0.j,  0.        +0.j,  0.        +0.j],
         [ 0.        +0.j,  0.57735027+0.j,  0.        +0.j],
         [ 0.        +0.j,  0.        +0.j, -1.15470054+0.j]])
docstr_tok: ["Representation","of","the","operator","as","a","canonical","matrix","in","the","computational","basis","(","static","method",")",".","The","canonical","matrix","is","the","textbook","matrix","representation","that","does","not","consider","wires",".","Implicitly",",","this","assumes","that","the","wires","of","the","operator","correspond","to","the","global","wire","order",".","..","seealso",":",":",":","meth",":","`","~.GellMann.matrix","`","Args",":","index","(","int",")",":","The","index","of","the","Gell-Mann","matrix","to","be","used",".","Must","be","between","1","and","8","inclusive","Returns",":","tensor_like",":","canonical","matrix","*","*","Example","*","*",">",">",">","qml.GellMann.compute_matrix","(","8",")","array","(","[","[","0.57735027+0.j",",","0",".","+0.j",",","0",".","+0.j","]",",","[","0",".","+0.j",",","0.57735027+0.j",",","0",".","+0.j","]",",","[","0",".","+0.j",",","0",".","+0.j",",","-1.15470054+0.j","]","]",")"]
code: def compute_matrix(index):  # pylint: disable=arguments-differ
      r"""Representation of the operator as a canonical matrix in the computational basis (static method).
  
      The canonical matrix is the textbook matrix representation that does not consider wires.
      Implicitly, this assumes that the wires of the operator correspond to the global wire order.
  
      .. seealso:: :meth:`~.GellMann.matrix`
  
      Args:
          index (int): The index of the Gell-Mann matrix to be used. Must be between 1
          and 8 inclusive
  
      Returns:
          tensor_like: canonical matrix
  
      **Example**
  
      >>> qml.GellMann.compute_matrix(8)
      array([[ 0.57735027+0.j,  0.        +0.j,  0.        +0.j],
             [ 0.        +0.j,  0.57735027+0.j,  0.        +0.j],
             [ 0.        +0.j,  0.        +0.j, -1.15470054+0.j]])
      """
      return gm_mats[index - 1]
  
file_path: pennylane/pennylane/ops/qutrit/observables.py
imports: import numpy
  import pennylane
  from pennylane.operation import Observable
  from pennylane.ops.qubit import Hermitian
  from pennylane.ops.qutrit import QutritUnitary
label_desc: Use image node_id 4 for calling the GellMann obj's underlying member method code with example usage: obj.compute_matrix(index) and returns: gm_mats