pub struct CheatedBasisRotationInputWrapper {
pub internal: CheatedBasisRotationInput,
}
Expand description
Collected information for executing a cheated basis rotation measurement.
Fields
internal: CheatedBasisRotationInput
Internal storage of [roqoqo::CheatedBasisRotationInput].
Implementations
sourceimpl CheatedBasisRotationInputWrapper
impl CheatedBasisRotationInputWrapper
sourcepub fn new() -> Self
pub fn new() -> Self
Create new CheatedBasisRotationInput.
The CheatedBasisRotationInput starts with just the number of qubtis and flipped measurements set. The pauli_poduct_qubit_masks and measured_exp_vals start empty and can be extended with CheatedBasisRotationInput::add_linear_exp_val and CheatedBasisRotationInput::add_symbolic_exp_val.
Returns: self: The new instance of BasisRotationInput with pauli_product_qubit_masks = an empty dictionary, the specified number of qubits in input, number_pauli_products = 0, measured_exp_vals = an empty dictionary, and whether to use flipped measurements as specified in input.
sourcepub fn add_pauli_product(&mut self, readout: String) -> usize
pub fn add_pauli_product(&mut self, readout: String) -> usize
Add measured Pauli product to CheatedBasisRotationInput and returns index of Pauli product.
When the pauli product is already in the measurement input the function only returns its index.
Args: readout (str): The name of the readout register containing the pauli_product expectation value.
Returns: int: The index of the added Pauli product in the list of all Pauli products.
sourcepub fn add_linear_exp_val(
&mut self,
name: String,
linear: HashMap<usize, f64>
) -> PyResult<()>
pub fn add_linear_exp_val(
&mut self,
name: String,
linear: HashMap<usize, f64>
) -> PyResult<()>
Add linear definition of expectation value to measurement input.
Adds an expectation value that is defined by a linear combination of expectation values of Pauli products.
Args: name (str): The name of the expectation value. linear (dict[int, float]): The linear combination of expectation values as a map between Pauli product index and coefficient.
Raises: RuntimeError: Failed to add linear expectation value.
sourcepub fn add_symbolic_exp_val(
&mut self,
name: String,
symbolic: String
) -> PyResult<()>
pub fn add_symbolic_exp_val(
&mut self,
name: String,
symbolic: String
) -> PyResult<()>
Add symbolic definition of expectation value to measurement input.
Adds an expectation value that is defined by a symbolic combination of expectation values of Pauli products.
Args: name (str): The name of the expectation value. symbolic (str): The symbolic expression for the expectation values given by qoqo_calculator::CalculatorFloat.
Raises: RuntimeError: Failed to add symbolic expectation value.
The i-th PauliProducts are hardcoded as variables pauli_product_i in the string expression of CalculatorFloat.
Trait Implementations
sourceimpl Clone for CheatedBasisRotationInputWrapper
impl Clone for CheatedBasisRotationInputWrapper
sourcefn clone(&self) -> CheatedBasisRotationInputWrapper
fn clone(&self) -> CheatedBasisRotationInputWrapper
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 IntoPy<Py<PyAny>> for CheatedBasisRotationInputWrapper
impl IntoPy<Py<PyAny>> for CheatedBasisRotationInputWrapper
sourceimpl PyClass for CheatedBasisRotationInputWrapper
impl PyClass for CheatedBasisRotationInputWrapper
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<CheatedBasisRotationInputWrapper> for PyClassImplCollector<CheatedBasisRotationInputWrapper>
impl PyClassDescriptors<CheatedBasisRotationInputWrapper> for PyClassImplCollector<CheatedBasisRotationInputWrapper>
fn py_class_descriptors(self) -> &'static [PyMethodDefType]
sourceimpl PyClassImpl for CheatedBasisRotationInputWrapper
impl PyClassImpl for CheatedBasisRotationInputWrapper
sourceconst IS_BASETYPE: bool
const IS_BASETYPE: bool
#[pyclass(subclass)]
sourceconst IS_SUBCLASS: bool
const IS_SUBCLASS: bool
#[pyclass(extends=…)]
type ThreadChecker = ThreadCheckerStub<CheatedBasisRotationInputWrapper>
type ThreadChecker = ThreadCheckerStub<CheatedBasisRotationInputWrapper>
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<CheatedBasisRotationInputWrapper> for PyClassImplCollector<CheatedBasisRotationInputWrapper>
impl PyClassNewImpl<CheatedBasisRotationInputWrapper> for PyClassImplCollector<CheatedBasisRotationInputWrapper>
sourceimpl PyMethods<CheatedBasisRotationInputWrapper> for PyClassImplCollector<CheatedBasisRotationInputWrapper>
impl PyMethods<CheatedBasisRotationInputWrapper> for PyClassImplCollector<CheatedBasisRotationInputWrapper>
fn py_methods(self) -> &'static [PyMethodDefType]
sourceimpl PyMethodsProtocolSlots<CheatedBasisRotationInputWrapper> for PyClassImplCollector<CheatedBasisRotationInputWrapper>
impl PyMethodsProtocolSlots<CheatedBasisRotationInputWrapper> for PyClassImplCollector<CheatedBasisRotationInputWrapper>
fn methods_protocol_slots(self) -> &'static [PyType_Slot]
sourceimpl PyTypeInfo for CheatedBasisRotationInputWrapper
impl PyTypeInfo for CheatedBasisRotationInputWrapper
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 CheatedBasisRotationInputWrapper
impl Send for CheatedBasisRotationInputWrapper
impl Sync for CheatedBasisRotationInputWrapper
impl Unpin for CheatedBasisRotationInputWrapper
impl UnwindSafe for CheatedBasisRotationInputWrapper
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