# QVM¶

class pyquil.api.QVM(connection, noise_model=None, gate_noise=None, measurement_noise=None, random_seed=None, requires_executable=False)[source]

A virtual machine that classically emulates the execution of Quil programs.

Parameters
• connection (ForestConnection) – A connection to the Forest web API.

• noise_model (Optional[NoiseModel]) – A noise model that describes noise to apply when emulating a program’s execution.

• gate_noise (Optional[List[float]]) – A list of three numbers [Px, Py, Pz] indicating the probability of an X, Y, or Z gate getting applied to each qubit after a gate application or reset. The default value of None indicates no noise.

• measurement_noise (Optional[List[float]]) – A list of three numbers [Px, Py, Pz] indicating the probability of an X, Y, or Z gate getting applied before a measurement. The default value of None indicates no noise.

• random_seed (Optional[int]) – A seed for the QVM’s random number generators. Either None (for an automatically generated seed) or a non-negative integer.

• requires_executable (bool) – Whether this QVM will refuse to run a Program and only accept the result of compiler.native_quil_to_executable(). Setting this to True better emulates the behavior of a QPU.