class_docstr: BasisState(n, wires)
  Prepares a single computational basis state.
  
  **Details:**
  
  * Number of wires: Any (the operation can act on any number of wires)
  * Number of parameters: 1
  * Gradient recipe: None (integer parameters not supported)
  
  .. note::
  
      If the ``BasisState`` operation is not supported natively on the
      target device, PennyLane will attempt to decompose the operation
      into :class:`~.PauliX` operations.
  
  .. note::
  
      When called in the middle of a circuit, the action of the operation is defined
      as :math:`U|0\rangle = |\psi\rangle`
  
  Args:
      n (array): prepares the basis state :math:`\ket{n}`, where ``n`` is an
          array of integers from the set :math:`\{0, 1\}`, i.e.,
          if ``n = np.array([0, 1, 0])``, prepares the state :math:`|010\rangle`.
      wires (Sequence[int] or int): the wire(s) the operation acts on
      id (str): custom label given to an operator instance,
          can be useful for some applications where the instance has to be identified.
  
  **Example**
  
  >>> dev = qml.device('default.qubit', wires=2)
  >>> @qml.qnode(dev)
  ... def example_circuit():
  ...     qml.BasisState(np.array([1, 1]), wires=range(2))
  ...     return qml.state()
  >>> print(example_circuit())
  [0.+0.j 0.+0.j 0.+0.j 1.+0.j]
class_docstr_tok: ["BasisState","(","n",",","wires",")","Prepares","a","single","computational","basis","state",".","*","*","Details",":","*","*","*","Number","of","wires",":","Any","(","the","operation","can","act","on","any","number","of","wires",")","*","Number","of","parameters",":","1","*","Gradient","recipe",":","None","(","integer","parameters","not","supported",")","..","note",":",":","If","the","``","BasisState","``","operation","is","not","supported","natively","on","the","target","device",",","PennyLane","will","attempt","to","decompose","the","operation","into",":","class",":","`","~.PauliX","`","operations",".","..","note",":",":","When","called","in","the","middle","of","a","circuit",",","the","action","of","the","operation","is","defined","as",":","math",":","`","U|0\\rangle","=","|\\psi\\rangle","`","Args",":","n","(","array",")",":","prepares","the","basis","state",":","math",":","`","\\ket","{","n","}","`",",","where","``","n","``","is","an","array","of","integers","from","the","set",":","math",":","`","\\","{","0",",","1\\","}","`",",","i.e.",",","if","``","n","=","np.array","(","[","0",",","1",",","0","]",")","``",",","prepares","the","state",":","math",":","`","|010\\rangle","`",".","wires","(","Sequence","[","int","]","or","int",")",":","the","wire","(","s",")","the","operation","acts","on","id","(","str",")",":","custom","label","given","to","an","operator","instance",",","can","be","useful","for","some","applications","where","the","instance","has","to","be","identified",".","*","*","Example","*","*",">",">",">","dev","=","qml.device","(","'default.qubit","'",",","wires=2",")",">",">",">","@","qml.qnode","(","dev",")","...","def","example_circuit","(",")",":","...","qml.BasisState","(","np.array","(","[","1",",","1","]",")",",","wires=range","(","2",")",")","...","return","qml.state","(",")",">",">",">","print","(","example_circuit","(",")",")","[","0.+0.j","0.+0.j","0.+0.j","1.+0.j","]"]
docstr: Representation of the operator as a product of other operators (static method). :
  
  .. math:: O = O_1 O_2 \dots O_n.
  
  
  .. seealso:: :meth:`~.BasisState.decomposition`.
  
  Args:
      n (array): prepares the basis state :math:`\ket{n}`, where ``n`` is an
          array of integers from the set :math:`\{0, 1\}`
      wires (Iterable, Wires): the wire(s) the operation acts on
  
  Returns:
      list[Operator]: decomposition into lower level operations
  
  **Example:**
  
  >>> qml.BasisState.compute_decomposition([1,0], wires=(0,1))
  [BasisStatePreparation([1, 0], wires=[0, 1])]
docstr_tok: ["Representation","of","the","operator","as","a","product","of","other","operators","(","static","method",")",".",":","..","math",":",":","O","=","O_1","O_2","\\dots","O_n",".","..","seealso",":",":",":","meth",":","`","~.BasisState.decomposition","`",".","Args",":","n","(","array",")",":","prepares","the","basis","state",":","math",":","`","\\ket","{","n","}","`",",","where","``","n","``","is","an","array","of","integers","from","the","set",":","math",":","`","\\","{","0",",","1\\","}","`","wires","(","Iterable",",","Wires",")",":","the","wire","(","s",")","the","operation","acts","on","Returns",":","list","[","Operator","]",":","decomposition","into","lower","level","operations","*","*","Example",":","*","*",">",">",">","qml.BasisState.compute_decomposition","(","[","1,0","]",",","wires=","(","0,1",")",")","[","BasisStatePreparation","(","[","1",",","0","]",",","wires=","[","0",",","1","]",")","]"]
code: def compute_decomposition(n, wires):
      r"""Representation of the operator as a product of other operators (static method). :
  
      .. math:: O = O_1 O_2 \dots O_n.
  
  
      .. seealso:: :meth:`~.BasisState.decomposition`.
  
      Args:
          n (array): prepares the basis state :math:`\ket{n}`, where ``n`` is an
              array of integers from the set :math:`\{0, 1\}`
          wires (Iterable, Wires): the wire(s) the operation acts on
  
      Returns:
          list[Operator]: decomposition into lower level operations
  
      **Example:**
  
      >>> qml.BasisState.compute_decomposition([1,0], wires=(0,1))
      [BasisStatePreparation([1, 0], wires=[0, 1])]
  
      """
      return [BasisStatePreparation(n, wires)]
  
file_path: pennylane/pennylane/ops/qubit/state_preparation.py
imports: import numpy
  from pennylane import math
  from pennylane.operation import AnyWires, Operation, StatePrepBase
  from pennylane.templates.state_preparations import BasisStatePreparation, MottonenStatePreparation
  from pennylane.wires import Wires, WireError
label_desc: Use image node_id 1 for calling the BasisState obj's underlying member method code with example usage: obj.compute_decomposition(n, wires) and returns: list