class_docstr: DiagonalQubitUnitary(D, wires)
  Apply an arbitrary diagonal unitary matrix with a dimension that is a power of two.
  
  **Details:**
  
  * Number of wires: Any (the operation can act on any number of wires)
  * Number of parameters: 1
  * Number of dimensions per parameter: (1,)
  * Gradient recipe: None
  
  Args:
      D (array[complex]): diagonal of unitary matrix
      wires (Sequence[int] or int): the wire(s) the operation acts on
class_docstr_tok: ["DiagonalQubitUnitary","(","D",",","wires",")","Apply","an","arbitrary","diagonal","unitary","matrix","with","a","dimension","that","is","a","power","of","two",".","*","*","Details",":","*","*","*","Number","of","wires",":","Any","(","the","operation","can","act","on","any","number","of","wires",")","*","Number","of","parameters",":","1","*","Number","of","dimensions","per","parameter",":","(","1",",",")","*","Gradient","recipe",":","None","Args",":","D","(","array","[","complex","]",")",":","diagonal","of","unitary","matrix","wires","(","Sequence","[","int","]","or","int",")",":","the","wire","(","s",")","the","operation","acts","on"]
docstr: Eigenvalues of the operator in the computational basis (static method).
  
  If :attr:`diagonalizing_gates` are specified and implement a unitary :math:`U^{\dagger}`,
  the operator can be reconstructed as
  
  .. math:: O = U \Sigma U^{\dagger},
  
  where :math:`\Sigma` is the diagonal matrix containing the eigenvalues.
  
  Otherwise, no particular order for the eigenvalues is guaranteed.
  
  .. seealso:: :meth:`~.DiagonalQubitUnitary.eigvals`
  
  Args:
      D (tensor_like): diagonal of the matrix
  
  Returns:
      tensor_like: eigenvalues
  
  **Example**
  
  >>> qml.DiagonalQubitUnitary.compute_eigvals(torch.tensor([1, -1]))
  tensor([ 1, -1])
docstr_tok: ["Eigenvalues","of","the","operator","in","the","computational","basis","(","static","method",")",".","If",":","attr",":","`","diagonalizing_gates","`","are","specified","and","implement","a","unitary",":","math",":","`","U^","{","\\dagger","}","`",",","the","operator","can","be","reconstructed","as","..","math",":",":","O","=","U","\\Sigma","U^","{","\\dagger","}",",","where",":","math",":","`","\\Sigma","`","is","the","diagonal","matrix","containing","the","eigenvalues",".","Otherwise",",","no","particular","order","for","the","eigenvalues","is","guaranteed",".","..","seealso",":",":",":","meth",":","`","~.DiagonalQubitUnitary.eigvals","`","Args",":","D","(","tensor_like",")",":","diagonal","of","the","matrix","Returns",":","tensor_like",":","eigenvalues","*","*","Example","*","*",">",">",">","qml.DiagonalQubitUnitary.compute_eigvals","(","torch.tensor","(","[","1",",","-1","]",")",")","tensor","(","[","1",",","-1","]",")"]
code: def compute_eigvals(D):  # pylint: disable=arguments-differ
      r"""Eigenvalues of the operator in the computational basis (static method).
  
      If :attr:`diagonalizing_gates` are specified and implement a unitary :math:`U^{\dagger}`,
      the operator can be reconstructed as
  
      .. math:: O = U \Sigma U^{\dagger},
  
      where :math:`\Sigma` is the diagonal matrix containing the eigenvalues.
  
      Otherwise, no particular order for the eigenvalues is guaranteed.
  
      .. seealso:: :meth:`~.DiagonalQubitUnitary.eigvals`
  
      Args:
          D (tensor_like): diagonal of the matrix
  
      Returns:
          tensor_like: eigenvalues
  
      **Example**
  
      >>> qml.DiagonalQubitUnitary.compute_eigvals(torch.tensor([1, -1]))
      tensor([ 1, -1])
      """
      D = qml.math.asarray(D)
  
      if not (
          qml.math.is_abstract(D)
          or qml.math.allclose(
              D * qml.math.conj(D), qml.math.ones_like(D)
          )
      ):
          raise ValueError("Operator must be unitary.")
  
      return D
  
imports: import warnings
  from itertools import product
  import numpy
  from scipy.linalg import fractional_matrix_power
  from pennylane.math import norm, cast, eye, zeros, transpose, conj, sqrt, sqrt_matrix
  from pennylane import numpy
  import pennylane
  from pennylane.operation import AnyWires, DecompositionUndefinedError, Operation
  from pennylane.wires import Wires
label_desc: Use image node_id 2 for calling the DiagonalQubitUnitary obj's underlying member method code with example usage: obj.compute_eigvals(D) and returns: D