pub trait SpinIndex:
SymmetricIndex
+ Hash
+ Eq
+ Sized
+ Clone
+ Debug
+ Display
+ FromStr
+ Default
+ Serializewhere
Self::SingleSpinType: Copy,{
type SingleSpinType;
// Required methods
fn new() -> Self;
fn set_pauli(self, index: usize, pauli: Self::SingleSpinType) -> Self;
fn get(&self, index: &usize) -> Option<&Self::SingleSpinType>;
fn iter(&self) -> Iter<'_, (usize, Self::SingleSpinType)>;
fn remap_qubits(&self, mapping: &HashMap<usize, usize>) -> Self;
fn multiply(left: Self, right: Self) -> (Self, Complex64);
fn concatenate(&self, other: Self) -> Result<Self, StruqtureError>;
// Provided methods
fn current_number_spins(&self) -> usize { ... }
fn len(&self) -> usize { ... }
fn is_empty(&self) -> bool { ... }
}Expand description
Trait for all index types requires converting between index types
Required Associated Types§
Sourcetype SingleSpinType
type SingleSpinType
Type of operators on single spin in a SpinIndex.
This can either be a crate::spins::SinglePauliOperator (I, X, Y or Z)
or a [crate::spins::SingleOperator/Hamiltonian] (I, X, iY or Z)
Required Methods§
Sourcefn set_pauli(self, index: usize, pauli: Self::SingleSpinType) -> Self
fn set_pauli(self, index: usize, pauli: Self::SingleSpinType) -> Self
Sourcefn get(&self, index: &usize) -> Option<&Self::SingleSpinType>
fn get(&self, index: &usize) -> Option<&Self::SingleSpinType>
Sourcefn iter(&self) -> Iter<'_, (usize, Self::SingleSpinType)>
fn iter(&self) -> Iter<'_, (usize, Self::SingleSpinType)>
Returns the iterator form of Self.
§Returns
Iter<usize, SingleSpinType>- The iterator form of Self.
Sourcefn remap_qubits(&self, mapping: &HashMap<usize, usize>) -> Self
fn remap_qubits(&self, mapping: &HashMap<usize, usize>) -> Self
Sourcefn multiply(left: Self, right: Self) -> (Self, Complex64)
fn multiply(left: Self, right: Self) -> (Self, Complex64)
Implements multiplication function for a Self typed object by a Self typed object.
§Arguments
left- Left-hand Self typed object to be multiplied.right- Right-hand Self typed object to be multiplied.
Returns
(Self, Complex64)- The multiplied objects and the resulting prefactor.
Sourcefn concatenate(&self, other: Self) -> Result<Self, StruqtureError>
fn concatenate(&self, other: Self) -> Result<Self, StruqtureError>
Returns the concatenation of two Self typed objects with no overlapping qubits.
§Arguments
other- The object to concatenate Self with.
Returns
Ok(Self)- The concatenated objects.Err(StruqtureError::ProductIndexAlreadyOccupied)- Cannot assign pauli matrix to index as it is already occupied.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.