class_docstr: Default qubit device for performing mixed-state computations in PennyLane.
  
  .. warning::
  
      The API of ``DefaultMixed`` will be updated soon to follow a new device interface described
      in :class:`pennylane.devices.Device`.
  
      This change will not alter device behaviour for most workflows, but may have implications for
      plugin developers and users who directly interact with device methods. Please consult
      :class:`pennylane.devices.Device` and the implementation in
      :class:`pennylane.devices.DefaultQubit` for more information on what the new
      interface will look like and be prepared to make updates in a coming release. If you have any
      feedback on these changes, please create an
      `issue <https://github.com/PennyLaneAI/pennylane/issues>`_ or post in our
      `discussion forum <https://discuss.pennylane.ai/>`_.
  
  Args:
      wires (int, Iterable[Number, str]): Number of subsystems represented by the device,
          or iterable that contains unique labels for the subsystems as numbers
          (i.e., ``[-1, 0, 2]``) or strings (``['ancilla', 'q1', 'q2']``).
      shots (None, int): Number of times the circuit should be evaluated (or sampled) to estimate
          the expectation values. Defaults to ``None`` if not specified, which means that
          outputs are computed exactly.
      readout_prob (None, int, float): Probability for adding readout error to the measurement
          outcomes of observables. Defaults to ``None`` if not specified, which means that the outcomes are
          without any readout error.
class_docstr_tok: ["Default","qubit","device","for","performing","mixed-state","computations","in","PennyLane",".","..","warning",":",":","The","API","of","``","DefaultMixed","``","will","be","updated","soon","to","follow","a","new","device","interface","described","in",":","class",":","`","pennylane.devices.Device","`",".","This","change","will","not","alter","device","behaviour","for","most","workflows",",","but","may","have","implications","for","plugin","developers","and","users","who","directly","interact","with","device","methods",".","Please","consult",":","class",":","`","pennylane.devices.Device","`","and","the","implementation","in",":","class",":","`","pennylane.devices.DefaultQubit","`","for","more","information","on","what","the","new","interface","will","look","like","and","be","prepared","to","make","updates","in","a","coming","release",".","If","you","have","any","feedback","on","these","changes",",","please","create","an","`","issue","<","https",":","\/\/github.com\/PennyLaneAI\/pennylane\/issues",">","`","_","or","post","in","our","`","discussion","forum","<","https",":","\/\/discuss.pennylane.ai\/",">","`","_",".","Args",":","wires","(","int",",","Iterable","[","Number",",","str","]",")",":","Number","of","subsystems","represented","by","the","device",",","or","iterable","that","contains","unique","labels","for","the","subsystems","as","numbers","(","i.e.",",","``","[","-1",",","0",",","2","]","``",")","or","strings","(","``","[","'ancilla","'",",","'q1","'",",","'q2","'","]","``",")",".","shots","(","None",",","int",")",":","Number","of","times","the","circuit","should","be","evaluated","(","or","sampled",")","to","estimate","the","expectation","values",".","Defaults","to","``","None","``","if","not","specified",",","which","means","that","outputs","are","computed","exactly",".","readout_prob","(","None",",","int",",","float",")",":","Probability","for","adding","readout","error","to","the","measurement","outcomes","of","observables",".","Defaults","to","``","None","``","if","not","specified",",","which","means","that","the","outcomes","are","without","any","readout","error","."]
docstr: Return the Kraus operators representing the operation.
  
  Args:
      operation (.Operation): a PennyLane operation
  
  Returns:
      list[array[complex]]: Returns a list of 2D matrices representing the Kraus operators. If
      the operation is unitary, returns a single Kraus operator. In the case of a diagonal
      unitary, returns a 1D array representing the matrix diagonal.
docstr_tok: ["Return","the","Kraus","operators","representing","the","operation",".","Args",":","operation","(",".Operation",")",":","a","PennyLane","operation","Returns",":","list","[","array","[","complex","]","]",":","Returns","a","list","of","2D","matrices","representing","the","Kraus","operators",".","If","the","operation","is","unitary",",","returns","a","single","Kraus","operator",".","In","the","case","of","a","diagonal","unitary",",","returns","a","1D","array","representing","the","matrix","diagonal","."]
code: def _get_kraus(self, operation):  # pylint: disable=no-self-use
      """Return the Kraus operators representing the operation.
  
      Args:
          operation (.Operation): a PennyLane operation
  
      Returns:
          list[array[complex]]: Returns a list of 2D matrices representing the Kraus operators. If
          the operation is unitary, returns a single Kraus operator. In the case of a diagonal
          unitary, returns a 1D array representing the matrix diagonal.
      """
      if operation in diagonal_in_z_basis:
          return operation.eigvals()
  
      if isinstance(operation, Channel):
          return operation.kraus_matrices()
  
      return [operation.matrix()]
  
imports: import functools
  import itertools
  from collections import defaultdict
  from string import ascii_letters
  import numpy
  import pennylane
  import pennylane.math
  from pennylane import BasisState, DeviceError, QubitDensityMatrix, QubitDevice, StatePrep, Snapshot
  from pennylane.measurements import CountsMP, MutualInfoMP, SampleMP, StateMP, VnEntropyMP, PurityMP
  from pennylane.operation import Channel
  from pennylane.ops.qubit.attributes import diagonal_in_z_basis
  from pennylane.wires import Wires
  from .._version import __version__
label_desc: Use image node_id 11 for calling the DefaultMixed obj's underlying member method code with example usage: obj._get_kraus(operation) and returns: list, operation, operation