Module: pennylane

class BasisState(n, wires)[source]

Prepares a single computational basis state.


  • Number of wires: All (applied to the entire system)
  • Number of parameters: 1
  • Gradient recipe: None (integer parameters not supported)
  • n (array) – prepares the basis state \(\ket{n}\), where n is an array of integers from the set \(\{0, 1\}\), i.e., if n = np.array([0, 1, 0]), prepares the state \(|010\rangle\).
  • wires (Sequence[int] or int) – the wire(s) the operation acts on