# NumpyWavefunctionSimulator¶

class pyquil.numpy_simulator.NumpyWavefunctionSimulator(n_qubits, rs=None)[source]

A wavefunction simulator that uses numpy’s tensordot or einsum to update a state vector

Please consider using PyQVM(..., quantum_simulator_type=NumpyWavefunctionSimulator) rather than using this class directly.

This class uses a n_qubit-dim ndarray to store wavefunction amplitudes. The array is indexed into with a tuple of n_qubits 1’s and 0’s, with qubit 0 as the leftmost bit. This is the opposite convention of the Rigetti Lisp QVM.

Parameters: n_qubits – 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.