pub struct PlusMinusLindbladNoiseOperatorWrapper {
pub internal: PlusMinusLindbladNoiseOperator,
}
Expand description
These are representations of noisy systems of spins.
In a PlusMinusLindbladNoiseOperator is characterized by a PauliLindbladNoiseOperator to represent the hamiltonian of the spin system, and an optional number of spins.
Returns: self: The new PlusMinusLindbladNoiseOperator.
§Examples
.. code-block:: python
import numpy.testing as npt
from qoqo_calculator_pyo3 import CalculatorComplex
from struqture_py.spins import PlusMinusLindbladNoiseOperator, PlusMinusProduct
slns = PlusMinusLindbladNoiseOperator()
dp = PlusMinusProduct().z(0).plus(1)
slns.add_operator_product((dp, dp), 2.0)
npt.assert_equal(slns.get((dp, dp)), CalculatorComplex(2))
npt.assert_equal(slns.keys(), [(dp, dp)])
Fields§
§internal: PlusMinusLindbladNoiseOperator
Internal storage of struqture::spins::PlusMinusLindbladNoiseOperator
Implementations§
Source§impl PlusMinusLindbladNoiseOperatorWrapper
impl PlusMinusLindbladNoiseOperatorWrapper
Sourcepub fn from_pyany(
input: &Bound<'_, PyAny>,
) -> PyResult<PlusMinusLindbladNoiseOperator>
pub fn from_pyany( input: &Bound<'_, PyAny>, ) -> PyResult<PlusMinusLindbladNoiseOperator>
Fallible conversion of generic python object..
Source§impl PlusMinusLindbladNoiseOperatorWrapper
impl PlusMinusLindbladNoiseOperatorWrapper
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new PlusMinusLindbladNoiseOperator.
Returns: self: The new PlusMinusLindbladNoiseOperator.
Sourcepub fn from_pauli_noise_operator(
value: &Bound<'_, PyAny>,
) -> PyResult<PlusMinusLindbladNoiseOperatorWrapper>
pub fn from_pauli_noise_operator( value: &Bound<'_, PyAny>, ) -> PyResult<PlusMinusLindbladNoiseOperatorWrapper>
Convert a PauliLindbladNoiseOperator into a PlusMinusLindbladNoiseOperator.
Args: value (PauliLindbladNoiseOperator): The PauliLindbladNoiseOperator to create the PlusMinusLindbladNoiseOperator from.
Returns: PlusMinusLindbladNoiseOperator: The operator created from the input PauliLindbladNoiseOperator.
Raises: ValueError: Could not create PauliLindbladNoiseOperator from input.
Sourcepub fn to_pauli_noise_operator(
&self,
) -> PyResult<PauliLindbladNoiseOperatorWrapper>
pub fn to_pauli_noise_operator( &self, ) -> PyResult<PauliLindbladNoiseOperatorWrapper>
Convert a PlusMinusLindbladNoiseOperator into a PauliLindbladNoiseOperator.
Returns: PauliLindbladNoiseOperator: The operator created from the input PlusMinusLindbladNoiseOperator and optional number of spins.
Raises: ValueError: Could not create PauliLindbladNoiseOperator from PlusMinusLindbladNoiseOperator.
Sourcepub fn get(
&self,
key: (Py<PyAny>, Py<PyAny>),
) -> PyResult<CalculatorComplexWrapper>
pub fn get( &self, key: (Py<PyAny>, Py<PyAny>), ) -> PyResult<CalculatorComplexWrapper>
Get the coefficient corresponding to the key.
Args: key (Tuple[Product type, Product type]): Product to get the value of.
Returns: CalculatorComplex: Value at key (or 0.0).
Raises: ValueError: Left-hand product could not be constructed from key. ValueError: Right-hand product could not be constructed from key.
Sourcepub fn remove(
&mut self,
key: (Py<PyAny>, Py<PyAny>),
) -> PyResult<Option<CalculatorComplexWrapper>>
pub fn remove( &mut self, key: (Py<PyAny>, Py<PyAny>), ) -> PyResult<Option<CalculatorComplexWrapper>>
Remove the value of the input object key.
Args: key (Tuple[Product type, Product type]): The key of the value to remove.
Returns: Optional[CalculatorComplex]: Key existed if this is not None, and this is the value it had before it was removed.
Raises: ValueError: Left-hand Product could not be constructed. ValueError: Right-hand Product could not be constructed.
Sourcepub fn set(
&mut self,
key: (Py<PyAny>, Py<PyAny>),
value: &Bound<'_, PyAny>,
) -> PyResult<Option<CalculatorComplexWrapper>>
pub fn set( &mut self, key: (Py<PyAny>, Py<PyAny>), value: &Bound<'_, PyAny>, ) -> PyResult<Option<CalculatorComplexWrapper>>
Overwrite an existing entry or set a new entry in self.
Args: key (Tuple[Product type, Product type]): The key of the value to set. value (CalculatorComplex): The value to set.
Returns: Optional[CalculatorComplex]: Key existed if this is not None, and this is the value it had before it was overwritten.
Raises: ValueError: Left-hand Product could not be constructed. ValueError: Right-hand Product could not be constructed.
Sourcepub fn add_operator_product(
&mut self,
key: (Py<PyAny>, Py<PyAny>),
value: &Bound<'_, PyAny>,
) -> PyResult<()>
pub fn add_operator_product( &mut self, key: (Py<PyAny>, Py<PyAny>), value: &Bound<'_, PyAny>, ) -> PyResult<()>
Adds a new (key object, CalculatorComplex) pair to existing entries.
Args: key (Tuple[Product type, Product type]): The key of the value to add. value (CalculatorComplex): The value to add.
Raises: TypeError: Value is not CalculatorComplex or CalculatorFloat. ValueError: Left-hand product could not be constructed. ValueError: Right-hand product could not be constructed. ValueError: Error in add_operator_product function of self.
Sourcepub fn keys(&self) -> Vec<(PlusMinusProductWrapper, PlusMinusProductWrapper)>
pub fn keys(&self) -> Vec<(PlusMinusProductWrapper, PlusMinusProductWrapper)>
Return unsorted keys in self.
Returns: List[(OperatorProduct, OperatorProduct)]: The sequence of keys of self.
Sourcepub fn values(&self) -> Vec<CalculatorComplexWrapper>
pub fn values(&self) -> Vec<CalculatorComplexWrapper>
Return unsorted values in self.
Returns: List[CalculatorComplex]: The sequence of values of self.
Sourcepub fn __len__(&self) -> usize
pub fn __len__(&self) -> usize
Return unsorted keys in self. Return number of entries in object.
Returns: int: The length of the content of self.
Sourcepub fn empty_clone(
&self,
capacity: Option<usize>,
) -> PlusMinusLindbladNoiseOperatorWrapper
pub fn empty_clone( &self, capacity: Option<usize>, ) -> PlusMinusLindbladNoiseOperatorWrapper
Return an instance of self that has no entries but clones all other properties, with the given capacity.
Args: capacity: The capacity of the object to create.
Returns: self: An empty clone with the same properties as self, with the given capacity.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Return true if object contains no values.
Returns: bool: Whether self is empty or not.
Sourcepub fn truncate(&self, threshold: f64) -> PlusMinusLindbladNoiseOperatorWrapper
pub fn truncate(&self, threshold: f64) -> PlusMinusLindbladNoiseOperatorWrapper
Truncate self by returning a copy without entries under a threshold.
Args: threshold: The threshold for inclusion.
Returns: self: The truncated version of self.
Sourcepub fn __mul__(
&self,
value: &Bound<'_, PyAny>,
) -> PyResult<PlusMinusLindbladNoiseOperatorWrapper>
pub fn __mul__( &self, value: &Bound<'_, PyAny>, ) -> PyResult<PlusMinusLindbladNoiseOperatorWrapper>
Implement *
for self and Union[CalculatorComplex, CalculatorFloat].
Args: value (Union[CalculatorComplex, CalculatorFloat]): value by which to multiply self by.
Returns: self: The object multiplied by the value.
Raises: ValueError: The rhs of the multiplication is neither CalculatorFloat nor CalculatorComplex.
Sourcepub fn __neg__(&self) -> PlusMinusLindbladNoiseOperatorWrapper
pub fn __neg__(&self) -> PlusMinusLindbladNoiseOperatorWrapper
Implement -1
for self.
Returns: self: The object * -1.
Sourcepub fn __add__(
&self,
other: PlusMinusLindbladNoiseOperatorWrapper,
) -> PyResult<PlusMinusLindbladNoiseOperatorWrapper>
pub fn __add__( &self, other: PlusMinusLindbladNoiseOperatorWrapper, ) -> PyResult<PlusMinusLindbladNoiseOperatorWrapper>
Implement +
for self with self-type.
Args: other (self): value by which to add to self.
Returns: self: The two objects added.
Raises: ValueError: Objects could not be added.
Sourcepub fn __sub__(
&self,
other: PlusMinusLindbladNoiseOperatorWrapper,
) -> PyResult<PlusMinusLindbladNoiseOperatorWrapper>
pub fn __sub__( &self, other: PlusMinusLindbladNoiseOperatorWrapper, ) -> PyResult<PlusMinusLindbladNoiseOperatorWrapper>
Implement -
for self with self-type.
Args: other (self): value by which to subtract from self.
Returns: self: The two objects subtracted.
Raises: ValueError: Objects could not be subtracted.
Sourcepub fn __copy__(&self) -> PlusMinusLindbladNoiseOperatorWrapper
pub fn __copy__(&self) -> PlusMinusLindbladNoiseOperatorWrapper
Return a copy (copy here produces a deepcopy).
Returns: Operator: A deep copy of self.
Sourcepub fn __deepcopy__(
&self,
_memodict: Py<PyAny>,
) -> PlusMinusLindbladNoiseOperatorWrapper
pub fn __deepcopy__( &self, _memodict: Py<PyAny>, ) -> PlusMinusLindbladNoiseOperatorWrapper
Return a deep copy .
Returns: Operator: A deep copy of self.
Sourcepub fn from_bincode(
input: &Bound<'_, PyAny>,
) -> PyResult<PlusMinusLindbladNoiseOperatorWrapper>
pub fn from_bincode( input: &Bound<'_, PyAny>, ) -> PyResult<PlusMinusLindbladNoiseOperatorWrapper>
Sourcepub fn to_bincode(&self) -> PyResult<Py<PyByteArray>>
pub fn to_bincode(&self) -> PyResult<Py<PyByteArray>>
Sourcepub fn to_json(&self) -> PyResult<String>
pub fn to_json(&self) -> PyResult<String>
Return the json representation of the object.
Returns: str: The serialized form of the object.
Raises: ValueError: Cannot serialize object to json.
Sourcepub fn from_json(
input: String,
) -> PyResult<PlusMinusLindbladNoiseOperatorWrapper>
pub fn from_json( input: String, ) -> PyResult<PlusMinusLindbladNoiseOperatorWrapper>
Convert the json representation of the object to an instance.
Args: input (str): The serialized object in json form.
Returns: The deserialized object.
Raises: ValueError: Input cannot be deserialized.
Sourcepub fn __str__(&self) -> String
pub fn __str__(&self) -> String
Return a string containing a printable representation of self.
Returns: str: The printable string representation of self.
Sourcepub fn __repr__(&self) -> String
pub fn __repr__(&self) -> String
Return a string containing a printable representation of self.
Returns: str: The printable string representation of self.
Sourcepub fn __richcmp__(
&self,
other: &Bound<'_, PyAny>,
op: CompareOp,
) -> PyResult<bool>
pub fn __richcmp__( &self, other: &Bound<'_, PyAny>, op: CompareOp, ) -> PyResult<bool>
Return the richcmp magic method to perform rich comparison operations on object.
Args: other: The object to compare self to. op: Whether they should be equal or not.
Returns: Whether the two operations compared evaluated to True or False
Raises: NotImplementedError: Other comparison not implemented.
Source§impl PlusMinusLindbladNoiseOperatorWrapper
impl PlusMinusLindbladNoiseOperatorWrapper
Sourcepub fn jordan_wigner(&self) -> FermionLindbladNoiseOperatorWrapper
pub fn jordan_wigner(&self) -> FermionLindbladNoiseOperatorWrapper
Transform the given spin object into a fermionic object using the Jordan Wigner mapping.
Trait Implementations§
Source§impl Clone for PlusMinusLindbladNoiseOperatorWrapper
impl Clone for PlusMinusLindbladNoiseOperatorWrapper
Source§fn clone(&self) -> PlusMinusLindbladNoiseOperatorWrapper
fn clone(&self) -> PlusMinusLindbladNoiseOperatorWrapper
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Default for PlusMinusLindbladNoiseOperatorWrapper
impl Default for PlusMinusLindbladNoiseOperatorWrapper
Source§fn default() -> PlusMinusLindbladNoiseOperatorWrapper
fn default() -> PlusMinusLindbladNoiseOperatorWrapper
Source§impl<'py> IntoPyObject<'py> for PlusMinusLindbladNoiseOperatorWrapper
impl<'py> IntoPyObject<'py> for PlusMinusLindbladNoiseOperatorWrapper
Source§type Target = PlusMinusLindbladNoiseOperatorWrapper
type Target = PlusMinusLindbladNoiseOperatorWrapper
Source§type Output = Bound<'py, <PlusMinusLindbladNoiseOperatorWrapper as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <PlusMinusLindbladNoiseOperatorWrapper as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
Source§impl PartialEq for PlusMinusLindbladNoiseOperatorWrapper
impl PartialEq for PlusMinusLindbladNoiseOperatorWrapper
Source§fn eq(&self, other: &PlusMinusLindbladNoiseOperatorWrapper) -> bool
fn eq(&self, other: &PlusMinusLindbladNoiseOperatorWrapper) -> bool
self
and other
values to be equal, and is used by ==
.Source§impl PyClassImpl for PlusMinusLindbladNoiseOperatorWrapper
impl PyClassImpl for PlusMinusLindbladNoiseOperatorWrapper
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
Source§type ThreadChecker = SendablePyClass<PlusMinusLindbladNoiseOperatorWrapper>
type ThreadChecker = SendablePyClass<PlusMinusLindbladNoiseOperatorWrapper>
type Inventory = Pyo3MethodsInventoryForPlusMinusLindbladNoiseOperatorWrapper
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny
by default, and when you declare
#[pyclass(extends=PyDict)]
, it’s PyDict
.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
Source§impl PyClassNewTextSignature<PlusMinusLindbladNoiseOperatorWrapper> for PyClassImplCollector<PlusMinusLindbladNoiseOperatorWrapper>
impl PyClassNewTextSignature<PlusMinusLindbladNoiseOperatorWrapper> for PyClassImplCollector<PlusMinusLindbladNoiseOperatorWrapper>
fn new_text_signature(self) -> Option<&'static str>
Source§impl PyClass__add__SlotFragment<PlusMinusLindbladNoiseOperatorWrapper> for PyClassImplCollector<PlusMinusLindbladNoiseOperatorWrapper>
impl PyClass__add__SlotFragment<PlusMinusLindbladNoiseOperatorWrapper> for PyClassImplCollector<PlusMinusLindbladNoiseOperatorWrapper>
Source§impl PyClass__mul__SlotFragment<PlusMinusLindbladNoiseOperatorWrapper> for PyClassImplCollector<PlusMinusLindbladNoiseOperatorWrapper>
impl PyClass__mul__SlotFragment<PlusMinusLindbladNoiseOperatorWrapper> for PyClassImplCollector<PlusMinusLindbladNoiseOperatorWrapper>
Source§impl PyClass__sub__SlotFragment<PlusMinusLindbladNoiseOperatorWrapper> for PyClassImplCollector<PlusMinusLindbladNoiseOperatorWrapper>
impl PyClass__sub__SlotFragment<PlusMinusLindbladNoiseOperatorWrapper> for PyClassImplCollector<PlusMinusLindbladNoiseOperatorWrapper>
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a PlusMinusLindbladNoiseOperatorWrapper
impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a PlusMinusLindbladNoiseOperatorWrapper
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a mut PlusMinusLindbladNoiseOperatorWrapper
impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a mut PlusMinusLindbladNoiseOperatorWrapper
Source§impl PyTypeInfo for PlusMinusLindbladNoiseOperatorWrapper
impl PyTypeInfo for PlusMinusLindbladNoiseOperatorWrapper
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Source§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
impl DerefToPyAny for PlusMinusLindbladNoiseOperatorWrapper
impl StructuralPartialEq for PlusMinusLindbladNoiseOperatorWrapper
Auto Trait Implementations§
impl Freeze for PlusMinusLindbladNoiseOperatorWrapper
impl RefUnwindSafe for PlusMinusLindbladNoiseOperatorWrapper
impl Send for PlusMinusLindbladNoiseOperatorWrapper
impl Sync for PlusMinusLindbladNoiseOperatorWrapper
impl Unpin for PlusMinusLindbladNoiseOperatorWrapper
impl UnwindSafe for PlusMinusLindbladNoiseOperatorWrapper
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FromPyObject<'_> for T
impl<T> FromPyObject<'_> for T
Source§impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
Source§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self
into an owned Python object, dropping type information.