class pyquil.reference_simulator.ReferenceWavefunctionSimulator(n_qubits, rs=None)[source]

A wavefunction simulator that prioritizes readability over performance.

Please consider using PyQVM(..., wf_simulator_type=ReferenceWavefunctionSimulator) rather than using this class directly.

This class uses a flat state-vector of length 2^n_qubits to store wavefunction amplitudes. The basis is taken to be bitstrings ordered lexicographically with qubit 0 as the rightmost bit. This is the same as the Rigetti Lisp QVM.

  • n_qubits (int) – Number of qubits to simulate.
  • rs (Optional[RandomState]) – a RandomState (should be shared with the owning PyQVM) for doing anything stochastic. A value of None disallows doing anything stochastic.