class_docstr: Observable corresponding to the state projector :math:`P=\ket{\phi}\bra{\phi}`, where
  :math:`\phi` denotes a basis state.
class_docstr_tok: ["Observable","corresponding","to","the","state","projector",":","math",":","`","P=\\ket","{","\\phi","}","\\bra","{","\\phi","}","`",",","where",":","math",":","`","\\phi","`","denotes","a","basis","state","."]
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:`~.BasisStateProjector.matrix`
  
  Args:
      basis_state (Iterable): basis state to project on
  
  Returns:
      ndarray: matrix
  
  **Example**
  
  >>> BasisStateProjector.compute_matrix([0, 1])
  [[0. 0. 0. 0.]
   [0. 1. 0. 0.]
   [0. 0. 0. 0.]
   [0. 0. 0. 0.]]
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",":","`","~.BasisStateProjector.matrix","`","Args",":","basis_state","(","Iterable",")",":","basis","state","to","project","on","Returns",":","ndarray",":","matrix","*","*","Example","*","*",">",">",">","BasisStateProjector.compute_matrix","(","[","0",",","1","]",")","[","[","0",".","0",".","0",".","0",".","]","[","0",".","1",".","0",".","0",".","]","[","0",".","0",".","0",".","0",".","]","[","0",".","0",".","0",".","0",".","]","]"]
code: def compute_matrix(basis_state):  # 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:`~.BasisStateProjector.matrix`
  
      Args:
          basis_state (Iterable): basis state to project on
  
      Returns:
          ndarray: matrix
  
      **Example**
  
      >>> BasisStateProjector.compute_matrix([0, 1])
      [[0. 0. 0. 0.]
       [0. 1. 0. 0.]
       [0. 0. 0. 0.]
       [0. 0. 0. 0.]]
      """
      m = np.zeros((2 ** len(basis_state), 2 ** len(basis_state)))
      idx = int("".join(str(i) for i in basis_state), 2)
      m[idx, idx] = 1
      return m
  
imports: from copy import copy
  from collections.abc import Sequence
  import numpy
  from scipy.sparse import csr_matrix
  import pennylane
  from pennylane.operation import AnyWires, Observable, Operation
  from pennylane.wires import Wires
  from .matrix_ops import QubitUnitary
label_desc: Use image node_id 4 for calling the BasisStateProjector obj's underlying member method code with example usage: obj.compute_matrix(basis_state) and returns: m