How to use the rpcq.messages.BinaryExecutableResponse function in rpcq

To help you get started, we’ve selected a few rpcq examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rigetti / pyquil / pyquil / api / _quantum_computer.py View on Github external
from pyquil.api._devices import get_lattice, list_lattices
from pyquil.api._error_reporting import _record_call
from pyquil.api._qac import AbstractCompiler
from pyquil.api._qam import QAM
from pyquil.api._qpu import QPU
from pyquil.api._qvm import ForestConnection, QVM
from pyquil.device import AbstractDevice, NxDevice, gates_in_isa, ISA, Device
from pyquil.gates import RX, MEASURE
from pyquil.noise import decoherence_noise_with_asymmetric_ro, NoiseModel
from pyquil.pyqvm import PyQVM
from pyquil.quil import Program, validate_protoquil
from pyquil.quilbase import Measurement, Pragma, Gate, Reset

pyquil_config = PyquilConfig()

Executable = Union[BinaryExecutableResponse, PyQuilExecutableResponse]


def _get_flipped_protoquil_program(program: Program) -> Program:
    """For symmetrization, generate a program where X gates are added before measurement.

    Forest 1.3 is really picky about where the measure instructions happen. It has to be
    at the end!
    """
    program = program.copy()
    to_measure = []
    while len(program) > 0:
        inst = program.instructions[-1]
        if isinstance(inst, Measurement):
            program.pop()
            to_measure.append((inst.qubit, inst.classical_reg))
        else:
github rigetti / pyquil / pyquil / api / _quantum_computer.py View on Github external
from pyquil.api._qpu import QPU
from pyquil.api._qvm import ForestConnection, QVM
from pyquil.device import AbstractDevice, NxDevice, gates_in_isa, ISA, Device
from pyquil.experiment import (
    ExperimentResult,
    TomographyExperiment,
    bitstrings_to_expectations,
    merge_memory_map_lists,
)
from pyquil.gates import RX, MEASURE
from pyquil.noise import decoherence_noise_with_asymmetric_ro, NoiseModel
from pyquil.pyqvm import PyQVM
from pyquil.quil import Program, validate_supported_quil


ExecutableDesignator = Union[BinaryExecutableResponse, PyQuilExecutableResponse]


class QuantumComputer:
    def __init__(
        self,
        *,
        name: str,
        qam: QAM,
        device: AbstractDevice,
        compiler: AbstractCompiler,
        symmetrize_readout: bool = False,
    ) -> None:
        """
        A quantum computer for running quantum programs.

        A quantum computer has various characteristics like supported gates, qubits, qubit