Enum roqoqo::quantum_program::QuantumProgram [−][src]
pub enum QuantumProgram {
BasisRotation {
measurement: BasisRotation,
input_parameter_names: Vec<String>,
},
CheatedBasisRotation {
measurement: CheatedBasisRotation,
input_parameter_names: Vec<String>,
},
Cheated {
measurement: Cheated,
input_parameter_names: Vec<String>,
},
ClassicalRegister {
measurement: ClassicalRegister,
input_parameter_names: Vec<String>,
},
}
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.
Variants
Variant for basis rotation measurement based quantum programs
Fields of BasisRotation
measurement: BasisRotation
The measurement that is performed
input_parameter_names: Vec<String>
List of free input parameters that can be set when the QuantumProgram is executed
Variant for cheated basis rotation measurement based quantum programs
Fields of CheatedBasisRotation
measurement: CheatedBasisRotation
The measurement that is performed
input_parameter_names: Vec<String>
List of free input parameters that can be set when the QuantumProgram is executed
Variant for statevector/density matrix based measurements
Fields of Cheated
Variant quantum programs returning full classical registers
Fields of ClassicalRegister
measurement: ClassicalRegister
The measurement that is performed
input_parameter_names: Vec<String>
List of free input parameters that can be set when the QuantumProgram is executed
Implementations
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.
Arguments:
backend
- The backend the program is executed on.parameters
- List of float (f64) parameters of the function call in order ofinput_parameter_names
pub fn run_registers<T>(&self, backend: T, parameters: &[f64]) -> RegisterResult where
T: EvaluatingBackend,
pub fn run_registers<T>(&self, backend: T, parameters: &[f64]) -> RegisterResult where
T: EvaluatingBackend,
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.
Arguments:
backend
- The backend the program is executed on.parameters
- List of float (f64) parameters of the function call in order ofinput_parameter_names
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Implements the Display trait for QuantumProgram.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for QuantumProgram
impl Send for QuantumProgram
impl Sync for QuantumProgram
impl Unpin for QuantumProgram
impl UnwindSafe for QuantumProgram
Blanket Implementations
Mutably borrows from an owned value. Read more
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.