qcs_sdk.qvm

The QVM module contains the API for interacting with the Quantum Virtual Machine (QVM).

🔨 This page is under construction and the documentation for some submodules is missing. In the meantime, you can find documentation in the the type hints.

class QVMResultData:

Encapsulates data returned from the QVM after executing a program.

def from_memory_map(memory: Mapping[str, RegisterData]) -> qcs_sdk.qvm.QVMResultData:

Build a QVMResultData from a mapping of register names to a RegisterData matrix.

def to_raw_readout_data(self) -> qcs_sdk.qvm.RawQVMReadoutData:

Get a copy of this result data flattened into a RawQVMReadoutData

memory: Mapping[str, RegisterData]

Get the mapping of register names (ie. "ro") to a RegisterData matrix containing the register values.

class QVMOptions:

Options avaialable for running programs on the QVM.

def default() -> qcs_sdk.qvm.QVMOptions:

Get the default set of QVMOptions used for QVM requests.

Settings: timeout: 30.0 seconds

timeout

The timeout used for reqeusts to the QVM. If set to none, there is no timeout.

class RawQVMReadoutData:
memory: Dict[str, Union[List[List[int]], List[List[float]]]]

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

class QVMClient:

Client used to communicate with QVM

def new_http(endpoint: str) -> qcs_sdk.qvm.QVMClient:

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

def new_libquil() -> qcs_sdk.qvm.QVMClient:

Construct a new QVM client which uses libquil

qvm_url: str

Return the address of the client

class QVMError(builtins.RuntimeError):

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

Inherited Members
builtins.RuntimeError
RuntimeError
builtins.BaseException
with_traceback
add_note
args
def run( quil: str, shots: int, addresses: Mapping[str, AddressRequest], params: Mapping[str, Union[Sequence[float], Sequence[int]]], client: qcs_sdk.qvm.QVMClient, measurement_noise: Optional[Tuple[float, float, float]] = None, gate_noise: Optional[Tuple[float, float, float]] = None, rng_seed: Optional[int] = None, options: Optional[qcs_sdk.qvm.QVMOptions] = None) -> qcs_sdk.qvm.QVMResultData:

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.
async def run_async( quil: str, shots: int, addresses: Mapping[str, AddressRequest], params: Mapping[str, Sequence[float]], client: qcs_sdk.qvm.QVMClient, measurement_noise: Optional[Tuple[float, float, float]] = None, gate_noise: Optional[Tuple[float, float, float]] = None, rng_seed: Optional[int] = None, options: Optional[qcs_sdk.qvm.QVMOptions] = None) -> qcs_sdk.qvm.QVMResultData:

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