Struct qoqo::measurements::CheatedBasisRotationWrapper
source · [−]pub struct CheatedBasisRotationWrapper {
pub internal: CheatedBasisRotation,
}
Expand description
Collected information for executing a basis rotation measurement.
Fields
internal: CheatedBasisRotation
Internal storage of [roqoqo::BasisRotation].
Implementations
sourceimpl CheatedBasisRotationWrapper
impl CheatedBasisRotationWrapper
sourcepub fn new(
constant_circuit: Option<CircuitWrapper>,
circuits: Vec<CircuitWrapper>,
input: CheatedBasisRotationInputWrapper
) -> Self
pub fn new(
constant_circuit: Option<CircuitWrapper>,
circuits: Vec<CircuitWrapper>,
input: CheatedBasisRotationInputWrapper
) -> Self
Creates an new BasisRotation measurement.
Args: constant_circuit (OptionalCircuit): The constant Circuit that is executed before each Circuit in circuits. circuits (listCircuit): The collection of quantum circuits for the separate basis rotations. input (CheatedBasisRotationInput): The additional input information required for measurement.
Returns: self: The CheatedBasisRotation containing the new basis rotation 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>>>
Executes the basis rotation 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 measurement.
Raises: RuntimeError: Unexpected repetition of key in bit_register. RuntimeError: Error evaluating cheated basis rotation measurement.
sourcepub fn circuits(&self) -> Vec<CircuitWrapper>
pub fn circuits(&self) -> Vec<CircuitWrapper>
Returns the collection of quantum circuits for the separate basis rotations.
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) -> CheatedBasisRotationInputWrapper
pub fn input(&self) -> CheatedBasisRotationInputWrapper
Returns the measurement input data defining how to construct expectation values from measurements.
Returns: CheatedBasisRotationInput: The measurment input of CheatedBasisRotation.
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>
Returns clone of Measurement with symbolic parameters replaced
Args: substituted_parameters (dict[str, float]): The dictionary containing the substitutions to use in the Circuit.
sourcepub fn _internal_to_bincode(&self) -> PyResult<(&'static str, Py<PyByteArray>)>
pub fn _internal_to_bincode(&self) -> PyResult<(&'static str, Py<PyByteArray>)>
sourcepub fn to_json(&self) -> PyResult<String>
pub fn to_json(&self) -> PyResult<String>
Serializes the CheatedBasisRotation to json form using the serde_json crate.
Returns: str: The serialized CheatedBasisRotation.
Raises: RuntimeError: Unexpected error serializing CheatedBasisRotation.
Trait Implementations
sourceimpl Clone for CheatedBasisRotationWrapper
impl Clone for CheatedBasisRotationWrapper
sourcefn clone(&self) -> CheatedBasisRotationWrapper
fn clone(&self) -> CheatedBasisRotationWrapper
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 CheatedBasisRotationWrapper
impl Debug for CheatedBasisRotationWrapper
sourceimpl IntoPy<Py<PyAny>> for CheatedBasisRotationWrapper
impl IntoPy<Py<PyAny>> for CheatedBasisRotationWrapper
sourceimpl PyClass for CheatedBasisRotationWrapper
impl PyClass for CheatedBasisRotationWrapper
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<CheatedBasisRotationWrapper> for PyClassImplCollector<CheatedBasisRotationWrapper>
impl PyClassDescriptors<CheatedBasisRotationWrapper> for PyClassImplCollector<CheatedBasisRotationWrapper>
fn py_class_descriptors(self) -> &'static [PyMethodDefType]
sourceimpl PyClassImpl for CheatedBasisRotationWrapper
impl PyClassImpl for CheatedBasisRotationWrapper
sourceconst IS_BASETYPE: bool
const IS_BASETYPE: bool
#[pyclass(subclass)]
sourceconst IS_SUBCLASS: bool
const IS_SUBCLASS: bool
#[pyclass(extends=…)]
type ThreadChecker = ThreadCheckerStub<CheatedBasisRotationWrapper>
type ThreadChecker = ThreadCheckerStub<CheatedBasisRotationWrapper>
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<CheatedBasisRotationWrapper> for PyClassImplCollector<CheatedBasisRotationWrapper>
impl PyClassNewImpl<CheatedBasisRotationWrapper> for PyClassImplCollector<CheatedBasisRotationWrapper>
sourceimpl PyMethods<CheatedBasisRotationWrapper> for PyClassImplCollector<CheatedBasisRotationWrapper>
impl PyMethods<CheatedBasisRotationWrapper> for PyClassImplCollector<CheatedBasisRotationWrapper>
fn py_methods(self) -> &'static [PyMethodDefType]
sourceimpl PyMethodsProtocolSlots<CheatedBasisRotationWrapper> for PyClassImplCollector<CheatedBasisRotationWrapper>
impl PyMethodsProtocolSlots<CheatedBasisRotationWrapper> for PyClassImplCollector<CheatedBasisRotationWrapper>
fn methods_protocol_slots(self) -> &'static [PyType_Slot]
sourceimpl PyTypeInfo for CheatedBasisRotationWrapper
impl PyTypeInfo for CheatedBasisRotationWrapper
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 CheatedBasisRotationWrapper
impl Send for CheatedBasisRotationWrapper
impl Sync for CheatedBasisRotationWrapper
impl Unpin for CheatedBasisRotationWrapper
impl UnwindSafe for CheatedBasisRotationWrapper
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