text
stringlengths
81
112k
Generate a Specs object from a NetworkX graph with placeholder values for the actual specs. :param graph: The graph def specs_from_graph(graph: nx.Graph): """ Generate a Specs object from a NetworkX graph with placeholder values for the actual specs. :param graph: The graph """ qspecs = [Qubi...
Construct a NetworkX qubit topology from an ISA object. This discards information about supported gates. :param isa: The ISA. def isa_to_graph(isa: ISA) -> nx.Graph: """ Construct a NetworkX qubit topology from an ISA object. This discards information about supported gates. :param isa: The ...
Create a JSON-serializable representation of the ISA. The dictionary representation is of the form:: { "1Q": { "0": { "type": "Xhalves" }, "1": { "type": "Xhalves", ...
Re-create the ISA from a dictionary representation. :param Dict[str,Any] d: The dictionary representation. :return: The restored ISA. :rtype: ISA def from_dict(d): """ Re-create the ISA from a dictionary representation. :param Dict[str,Any] d: The dictionary representa...
Get a dictionary of two-qubit Bell state fidelities (normalized to unity) from the specs, keyed by targets (qubit-qubit pairs). :return: A dictionary of Bell state fidelities, normalized to unity. :rtype: Dict[tuple(int, int), float] def fBellStates(self): """ Get a dictionary ...
Get a dictionary of CZ fidelities (normalized to unity) from the specs, keyed by targets (qubit-qubit pairs). :return: A dictionary of CZ fidelities, normalized to unity. :rtype: Dict[tuple(int, int), float] def fCZs(self): """ Get a dictionary of CZ fidelities (normalized to u...
Get a dictionary of the standard errors of the CZ fidelities from the specs, keyed by targets (qubit-qubit pairs). :return: A dictionary of CZ fidelities, normalized to unity. :rtype: Dict[tuple(int, int), float] def fCZ_std_errs(self): """ Get a dictionary of the standard erro...
Get a dictionary of CPHASE fidelities (normalized to unity) from the specs, keyed by targets (qubit-qubit pairs). :return: A dictionary of CPHASE fidelities, normalized to unity. :rtype: Dict[tuple(int, int), float] def fCPHASEs(self): """ Get a dictionary of CPHASE fidelities ...
Create a JSON-serializable representation of the device Specs. The dictionary representation is of the form:: { '1Q': { "0": { "f1QRB": 0.99, "T1": 20e-6, ... }, ...
Re-create the Specs from a dictionary representation. :param Dict[str, Any] d: The dictionary representation. :return: The restored Specs. :rtype: Specs def from_dict(d): """ Re-create the Specs from a dictionary representation. :param Dict[str, Any] d: The dictionary ...
Construct an ISA suitable for targeting by compilation. This will raise an exception if the requested ISA is not supported by the device. :param oneq_type: The family of one-qubit gates to target :param twoq_type: The family of two-qubit gates to target def get_isa(self, oneq_type='Xhalves', ...
Initialize a QAM into a fresh state. :param executable: Load a compiled executable onto the QAM. def load(self, executable): """ Initialize a QAM into a fresh state. :param executable: Load a compiled executable onto the QAM. """ if self.status == 'loaded': ...
Writes a value into a memory region on the QAM at a specified offset. :param region_name: Name of the declared memory region on the QAM. :param offset: Integer offset into the memory region to write to. :param value: Value to store at the indicated location. def write_memory(self, *, region_na...
Reads from a memory region named region_name on the QAM. This is a shim over the eventual API and only can return memory from a region named "ro" of type ``BIT``. :param region_name: The string naming the declared memory region. :return: A list of values of the appropriate type. def r...
Reads from a memory region named region_name on the QAM. This is a shim over the eventual API and only can return memory from a region named "ro" of type ``BIT``. :param region_name: The string naming the declared memory region. :return: A list of values of the appropriate type. def r...
Reset the Quantum Abstract Machine to its initial state, which is particularly useful when it has gotten into an unwanted state. This can happen, for example, if the QAM is interrupted in the middle of a run. def reset(self): """ Reset the Quantum Abstract Machine to its initial state, ...
Returns the program to simulate the Meyer-Penny Game The full description is available in docs/source/examples.rst :return: pyQuil Program def meyer_penny_program(): """ Returns the program to simulate the Meyer-Penny Game The full description is available in docs/source/examples.rst :return:...
Change the coefficient of a PauliTerm. :param PauliTerm term: A PauliTerm object :param Number coeff: The coefficient to set on the PauliTerm :returns: A new PauliTerm that duplicates term but sets coeff :rtype: PauliTerm def term_with_coeff(term, coeff): """ Change the coefficient of a PauliT...
Simplify the sum of Pauli operators according to Pauli algebra rules. def simplify_pauli_sum(pauli_sum): """Simplify the sum of Pauli operators according to Pauli algebra rules.""" # You might want to use a defaultdict(list) here, but don't because # we want to do our best to preserve the order of terms. ...
Check if commuting a PauliTerm commutes with a list of other terms by natural calculation. Uses the result in Section 3 of arXiv:1405.5749v2, modified slightly here to check for the number of anti-coincidences (which must always be even for commuting PauliTerms) instead of the no. of coincidences, as in the...
Gather the Pauli terms of pauli_terms variable into commuting sets Uses algorithm defined in (Raeisi, Wiebe, Sanders, arXiv:1108.4318, 2011) to find commuting sets. Except uses commutation check from arXiv:1405.5749v2 :param PauliSum pauli_terms: A PauliSum object :returns: List of lists where each li...
Tests to see if a PauliTerm or PauliSum is a scalar multiple of identity :param term: Either a PauliTerm or PauliSum :returns: True if the PauliTerm or PauliSum is a scalar multiple of identity, False otherwise :rtype: bool def is_identity(term): """ Tests to see if a PauliTerm or PauliSum is a sc...
Returns a function f(alpha) that constructs the Program corresponding to exp(-1j*alpha*term). :param term: A pauli term to exponentiate :returns: A function that takes an angle parameter and returns a program. :rtype: Function def exponential_map(term): """ Returns a function f(alpha) that constru...
Returns a function that maps all substituent PauliTerms and sums them into a program. NOTE: Use this function with care. Substituent PauliTerms should commute. :param PauliSum pauli_sum: PauliSum to exponentiate. :returns: A function that parametrizes the exponential. :rtype: function def exponentiate...
Returns a Quil (Program()) object corresponding to the exponential of the pauli_term object, i.e. exp[-1.0j * param * pauli_term] :param PauliTerm pauli_term: A PauliTerm to exponentiate :param float param: scalar, non-complex, value :returns: A Quil program object :rtype: Program def _exponentiat...
Generate trotterization coefficients for a given number of Trotter steps. U = exp(A + B) is approximated as exp(w1*o1)exp(w2*o2)... This method returns a list [(w1, o1), (w2, o2), ... , (wm, om)] of tuples where o=0 corresponds to the A operator, o=1 corresponds to the B operator, and w is the coeffici...
Tests to see if a PauliTerm or PauliSum is zero. :param pauli_object: Either a PauliTerm or PauliSum :returns: True if PauliTerm is zero, False otherwise :rtype: bool def is_zero(pauli_object): """ Tests to see if a PauliTerm or PauliSum is zero. :param pauli_object: Either a PauliTerm or Pau...
Create a Quil program that approximates exp( (A + B)t) where A and B are PauliTerm operators. :param PauliTerm first_pauli_term: PauliTerm denoted `A` :param PauliTerm second_pauli_term: PauliTerm denoted `B` :param int trotter_order: Optional argument indicating the Suzuki-Trotter ...
Returns an identifier string for the PauliTerm (ignoring the coefficient). Don't use this to compare terms. This function will not work with qubits that aren't sortable. :param sort_ops: Whether to sort operations by qubit. This is True by default for backwards compatibility but wi...
Properly creates a new PauliTerm, with a completely new dictionary of operators def copy(self): """ Properly creates a new PauliTerm, with a completely new dictionary of operators """ new_term = PauliTerm("I", 0, 1.0) # create new object # manually copy all attr...
Allocates a Pauli Term from a list of operators and indices. This is more efficient than multiplying together individual terms. :param list terms_list: A list of tuples, e.g. [("X", 0), ("Y", 1)] :return: PauliTerm def from_list(cls, terms_list, coefficient=1.0): """ Allocates ...
Construct a PauliTerm from the result of str(pauli_term) def from_compact_str(cls, str_pauli_term): """Construct a PauliTerm from the result of str(pauli_term) """ coef_str, str_pauli_term = str_pauli_term.split('*') try: coef = int(coef_str) except ValueError: ...
Return a string representation of this PauliTerm without its coefficient and with implicit qubit indices. If a list of qubits is provided, each character in the resulting string represents a Pauli operator on the corresponding qubit. If qubit indices are not provided as input, the retur...
The support of all the operators in the PauliSum object. :returns: A list of all the qubits in the sum of terms. :rtype: list def get_qubits(self): """ The support of all the operators in the PauliSum object. :returns: A list of all the qubits in the sum of terms. :rty...
Get a Pyquil Program corresponding to each term in the PauliSum and a coefficient for each program :return: (programs, coefficients) def get_programs(self): """ Get a Pyquil Program corresponding to each term in the PauliSum and a coefficient for each program :return: ...
Get JSON from a Forest endpoint. def get_json(session, url, params: dict = None): """ Get JSON from a Forest endpoint. """ res = session.get(url, params=params) if res.status_code >= 400: raise parse_error(res) return res.json()
Post JSON to the Forest endpoint. def post_json(session, url, json): """ Post JSON to the Forest endpoint. """ res = session.post(url, json=json) if res.status_code >= 400: raise parse_error(res) return res
Every server error should contain a "status" field with a human readable explanation of what went wrong as well as a "error_type" field indicating the kind of error that can be mapped to a Python type. There's a fallback error UnknownError for other types of exceptions (network issues, api gateway prob...
Create a requests session to access the REST API :return: requests session :rtype: Session def get_session(): """ Create a requests session to access the REST API :return: requests session :rtype: Session """ config = PyquilConfig() session = requests.Session() retry_adapter =...
Is noise_parameter a valid specification of noise probabilities for depolarizing noise? :param list noise_parameter: List of noise parameter values to be validated. def validate_noise_probabilities(noise_parameter): """ Is noise_parameter a valid specification of noise probabilities for depolarizing noise...
Check the validity of qubits for the payload. :param list|range qubit_list: List of qubits to be validated. def validate_qubit_list(qubit_list): """ Check the validity of qubits for the payload. :param list|range qubit_list: List of qubits to be validated. """ if not isinstance(qubit_list, (l...
Canonicalize classical addresses for the payload and ready MemoryReference instances for serialization. This function will cast keys that are iterables of int-likes to a list of Python ints. This is to support specifying the register offsets as ``range()`` or numpy arrays. This mutates ``register_dict`...
REST payload for :py:func:`ForestConnection._run_and_measure` def run_and_measure_payload(quil_program, qubits, trials, random_seed): """REST payload for :py:func:`ForestConnection._run_and_measure`""" if not quil_program: raise ValueError("You have attempted to run an empty program." ...
REST payload for :py:func:`ForestConnection._wavefunction` def wavefunction_payload(quil_program, random_seed): """REST payload for :py:func:`ForestConnection._wavefunction`""" if not isinstance(quil_program, Program): raise TypeError("quil_program must be a Quil program object") payload = {'type'...
REST payload for :py:func:`ForestConnection._expectation` def expectation_payload(prep_prog, operator_programs, random_seed): """REST payload for :py:func:`ForestConnection._expectation`""" if operator_programs is None: operator_programs = [Program()] if not isinstance(prep_prog, Program): ...
REST payload for :py:func:`ForestConnection._qvm_run` def qvm_run_payload(quil_program, classical_addresses, trials, measurement_noise, gate_noise, random_seed): """REST payload for :py:func:`ForestConnection._qvm_run`""" if not quil_program: raise ValueError("You have attempted to ...
REST payload for :py:func:`ForestConnection._quilc_compile` def quilc_compile_payload(quil_program, isa, specs): """REST payload for :py:func:`ForestConnection._quilc_compile`""" if not quil_program: raise ValueError("You have attempted to compile an empty program." " Please pr...
Run a Forest ``run_and_measure`` job. Users should use :py:func:`WavefunctionSimulator.run_and_measure` instead of calling this directly. def _run_and_measure(self, quil_program, qubits, trials, random_seed) -> np.ndarray: """ Run a Forest ``run_and_measure`` job. Users should...
Run a Forest ``wavefunction`` job. Users should use :py:func:`WavefunctionSimulator.wavefunction` instead of calling this directly. def _wavefunction(self, quil_program, random_seed) -> Wavefunction: """ Run a Forest ``wavefunction`` job. Users should use :py:func:`Wavefunctio...
Run a Forest ``expectation`` job. Users should use :py:func:`WavefunctionSimulator.expectation` instead of calling this directly. def _expectation(self, prep_prog, operator_programs, random_seed) -> np.ndarray: """ Run a Forest ``expectation`` job. Users should use :py:func:`W...
Run a Forest ``run`` job on a QVM. Users should use :py:func:`QVM.run` instead of calling this directly. def _qvm_run(self, quil_program, classical_addresses, trials, measurement_noise, gate_noise, random_seed) -> np.ndarray: """ Run a Forest ``run`` job on a QVM. Use...
Return version information for the QVM. :return: String of QVM version def _qvm_get_version_info(self) -> dict: """ Return version information for the QVM. :return: String of QVM version """ response = post_json(self.session, self.sync_endpoint, {'type': 'version'}) ...
Sends a quilc job to Forest. Users should use :py:func:`LocalCompiler.quil_to_native_quil` instead of calling this directly. def _quilc_compile(self, quil_program, isa, specs): """ Sends a quilc job to Forest. Users should use :py:func:`LocalCompiler.quil_to_native_quil` inste...
For symmetrization, generate a program where X gates are added before measurement. Forest is picky about where the measure instructions happen. It has to be at the end! def _get_flipped_protoquil_program(program: Program) -> Program: """For symmetrization, generate a program where X gates are added before mea...
List the names of available quantum computers :param connection: An optional :py:class:ForestConnection` object. If not specified, the default values for URL endpoints will be used, and your API key will be read from ~/.pyquil_config. If you deign to change any of these parameters, pass you...
Try to figure out whether we're getting a (noisy) qvm, and the associated qpu name. See :py:func:`get_qc` for examples of valid names + flags. def _parse_name(name: str, as_qvm: bool, noisy: bool) -> Tuple[str, str, bool]: """ Try to figure out whether we're getting a (noisy) qvm, and the associated qpu n...
Take the output of _parse_name to create a canonical name. def _canonicalize_name(prefix, qvm_type, noisy): """Take the output of _parse_name to create a canonical name. """ if noisy: noise_suffix = '-noisy' else: noise_suffix = '' if qvm_type is None: qvm_suffix = '' e...
Construct a QuantumComputer backed by a QVM. This is a minimal wrapper over the QuantumComputer, QVM, and QVMCompiler constructors. :param name: A string identifying this particular quantum computer. :param qvm_type: The type of QVM. Either qvm or pyqvm. :param device: A device following the AbstractD...
Construct a QVM with the provided topology. :param name: A name for your quantum computer. This field does not affect behavior of the constructed QuantumComputer. :param topology: A graph representing the desired qubit connectivity. :param noisy: Whether to include a generic noise model. If you wan...
A nine-qubit 3x3 square lattice. This uses a "generic" lattice not tied to any specific device. 9 qubits is large enough to do vaguely interesting algorithms and small enough to simulate quickly. :param name: The name of this QVM :param connection: The connection to use to talk to external services ...
A qvm with a fully-connected topology. This is obviously the least realistic QVM, but who am I to tell users what they want. :param name: The name of this QVM :param noisy: Whether to construct a noisy quantum computer :param n_qubits: 34 qubits ought to be enough for anybody. :param connection: T...
A qvm with a based on a real device. This is the most realistic QVM. :param name: The full name of this QVM :param device: The device from :py:func:`get_lattice`. :param noisy: Whether to construct a noisy quantum computer by using the device's associated noise model. :param connection: An...
Get a quantum computer. A quantum computer is an object of type :py:class:`QuantumComputer` and can be backed either by a QVM simulator ("Quantum/Quil Virtual Machine") or a physical Rigetti QPU ("Quantum Processing Unit") made of superconducting qubits. You can choose the quantum computer to target t...
A context manager for the Rigetti local QVM and QUIL compiler. You must first have installed the `qvm` and `quilc` executables from the forest SDK. [https://www.rigetti.com/forest] This context manager will start up external processes for both the compiler and virtual machine, and then terminate them ...
Return a target ISA for this QuantumComputer's device. See :py:func:`AbstractDevice.get_isa` for more. :param oneq_type: The family of one-qubit gates to target :param twoq_type: The family of two-qubit gates to target def get_isa(self, oneq_type: str = 'Xhalves', twoq_type: s...
Run a quil executable. If the executable contains declared parameters, then a memory map must be provided, which defines the runtime values of these parameters. :param executable: The program to run. You are responsible for compiling this first. :param memory_map: The mapping of declared parame...
Run a quil program in such a way that the readout error is made collectively symmetric This means the probability of a bitstring ``b`` being mistaken for a bitstring ``c`` is the same as the probability of ``not(b)`` being mistaken for ``not(c)`` A more general symmetrization would guarantee t...
Run the provided state preparation program and measure all qubits. This will measure all the qubits on this QuantumComputer, not just qubits that are used in the program. The returned data is a dictionary keyed by qubit index because qubits for a given QuantumComputer may be non-contig...
A high-level interface to program compilation. Compilation currently consists of two stages. Please see the :py:class:`AbstractCompiler` docs for more information. This function does all stages of compilation. Right now both ``to_native_gates`` and ``optimize`` must be either both set or both ...
Translate a DataBuffer into a numpy array. :param buffer: Dictionary with 'data' byte array, 'dtype', and 'shape' fields :return: NumPy array of decoded data def decode_buffer(buffer: dict) -> np.ndarray: """ Translate a DataBuffer into a numpy array. :param buffer: Dictionary with 'data' byte ar...
De-mux qubit readout results and assemble them into the ro-bitstrings in the correct order. :param ro_sources: Specification of the ro_sources, cf :py:func:`pyquil.api._compiler._collect_classical_memory_write_locations`. It is a list whose value ``(q, m)`` at index ``addr`` records that the ``m``-...
Initialize a QAM into a fresh state. Load the executable and parse the expressions in the recalculation table (if any) into pyQuil Expression objects. :param executable: Load a compiled executable onto the QAM. def load(self, executable): """ Initialize a QAM into a fresh state. Load t...
Run a pyquil program on the QPU. This formats the classified data from the QPU server by stacking measured bits into an array of shape (trials, classical_addresses). The mapping of qubit to classical address is backed out from MEASURE instructions in the program, so only do measurements...
Return the decoded result buffers for particular job_id. :param job_id: Unique identifier for the job in question :return: Decoded buffers or throw an error def _get_buffers(self, job_id: str) -> Dict[str, np.ndarray]: """ Return the decoded result buffers for particular job_id. ...
Update self._variables_shim with the final values to be patched into the gate parameters, according to the arithmetic expressions in the original program. For example: DECLARE theta REAL DECLARE beta REAL RZ(3 * theta) 0 RZ(beta+theta) 0 gets tr...
Traverse the given Expression, and replace any Memory References with whatever values have been so far provided by the user for those memory spaces. Declared memory defaults to zero. :param expression: an Expression def _resolve_memory_references(self, expression: Expression) -> Union[float, i...
Return the index of the first bit that changed between `a` an `b`. Return None if there are no changed bits. def changed_bit_pos(a, b): """ Return the index of the first bit that changed between `a` an `b`. Return None if there are no changed bits. """ c = a ^ b n = 0 while c > 0: ...
Generate the Gray code for `num_bits` bits. def gray(num_bits): """ Generate the Gray code for `num_bits` bits. """ last = 0 x = 0 n = 1 << num_bits while n > x: bit_string = bin(n + x ^ x // 2)[3:] value = int(bit_string, 2) yield bit_string, value, changed_bit_pos(...
Given a one-qubit gate matrix U, construct a controlled-U on all pointer qubits. def controlled(num_ptr_bits, U): """ Given a one-qubit gate matrix U, construct a controlled-U on all pointer qubits. """ d = 2 ** (1 + num_ptr_bits) m = np.eye(d) m[d - 2:, d - 2:] = U return m
Flip back the pointer qubits that were previously flipped indicated by the flags `bits_set`. def fixup(p, data_bits, ptr_bits, bits_set): """ Flip back the pointer qubits that were previously flipped indicated by the flags `bits_set`. """ for i in range(ptr_bits): if 0 != bits_set & (1 ...
Make a pointer gate on `num_qubits`. The one-qubit gate U will act on the qubit addressed by the pointer qubits interpreted as an unsigned binary integer. There are P = floor(lg(num_qubits)) pointer qubits, and qubits numbered N - 1 N - 2 ... N - P are those reserved t...
Return the amplitude damping Kraus operators def relaxation_operators(p): """ Return the amplitude damping Kraus operators """ k0 = np.array([[1.0, 0.0], [0.0, np.sqrt(1 - p)]]) k1 = np.array([[0.0, np.sqrt(p)], [0.0, 0.0]]) return k0, k1
Return the phase damping Kraus operators def dephasing_operators(p): """ Return the phase damping Kraus operators """ k0 = np.eye(2) * np.sqrt(1 - p / 2) k1 = np.sqrt(p / 2) * Z return k0, k1
Return the phase damping Kraus operators def depolarizing_operators(p): """ Return the phase damping Kraus operators """ k0 = np.sqrt(1.0 - p) * I k1 = np.sqrt(p / 3.0) * X k2 = np.sqrt(p / 3.0) * Y k3 = np.sqrt(p / 3.0) * Z return k0, k1, k2, k3
Return the phase flip kraus operators def phase_flip_operators(p): """ Return the phase flip kraus operators """ k0 = np.sqrt(1 - p) * I k1 = np.sqrt(p) * Z return k0, k1
Return the phase flip kraus operators def bit_flip_operators(p): """ Return the phase flip kraus operators """ k0 = np.sqrt(1 - p) * I k1 = np.sqrt(p) * X return k0, k1
Return the bitphase flip kraus operators def bitphase_flip_operators(p): """ Return the bitphase flip kraus operators """ k0 = np.sqrt(1 - p) * I k1 = np.sqrt(p) * Y return k0, k1
Run a Quil program multiple times, accumulating the values deposited in a list of classical addresses. :param Program quil_program: A Quil program. :param classical_addresses: The classical memory to retrieve. Specified as a list of integers that index into a readout register named ...
Run a Quil program once to determine the final wavefunction, and measure multiple times. :note: If the execution of ``quil_program`` is **non-deterministic**, i.e., if it includes measurements and/or noisy quantum gates, then the final wavefunction from which the returned bitstrings are...
Simulate a Quil program and get the wavefunction back. :note: If the execution of ``quil_program`` is **non-deterministic**, i.e., if it includes measurements and/or noisy quantum gates, then the final wavefunction from which the returned bitstrings are sampled itself only represents a ...
Calculate the expectation value of operators given a state prepared by prep_program. :note: If the execution of ``quil_program`` is **non-deterministic**, i.e., if it includes measurements and/or noisy quantum gates, then the final wavefunction from which the expectation values ...
Calculate the expectation value of Pauli operators given a state prepared by prep_program. If ``pauli_terms`` is a ``PauliSum`` then the returned value is a single ``float``, otherwise the returned value is a list of ``float``s, one for each ``PauliTerm`` in the list. :note: If the exe...
Set the gate noise and measurement noise of a payload. def _maybe_add_noise_to_payload(self, payload): """ Set the gate noise and measurement noise of a payload. """ if self.measurement_noise is not None: payload["measurement-noise"] = self.measurement_noise if self....
Initialize a QAM and load a program to be executed with a call to :py:func:`run`. If ``QVM.requires_executable`` is set to ``True``, this function will only load :py:class:`PyQuilExecutableResponse` executables. This more closely follows the behavior of :py:class:`QPU`. However, the quantum sim...
Run a Quil program on the QVM multiple times and return the values stored in the classical registers designated by the classical_addresses parameter. :return: An array of bitstrings of shape ``(trials, len(classical_addresses))`` def run(self): """ Run a Quil program on the QVM multipl...
The result of the job if available throws ValueError is result is not available yet throws ApiError if server returned an error indicating program execution was not successful or if the job was cancelled def result(self): """ The result of the job if available throws Val...
For how long was the job running? :return: Running time, seconds :rtype: Optional[float] def running_time(self): """ For how long was the job running? :return: Running time, seconds :rtype: Optional[float] """ if not self.is_done(): raise Valu...
If the server returned a metadata dictionary, retrieve a particular key from it. If no metadata exists, or the key does not exist, return None. :param key: Metadata key, e.g., "gate_depth" :return: The associated metadata. :rtype: Optional[Any] def _get_metadata(self, key): """...
If the Quil program associated with the Job was compiled (e.g., to translate it to the QPU's natural gateset) return this compiled program. :rtype: Optional[Program] def compiled_quil(self): """ If the Quil program associated with the Job was compiled (e.g., to translate it to the ...
Left-multiplies the given axes of the wf tensor by the given gate matrix. Note that the matrix must have a compatible tensor structure. For example, if you have an 6-qubit state vector ``wf`` with shape (2, 2, 2, 2, 2, 2), and a 2-qubit unitary operation ``op`` with shape (2, 2, 2, 2), and you want to ...