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

A density matrix simulator that prioritizes readability over performance.

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

This class uses a dense matrix of shape (2^n_qubits, 2^n_qubits) to store the density matrix.

  • 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.