qcs_sdk.qvm

class QVMClient:

Client used to communicate with QVM.

def new_libquil():
def new_http(endpoint):

Construct a new QVM client which uses HTTP to communicate with a QVM service.

qvm_url

Return the address of the client.

class QVMOptions:

Options avaialable for running programs on the QVM.

def default():

Get the default set of QVMOptions used for QVM requests.

Settings: timeout: 30.0 seconds

timeout

The timeout used for requests to the QVM. If set to None, there is no timeout.

class QVMResultData:

Encapsulates data returned after running a program on the QVM

def from_memory_map(memory):

Build a [QvmResultData] from a mapping of register names to a [RegisterData]

def to_raw_readout_data(self, /):

Get a copy of this result data flattened into a RawQVMReadoutData.

def to_register_map(self, /):

Convert into a [RegisterMap].

The [RegisterMatrix] for each register will be constructed such that each row contains all the final values in the register for a single shot.

Errors

Returns a [RegisterMatrixConversionError] if the inner execution data for any of the registers would result in a jagged matrix. This is often the case in programs that use mid-circuit measurement or dynamic control flow, where measurements to the same memory reference might occur multiple times in a shot, or be skipped conditionally. In these cases, building a rectangular [RegisterMatrix] would necessitate making assumptions about the data that could skew the data in undesirable ways. Instead, it's recommended to manually build a matrix from [QpuResultData] that accurately selects the last value per-shot based on the program that was run.

memory

A map of register names (ie. "ro") to a RegisterData containing their values.

class RawQVMReadoutData:

Encapsulates raw data returned from the QVM after executing a program.

memory

The mapping of register names (ie. "ro") to a 2-d list containing the values for that register.

class QVMError(qcs_sdk.QcsSdkError):

Errors that can occur when running a Quil program on QVM.

def run( quil, shots, addresses, params, client, measurement_noise=None, gate_noise=None, rng_seed=None, options=None):

Runs the given program on the QVM.

Parameters
  • quil: A quil program as a string.
  • shots: The number of times to run the program. Should be a value greater than zero.
  • addresses: A mapping of memory region names to an AddressRequest describing what data to get back for that memory region from the QVM at the end of execution.
  • params: A mapping of memory region names to their desired values.
  • client: An optional QCSClient to use. If unset, creates one using the environemnt configuration (see https: //docs.rigetti.com/qcs/references/qcs-client-configuration).
  • options: An optional QVMOptions to use. If unset, uses QVMOptions.default() for the request.

:returns: A QVMResultData containing the final state of of memory for the requested readouts after the program finished running.

Raises
  • QVMError: If one of the parameters is invalid, or if there was a problem communicating with the QVM server.
def run_async( quil, shots, addresses, params, client, measurement_noise=None, gate_noise=None, rng_seed=None, options=None):

Runs the given program on the QVM.

Parameters
  • quil: A quil program as a string.
  • shots: The number of times to run the program. Should be a value greater than zero.
  • addresses: A mapping of memory region names to an AddressRequest describing what data to get back for that memory region from the QVM at the end of execution.
  • params: A mapping of memory region names to their desired values.
  • client: An optional QCSClient to use. If unset, creates one using the environemnt configuration (see https: //docs.rigetti.com/qcs/references/qcs-client-configuration).
  • options: An optional QVMOptions to use. If unset, uses QVMOptions.default() for the request.

:returns: A QVMResultData containing the final state of of memory for the requested readouts after the program finished running.

Raises
  • QVMError: If one of the parameters is invalid, or if there was a problem communicating with the QVM server.