Skip to content

loqs.backends.state

Quantum state backends.

For LoQS, a quantum state represents the state of a group of physical qubits.

The state backend interface is enforced by the abstract BaseQuantumState class, which generally has the capabilities:

  • Property getters for:
    • The underlying state object
    • Allowed input gate/instrument representations
  • Copy (i.e. deepcopy)
  • Representation application that takes the list of gate/instrument representation and propagates the state forward in time (in-place and copy)

The packages currently available as quantum states:

  • Native NumPy-based statevector
  • quantumsim.sparsedm density matrix via QSimQuantumState (requires loqs[quantumsim])
  • stim.TableauSimulator stabilizers via STIMQuantumState (requires loqs[stim])

Warning

For backends that depend on optional third-party packages, it is recommended to not import from the module/class file directly. Instead, try to import from backends, which dynamically checks if that backend is available.