class_docstr: Default qutrit device for PennyLane.
  
  .. warning::
  
      The API of ``DefaultQutrit`` 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']``). Default 1 if not specified.
      shots (None, int): How many times the circuit should be evaluated (or sampled) to estimate
          the expectation values. Defaults to ``None`` if not specified, which means that the device
          returns analytical results.
class_docstr_tok: ["Default","qutrit","device","for","PennyLane",".","..","warning",":",":","The","API","of","``","DefaultQutrit","``","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","'","]","``",")",".","Default","1","if","not","specified",".","shots","(","None",",","int",")",":","How","many","times","the","circuit","should","be","evaluated","(","or","sampled",")","to","estimate","the","expectation","values",".","Defaults","to","``","None","``","if","not","specified",",","which","means","that","the","device","returns","analytical","results","."]
docstr: Initialize the state vector in a specified computational basis state.
  
  Args:
      state (array[int]): computational basis state of shape ``(wires,)``
          consisting of 0s, 1s and 2s.
      wires (Wires): wires that the provided computational state should be initialized on
  
  Note: This function does not support broadcasted inputs yet.
docstr_tok: ["Initialize","the","state","vector","in","a","specified","computational","basis","state",".","Args",":","state","(","array","[","int","]",")",":","computational","basis","state","of","shape","``","(","wires",",",")","``","consisting","of","0s",",","1s","and","2s",".","wires","(","Wires",")",":","wires","that","the","provided","computational","state","should","be","initialized","on","Note",":","This","function","does","not","support","broadcasted","inputs","yet","."]
code: def _apply_basis_state(self, state, wires):
      """Initialize the state vector in a specified computational basis state.
  
      Args:
          state (array[int]): computational basis state of shape ``(wires,)``
              consisting of 0s, 1s and 2s.
          wires (Wires): wires that the provided computational state should be initialized on
  
      Note: This function does not support broadcasted inputs yet.
      """
      # translate to wire labels used by device
      device_wires = self.map_wires(wires)
  
      # length of basis state parameter
      n_basis_state = len(state)
  
      if not set(state.tolist()).issubset({0, 1, 2}):
          raise ValueError(
              "QutritBasisState parameter must consist of 0, 1 or 2 integers."
          )
  
      if n_basis_state != len(device_wires):
          raise ValueError(
              "QutritBasisState parameter and wires must be of equal length."
          )
  
      # get computational basis state number
      basis_states = 3 ** (self.num_wires - 1 - np.array(device_wires))
      basis_states = qml.math.convert_like(basis_states, state)
      num = int(qml.math.dot(state, basis_states))
  
      self._state = self._create_basis_state(num)
  
imports: import functools
  import numpy
  import pennylane
  from pennylane import QutritDevice, QutritBasisState, DeviceError
  from pennylane.wires import WireError
  from pennylane.devices.default_qubit_legacy import _get_slice
  from .._version import __version__
label_desc: Use image node_id 7 for calling the DefaultQutrit obj's underlying member method code with example usage: obj._apply_basis_state(state, wires) without return types