pub struct PauliLindbladOpenSystemWrapper {
pub internal: PauliLindbladOpenSystem,
}
Expand description
These are representations of noisy systems of spins.
In a PauliLindbladOpenSystem is characterized by a SpinLindbladOpenOperator to represent the hamiltonian of the system, and an optional number of spins.
Returns: SpinLindbladOpenSystem: The new SpinLindbladOpenSystem.
§Examples
.. code-block:: python
import numpy.testing as npt
import scipy.sparse as sp
from qoqo_calculator_pyo3 import CalculatorComplex, CalculatorFloat
from struqture_py.spins import PauliLindbladOpenSystem, DecoherenceProduct
slns = PauliLindbladOpenSystem()
dp = DecoherenceProduct().z(0).x(1)
slns.system_add_operator_product(dp, 2.0)
npt.assert_equal(slns.current_number_spins(), 2)
npt.assert_equal(slns.system().get(dp), CalculatorFloat(2))
dimension = 4**slns.current_number_spins()
matrix = sp.coo_matrix(slns.sparse_matrix_superoperator_coo(slns.current_number_spins()), shape=(dimension, dimension))
Fields§
§internal: PauliLindbladOpenSystem
Internal storage of struqture::spins::PauliLindbladOpenSystem
Implementations§
Source§impl PauliLindbladOpenSystemWrapper
impl PauliLindbladOpenSystemWrapper
Sourcepub fn from_pyany(input: &Bound<'_, PyAny>) -> PyResult<PauliLindbladOpenSystem>
pub fn from_pyany(input: &Bound<'_, PyAny>) -> PyResult<PauliLindbladOpenSystem>
Fallible conversion of generic python object..
Source§impl PauliLindbladOpenSystemWrapper
impl PauliLindbladOpenSystemWrapper
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new PauliLindbladOpenSystem.
Returns: PauliLindbladOpenSystem: The new PauliLindbladOpenSystem.
Sourcepub fn current_number_spins(&self) -> usize
pub fn current_number_spins(&self) -> usize
Return the current_number_spins input of self.
Returns: int: The number of spins in self.
Sourcepub fn number_spins(&self) -> usize
pub fn number_spins(&self) -> usize
Return maximum index in self.
Returns: int: Maximum index.
Sourcepub fn system(&self) -> PauliHamiltonianWrapper
pub fn system(&self) -> PauliHamiltonianWrapper
Return the system part of self.
Returns: System type: The system of self.
Sourcepub fn noise(&self) -> PauliLindbladNoiseOperatorWrapper
pub fn noise(&self) -> PauliLindbladNoiseOperatorWrapper
Return the noise part of self.
Returns: Noise type: The noise of self.
Sourcepub fn ungroup(
&self,
) -> (PauliHamiltonianWrapper, PauliLindbladNoiseOperatorWrapper)
pub fn ungroup( &self, ) -> (PauliHamiltonianWrapper, PauliLindbladNoiseOperatorWrapper)
Return a tuple of the system and the noise of self.
Returns: (System, Noise): The system and noise of self.
Sourcepub fn group(
system: &Bound<'_, PyAny>,
noise: &Bound<'_, PyAny>,
) -> PyResult<Self>
pub fn group( system: &Bound<'_, PyAny>, noise: &Bound<'_, PyAny>, ) -> PyResult<Self>
Take a tuple of a system term and a noise term and combines them to be a OpenSystem.
Args: system: The system to have in the new instance. noise: The noise to have in the new instance.
Returns: self: The OpenSystem with input system and noise terms.
Raises: ValueError: System could not be constructed. ValueError: Noise could not be constructed. ValueError: Grouping could not be constructed.
Sourcepub fn empty_clone(&self) -> PauliLindbladOpenSystemWrapper
pub fn empty_clone(&self) -> PauliLindbladOpenSystemWrapper
Return an instance of self that has no entries but clones all other properties, with the given capacity.
Returns: self: An empty clone with the same properties as self, with the given capacity.
Sourcepub fn truncate(&self, threshold: f64) -> PauliLindbladOpenSystemWrapper
pub fn truncate(&self, threshold: f64) -> PauliLindbladOpenSystemWrapper
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 system_set(
&mut self,
key: &Bound<'_, PyAny>,
value: &Bound<'_, PyAny>,
) -> PyResult<PauliLindbladOpenSystemWrapper>
pub fn system_set( &mut self, key: &Bound<'_, PyAny>, value: &Bound<'_, PyAny>, ) -> PyResult<PauliLindbladOpenSystemWrapper>
Set a new entry in the system of the open system.
Args: key (Product type): Product key of set object. value (Union[CalculatorComplex, CalculatorFloat]): Value of set object.
Returns: OpenSystem: The OpenSystem with the new entry.
Raises: ValueError: key element cannot be converted to product. TypeError: Value cannot be converted to Union[CalculatorComplex, CalculatorFloat].
Sourcepub fn noise_set(
&mut self,
key: (Py<PyAny>, Py<PyAny>),
value: &Bound<'_, PyAny>,
) -> PyResult<PauliLindbladOpenSystemWrapper>
pub fn noise_set( &mut self, key: (Py<PyAny>, Py<PyAny>), value: &Bound<'_, PyAny>, ) -> PyResult<PauliLindbladOpenSystemWrapper>
Set a new entry in the noise of the open system.
Args: key (Tuple[Product type, Product type]): Tuple of Products of set object. value (CalculatorComplex): CalculatorComplex value of set object.
Returns: OpenSystem: The OpenSystem with the new entry.
Raises: ValueError: Left key element cannot be converted to product. ValueError: Right key element cannot be converted to product. TypeError: Value cannot be converted to Union[CalculatorComplex, CalculatorFloat].
Sourcepub fn system_get(
&mut self,
key: &Bound<'_, PyAny>,
) -> PyResult<CalculatorFloatWrapper>
pub fn system_get( &mut self, key: &Bound<'_, PyAny>, ) -> PyResult<CalculatorFloatWrapper>
Get the CalculatorComplex or CalculatorFloat coefficient corresponding to the key.
Args: key (Product type): Product key of set object.
Returns: CalculatorComplex or CalculatorFloat: Value at key (or 0.0).
Raises: ValueError: key element cannot be converted to product.
Sourcepub fn noise_get(
&mut self,
key: (Py<PyAny>, Py<PyAny>),
) -> PyResult<CalculatorComplexWrapper>
pub fn noise_get( &mut self, key: (Py<PyAny>, Py<PyAny>), ) -> PyResult<CalculatorComplexWrapper>
Get the CalculatorComplex coefficient corresponding to the key.
Args: key (Tuple[Product type, Product type]): Tuple of Products of set object.
Returns: CalculatorComplex: Value at key (or 0.0).
Raises: ValueError: Left key element cannot be converted to product. ValueError: Right key element cannot be converted to product.
Sourcepub fn system_add_operator_product(
&mut self,
key: &Bound<'_, PyAny>,
value: &Bound<'_, PyAny>,
) -> PyResult<PauliLindbladOpenSystemWrapper>
pub fn system_add_operator_product( &mut self, key: &Bound<'_, PyAny>, value: &Bound<'_, PyAny>, ) -> PyResult<PauliLindbladOpenSystemWrapper>
Add a new entry to the system of the open system.
Args: key (Product type): Product key of set object. value (Union[CalculatorComplex, CalculatorFloat]): Value of set object.
Returns: OpenSystem: The OpenSystem with the new entry.
Raises: ValueError: key element cannot be converted to product. TypeError: Value cannot be converted to Union[CalculatorComplex, CalculatorFloat].
Sourcepub fn noise_add_operator_product(
&mut self,
key: (Py<PyAny>, Py<PyAny>),
value: &Bound<'_, PyAny>,
) -> PyResult<PauliLindbladOpenSystemWrapper>
pub fn noise_add_operator_product( &mut self, key: (Py<PyAny>, Py<PyAny>), value: &Bound<'_, PyAny>, ) -> PyResult<PauliLindbladOpenSystemWrapper>
Add a new entry to the system of the open system.
Args: key (Tuple[Product type, Product type]): Tuple of Products of set object. value (CalculatorComplex): Value of set object.
Returns: OpenSystem: The OpenSystem with the new entry.
Raises: ValueError: Left key element cannot be converted to product. ValueError: Right key element cannot be converted to product. TypeError: Value cannot be converted to CalculatorComplex.
Sourcepub fn __mul__(
&self,
value: &Bound<'_, PyAny>,
) -> PyResult<PauliLindbladOpenSystemWrapper>
pub fn __mul__( &self, value: &Bound<'_, PyAny>, ) -> PyResult<PauliLindbladOpenSystemWrapper>
Implement *
for self and CalculatorFloat.
Args: value (CalculatorFloat): value by which to multiply self by.
Returns: self: The object multiplied by the value.
Raises: ValueError: The rhs of the multiplication cannot be converted to CalculatorFloat.
Sourcepub fn sparse_matrix_superoperator_coo(
&self,
number_spins: usize,
) -> PyResult<PyCooMatrix>
pub fn sparse_matrix_superoperator_coo( &self, number_spins: usize, ) -> PyResult<PyCooMatrix>
Construct the sparse matrix representation of the superoperator in COO representation.
The superoperator for the operator O is defined as the Matrix S so that
flatten(-i [O, p]) = S flatten(p)
wher [,]
is the commutator, p
is a matrix
and flatten
flattens a matrix into a vector in row-major form.
Args: number_spins (int): The number of spins in self.
Returns: Tuple[np.ndarray, Tuple[np.ndarray, np.ndarray]]: The matrix little endian representation of self.
Raises: ValueError: CalculatorError. RuntimeError: Could not convert to complex superoperator matrix.
Sourcepub fn __neg__(&self) -> PauliLindbladOpenSystemWrapper
pub fn __neg__(&self) -> PauliLindbladOpenSystemWrapper
Implement -1
for self.
Returns: self: The object * -1.
Sourcepub fn __add__(
&self,
other: PauliLindbladOpenSystemWrapper,
) -> PyResult<PauliLindbladOpenSystemWrapper>
pub fn __add__( &self, other: PauliLindbladOpenSystemWrapper, ) -> PyResult<PauliLindbladOpenSystemWrapper>
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: PauliLindbladOpenSystemWrapper,
) -> PyResult<PauliLindbladOpenSystemWrapper>
pub fn __sub__( &self, other: PauliLindbladOpenSystemWrapper, ) -> PyResult<PauliLindbladOpenSystemWrapper>
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) -> PauliLindbladOpenSystemWrapper
pub fn __copy__(&self) -> PauliLindbladOpenSystemWrapper
Return a copy (copy here produces a deepcopy).
Returns: Operator: A deep copy of self.
Sourcepub fn __deepcopy__(
&self,
_memodict: Py<PyAny>,
) -> PauliLindbladOpenSystemWrapper
pub fn __deepcopy__( &self, _memodict: Py<PyAny>, ) -> PauliLindbladOpenSystemWrapper
Return a deep copy .
Returns: Operator: A deep copy of self.
Sourcepub fn from_bincode(
input: &Bound<'_, PyAny>,
) -> PyResult<PauliLindbladOpenSystemWrapper>
pub fn from_bincode( input: &Bound<'_, PyAny>, ) -> PyResult<PauliLindbladOpenSystemWrapper>
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<PauliLindbladOpenSystemWrapper>
pub fn from_json(input: String) -> PyResult<PauliLindbladOpenSystemWrapper>
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 PauliLindbladOpenSystemWrapper
impl PauliLindbladOpenSystemWrapper
Sourcepub fn jordan_wigner(&self) -> FermionLindbladOpenSystemWrapper
pub fn jordan_wigner(&self) -> FermionLindbladOpenSystemWrapper
Transform the given spin object into a fermionic object using the Jordan Wigner mapping.
Trait Implementations§
Source§impl Clone for PauliLindbladOpenSystemWrapper
impl Clone for PauliLindbladOpenSystemWrapper
Source§fn clone(&self) -> PauliLindbladOpenSystemWrapper
fn clone(&self) -> PauliLindbladOpenSystemWrapper
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Default for PauliLindbladOpenSystemWrapper
impl Default for PauliLindbladOpenSystemWrapper
Source§fn default() -> PauliLindbladOpenSystemWrapper
fn default() -> PauliLindbladOpenSystemWrapper
Source§impl<'py> IntoPyObject<'py> for PauliLindbladOpenSystemWrapper
impl<'py> IntoPyObject<'py> for PauliLindbladOpenSystemWrapper
Source§type Target = PauliLindbladOpenSystemWrapper
type Target = PauliLindbladOpenSystemWrapper
Source§type Output = Bound<'py, <PauliLindbladOpenSystemWrapper as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <PauliLindbladOpenSystemWrapper 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 PauliLindbladOpenSystemWrapper
impl PartialEq for PauliLindbladOpenSystemWrapper
Source§fn eq(&self, other: &PauliLindbladOpenSystemWrapper) -> bool
fn eq(&self, other: &PauliLindbladOpenSystemWrapper) -> bool
self
and other
values to be equal, and is used by ==
.Source§impl PyClassImpl for PauliLindbladOpenSystemWrapper
impl PyClassImpl for PauliLindbladOpenSystemWrapper
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<PauliLindbladOpenSystemWrapper>
type ThreadChecker = SendablePyClass<PauliLindbladOpenSystemWrapper>
type Inventory = Pyo3MethodsInventoryForPauliLindbladOpenSystemWrapper
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<PauliLindbladOpenSystemWrapper> for PyClassImplCollector<PauliLindbladOpenSystemWrapper>
impl PyClassNewTextSignature<PauliLindbladOpenSystemWrapper> for PyClassImplCollector<PauliLindbladOpenSystemWrapper>
fn new_text_signature(self) -> Option<&'static str>
Source§impl PyClass__add__SlotFragment<PauliLindbladOpenSystemWrapper> for PyClassImplCollector<PauliLindbladOpenSystemWrapper>
impl PyClass__add__SlotFragment<PauliLindbladOpenSystemWrapper> for PyClassImplCollector<PauliLindbladOpenSystemWrapper>
Source§impl PyClass__mul__SlotFragment<PauliLindbladOpenSystemWrapper> for PyClassImplCollector<PauliLindbladOpenSystemWrapper>
impl PyClass__mul__SlotFragment<PauliLindbladOpenSystemWrapper> for PyClassImplCollector<PauliLindbladOpenSystemWrapper>
Source§impl PyClass__sub__SlotFragment<PauliLindbladOpenSystemWrapper> for PyClassImplCollector<PauliLindbladOpenSystemWrapper>
impl PyClass__sub__SlotFragment<PauliLindbladOpenSystemWrapper> for PyClassImplCollector<PauliLindbladOpenSystemWrapper>
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a PauliLindbladOpenSystemWrapper
impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a PauliLindbladOpenSystemWrapper
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a mut PauliLindbladOpenSystemWrapper
impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a mut PauliLindbladOpenSystemWrapper
Source§impl PyTypeInfo for PauliLindbladOpenSystemWrapper
impl PyTypeInfo for PauliLindbladOpenSystemWrapper
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 PauliLindbladOpenSystemWrapper
impl StructuralPartialEq for PauliLindbladOpenSystemWrapper
Auto Trait Implementations§
impl Freeze for PauliLindbladOpenSystemWrapper
impl RefUnwindSafe for PauliLindbladOpenSystemWrapper
impl Send for PauliLindbladOpenSystemWrapper
impl Sync for PauliLindbladOpenSystemWrapper
impl Unpin for PauliLindbladOpenSystemWrapper
impl UnwindSafe for PauliLindbladOpenSystemWrapper
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.