pub struct QuantumProgramWrapper {
    pub internal: QuantumProgram,
}
Expand description

Represents a quantum program evaluating measurements based on a one or more free float parameters.

The main use of QuantumProgram is to contain a Measurements implementing [crate::measurements::Measure] that measures expectation values or output registers of [crate::Circuit] quantum circuits that contain symbolic parameters. Circuit with symbolic parameters can not be simulated or executed on real hardware. The symbolic parameters need to be replaced with real floating point numbers first. A QuantumProgram contains a list of the free parameters (input_parameter_names) and can automatically replace the parameters with its run methods and return the result.

The QuantumProgram should correspond as closely as possible to a normal mulit-parameter function in classical computing that can be called with a set of parameters and returns a result. It is the intended way to interface between normal program code and roqoqo based quantum programs.

Fields

internal: QuantumProgram

Internal storage of roqoqo::QuantumProgram

Implementations

Create a QuantumProgram.

Args: measurement: input_parameter_names (Liststr):

Returns: self: The new .

Returns the measurement attribute of the QuantumProgram as Python object.

Returns: PyObject corresponding to the qoqo measurement type of the QuantumProgram, i.e. PauliZProduct, CheatedPauliZProduct, Cheated or ClassicalRegister.

Returns the input_parameter_names attribute of the qoqo QuantumProgram.

Returns: List of input parameter names.

Runs the QuantumProgram and returns expectation values.

Runs the quantum programm for a given set of parameters passed in the same order as the parameters listed in input_parameter_names and returns expectation values.

Args: backend (Backend): The backend the program is executed on. parameters (Optional[List[float]): List of float parameters of the function call in order of input_parameter_names

Runs the QuantumProgram and returns the classical registers of the quantum program.

Runs the quantum programm for a given set of parameters passed in the same order as the parameters listed in input_parameter_names and returns the classical register output.
The classical registers usually contain a record of measurement values for the repeated execution of a [crate::Circuit] quantum circuit for real quantum hardware or the readout of the statevector or the density matrix for simulators.

Args: backend (Backend): The backend the program is executed on. parameters (Optional[List[float]): List of float parameters of the function call in order of input_parameter_names

Return a copy of the QuantumProgram (copy here produces a deepcopy).

Returns: QuantumProgram: A deep copy of self.

Return a deep copy of the QuantumProgram.

Returns: QuantumProgram: A deep copy of self.

Return the bincode representation of the QuantumProgram using the bincode crate.

Returns: ByteArray: The serialized QuantumProgram (in bincode form).

Raises: ValueError: Cannot serialize QuantumProgram to bytes.

Convert the bincode representation of the QuantumProgram to a QuantumProgram using the bincode crate.

Args: input (ByteArray): The serialized QuantumProgram (in bincode form).

Returns: QuantumProgram: The deserialized QuantumProgram.

Raises: TypeError: Input cannot be converted to byte array. ValueError: Input cannot be deserialized to QuantumProgram.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Specify this class has #[pyclass(dict)] or not.

Specify this class has #[pyclass(weakref)] or not.

The closest native ancestor. This is PyAny by default, and when you declare #[pyclass(extends=PyDict)], it’s PyDict. Read more

Class doc string

#[pyclass(subclass)]

#[pyclass(extends=…)]

#[pyclass(mapping)]

Layout

Base class

This handles following two situations: Read more

Utility type to make Py::as_ref work.

Class name.

Module name, if any.

PyTypeObject instance for this type.

Checks if object is an instance of this type or a subclass of this type.

Checks if object is an instance of this type.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Extracts Self from the source PyObject.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Arguments for exception

Returns the safe abstraction over the type object.

Should always be Self

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

Checks if self is actually part of its subset T (and can be converted to it).

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

The inclusion map: converts self to the equivalent element of its superset.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.