Struct qoqo::measurements::CheatedWrapper
source · [−]pub struct CheatedWrapper {
pub internal: Cheated,
}
Expand description
Collected information for executing a cheated measurement.
Fields
internal: Cheated
Internal storage of [roqoqo::Cheated]
Implementations
sourceimpl CheatedWrapper
impl CheatedWrapper
sourcepub fn new(
constant_circuit: Option<CircuitWrapper>,
circuits: Vec<CircuitWrapper>,
input: CheatedInputWrapper
) -> Self
pub fn new(
constant_circuit: Option<CircuitWrapper>,
circuits: Vec<CircuitWrapper>,
input: CheatedInputWrapper
) -> Self
Create an new Cheated measurement
Args: constant_circuit (OptionalCircuit): The constant Circuit that is executed before each Circuit in circuits. circuits (listCircuit): The collection of quantum circuits executed for the measurement. input (CheatedInput): The additional input information required for measurement.
Returns: Cheated: The new measurement.
sourcepub fn evaluate(
&mut self,
input_bit_registers: Py<PyAny>,
float_registers: HashMap<String, FloatOutputRegister>,
complex_registers: HashMap<String, ComplexOutputRegister>
) -> PyResult<Option<HashMap<String, f64>>>
pub fn evaluate(
&mut self,
input_bit_registers: Py<PyAny>,
float_registers: HashMap<String, FloatOutputRegister>,
complex_registers: HashMap<String, ComplexOutputRegister>
) -> PyResult<Option<HashMap<String, f64>>>
Execute the cheated measurement.
Args: input_bit_registers (dict[str, Union[list[list[int]], list[listbool]]]): The classical bit registers with the register name as key. float_registers (dict[str, list[list[float]]): The classical float registers as a dictionary with the register name as key. complex_registers (dict[str, list[list[complex]]): The classical complex registers as a dictionary with the register name as key.
Returns: Optional[dict[str, float]: The evaluated expectation values.
Raises: RuntimeError: Unexpected repetition of key in bit_register. RuntimeError: Error evaluating cheated measurement.
sourcepub fn circuits(&self) -> Vec<CircuitWrapper>
pub fn circuits(&self) -> Vec<CircuitWrapper>
Return the collection of quantum circuits for the separate cheated measurements.
Returns: listCircuit: The quantum circuits.
sourcepub fn constant_circuit(&self) -> Option<CircuitWrapper>
pub fn constant_circuit(&self) -> Option<CircuitWrapper>
Returns constant circuit that is executed before any Circuit in circuits.
Returns: OptionalCircuit: The constant Circuit (None if not defined).
sourcepub fn input(&self) -> CheatedInputWrapper
pub fn input(&self) -> CheatedInputWrapper
Returns the measurement input data defining how to construct expectation values from measurements.
Returns: CheatedInput: The input of Cheated measurement
sourcepub fn measurement_type(&self) -> &'static str
pub fn measurement_type(&self) -> &'static str
Returns the type of the measurement in string form.
Returns: str: The type of the measurement.
sourcepub fn substitute_parameters(
&self,
substituted_parameters: HashMap<String, f64>
) -> PyResult<Self>
pub fn substitute_parameters(
&self,
substituted_parameters: HashMap<String, f64>
) -> PyResult<Self>
Return copy of Measurement with symbolic parameters replaced.
Arguments: substituted_parameters (dict[str, float]): The dictionary containing the substitutions to use in the Circuit.
Raises: RuntimeError: Error substituting symbolic parameters.
sourcepub fn _internal_to_bincode(&self) -> PyResult<(&'static str, Py<PyByteArray>)>
pub fn _internal_to_bincode(&self) -> PyResult<(&'static str, Py<PyByteArray>)>
Trait Implementations
sourceimpl Clone for CheatedWrapper
impl Clone for CheatedWrapper
sourcefn clone(&self) -> CheatedWrapper
fn clone(&self) -> CheatedWrapper
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for CheatedWrapper
impl Debug for CheatedWrapper
sourceimpl IntoPy<Py<PyAny>> for CheatedWrapper
impl IntoPy<Py<PyAny>> for CheatedWrapper
sourceimpl PyClass for CheatedWrapper
impl PyClass for CheatedWrapper
type Dict = PyClassDummySlot
type Dict = PyClassDummySlot
Specify this class has #[pyclass(dict)]
or not.
type WeakRef = PyClassDummySlot
type WeakRef = PyClassDummySlot
Specify this class has #[pyclass(weakref)]
or not.
type BaseNativeType = PyAny
type BaseNativeType = PyAny
The closest native ancestor. This is PyAny
by default, and when you declare
#[pyclass(extends=PyDict)]
, it’s PyDict
. Read more
sourceimpl PyClassDescriptors<CheatedWrapper> for PyClassImplCollector<CheatedWrapper>
impl PyClassDescriptors<CheatedWrapper> for PyClassImplCollector<CheatedWrapper>
fn py_class_descriptors(self) -> &'static [PyMethodDefType]
sourceimpl PyClassImpl for CheatedWrapper
impl PyClassImpl for CheatedWrapper
sourceconst IS_BASETYPE: bool
const IS_BASETYPE: bool
#[pyclass(subclass)]
sourceconst IS_SUBCLASS: bool
const IS_SUBCLASS: bool
#[pyclass(extends=…)]
type ThreadChecker = ThreadCheckerStub<CheatedWrapper>
type ThreadChecker = ThreadCheckerStub<CheatedWrapper>
This handles following two situations: Read more
fn for_each_method_def(visitor: &mut dyn FnMut(&[PyMethodDefType]))
fn get_new() -> Option<newfunc>
fn get_alloc() -> Option<allocfunc>
fn get_free() -> Option<freefunc>
fn for_each_proto_slot(visitor: &mut dyn FnMut(&[PyType_Slot]))
fn get_buffer() -> Option<&'static PyBufferProcs>
sourceimpl PyClassNewImpl<CheatedWrapper> for PyClassImplCollector<CheatedWrapper>
impl PyClassNewImpl<CheatedWrapper> for PyClassImplCollector<CheatedWrapper>
sourceimpl PyMethods<CheatedWrapper> for PyClassImplCollector<CheatedWrapper>
impl PyMethods<CheatedWrapper> for PyClassImplCollector<CheatedWrapper>
fn py_methods(self) -> &'static [PyMethodDefType]
sourceimpl PyMethodsProtocolSlots<CheatedWrapper> for PyClassImplCollector<CheatedWrapper>
impl PyMethodsProtocolSlots<CheatedWrapper> for PyClassImplCollector<CheatedWrapper>
fn methods_protocol_slots(self) -> &'static [PyType_Slot]
sourceimpl PyTypeInfo for CheatedWrapper
impl PyTypeInfo for CheatedWrapper
type AsRefTarget = PyCell<Self>
type AsRefTarget = PyCell<Self>
Utility type to make Py::as_ref work.
sourcefn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
PyTypeObject instance for this type.
sourcefn is_type_of(object: &PyAny) -> bool
fn is_type_of(object: &PyAny) -> bool
Checks if object
is an instance of this type or a subclass of this type.
sourcefn is_exact_type_of(object: &PyAny) -> bool
fn is_exact_type_of(object: &PyAny) -> bool
Checks if object
is an instance of this type.
Auto Trait Implementations
impl RefUnwindSafe for CheatedWrapper
impl Send for CheatedWrapper
impl Sync for CheatedWrapper
impl Unpin for CheatedWrapper
impl UnwindSafe for CheatedWrapper
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<'a, T> FromPyObject<'a> for T where
T: PyClass + Clone,
impl<'a, T> FromPyObject<'a> for T where
T: PyClass + Clone,
sourceimpl<T> PyTypeObject for T where
T: PyTypeInfo,
impl<T> PyTypeObject for T where
T: PyTypeInfo,
sourcepub fn type_object(py: Python<'_>) -> &PyType
pub fn type_object(py: Python<'_>) -> &PyType
Returns the safe abstraction over the type object.
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn to_subset(&self) -> Option<SS>
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.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more