Struct qoqo::measurements::BasisRotationWrapper
source · [−]pub struct BasisRotationWrapper {
pub internal: BasisRotation,
}
Expand description
Collected information for executing a basis rotation measurement.
Fields
internal: BasisRotation
Internal storage of [roqoqo::BasisRotation].
Implementations
sourceimpl BasisRotationWrapper
impl BasisRotationWrapper
sourcepub fn new(
constant_circuit: Option<CircuitWrapper>,
circuits: Vec<CircuitWrapper>,
input: BasisRotationInputWrapper
) -> Self
pub fn new(
constant_circuit: Option<CircuitWrapper>,
circuits: Vec<CircuitWrapper>,
input: BasisRotationInputWrapper
) -> Self
Create a 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 (BasisRotationInput): The additional input information required for measurement.
Returns: BasisRotation: The BasisRotation 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>>>
Execute 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 basis rotation measurement.
sourcepub fn circuits(&self) -> Vec<CircuitWrapper>
pub fn circuits(&self) -> Vec<CircuitWrapper>
Return 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>
Return constant circuit that is executed before any Circuit in circuits.
Returns: OptionalCircuit: The constant Circuit (None if not defined).
sourcepub fn input(&self) -> BasisRotationInputWrapper
pub fn input(&self) -> BasisRotationInputWrapper
Returns the measurement input data defining how to construct expectation values from measurements.
Returns: BasisRotationInput: The measurment input of BasisRotation.
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 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>
Serialize the BasisRotation to json form using the serde_json crate.
Returns: str: The serialized BasisRotation.
Raises: RuntimeError: Unexpected error serializing BasisRotation.
Trait Implementations
sourceimpl Clone for BasisRotationWrapper
impl Clone for BasisRotationWrapper
sourcefn clone(&self) -> BasisRotationWrapper
fn clone(&self) -> BasisRotationWrapper
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 BasisRotationWrapper
impl Debug for BasisRotationWrapper
sourceimpl IntoPy<Py<PyAny>> for BasisRotationWrapper
impl IntoPy<Py<PyAny>> for BasisRotationWrapper
sourceimpl PyClass for BasisRotationWrapper
impl PyClass for BasisRotationWrapper
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<BasisRotationWrapper> for PyClassImplCollector<BasisRotationWrapper>
impl PyClassDescriptors<BasisRotationWrapper> for PyClassImplCollector<BasisRotationWrapper>
fn py_class_descriptors(self) -> &'static [PyMethodDefType]
sourceimpl PyClassImpl for BasisRotationWrapper
impl PyClassImpl for BasisRotationWrapper
sourceconst IS_BASETYPE: bool
const IS_BASETYPE: bool
#[pyclass(subclass)]
sourceconst IS_SUBCLASS: bool
const IS_SUBCLASS: bool
#[pyclass(extends=…)]
type ThreadChecker = ThreadCheckerStub<BasisRotationWrapper>
type ThreadChecker = ThreadCheckerStub<BasisRotationWrapper>
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<BasisRotationWrapper> for PyClassImplCollector<BasisRotationWrapper>
impl PyClassNewImpl<BasisRotationWrapper> for PyClassImplCollector<BasisRotationWrapper>
sourceimpl PyMethods<BasisRotationWrapper> for PyClassImplCollector<BasisRotationWrapper>
impl PyMethods<BasisRotationWrapper> for PyClassImplCollector<BasisRotationWrapper>
fn py_methods(self) -> &'static [PyMethodDefType]
sourceimpl PyMethodsProtocolSlots<BasisRotationWrapper> for PyClassImplCollector<BasisRotationWrapper>
impl PyMethodsProtocolSlots<BasisRotationWrapper> for PyClassImplCollector<BasisRotationWrapper>
fn methods_protocol_slots(self) -> &'static [PyType_Slot]
sourceimpl PyTypeInfo for BasisRotationWrapper
impl PyTypeInfo for BasisRotationWrapper
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 BasisRotationWrapper
impl Send for BasisRotationWrapper
impl Sync for BasisRotationWrapper
impl Unpin for BasisRotationWrapper
impl UnwindSafe for BasisRotationWrapper
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