mod mixed_decoherence_product;
mod mixed_hamiltonian;
mod mixed_hermitian_product;
mod mixed_noise_operator;
mod mixed_open_system;
mod mixed_operator;
mod mixed_plus_minus_operator;
mod mixed_plus_minus_product;
mod mixed_product;
use crate::{
bosons::BosonIndex, fermions::FermionIndex, ModeIndex, OperateOnDensityMatrix, SpinIndex,
StruqtureError,
};
use qoqo_calculator::CalculatorComplex;
use std::str::FromStr;
pub use mixed_decoherence_product::MixedDecoherenceProduct;
pub use mixed_hamiltonian::MixedHamiltonian;
pub use mixed_hermitian_product::HermitianMixedProduct;
pub use mixed_noise_operator::MixedLindbladNoiseOperator;
pub use mixed_open_system::MixedLindbladOpenSystem;
pub use mixed_operator::MixedOperator;
pub use mixed_plus_minus_operator::MixedPlusMinusOperator;
pub use mixed_plus_minus_product::MixedPlusMinusProduct;
pub use mixed_product::MixedProduct;
pub trait MixedIndex:
std::hash::Hash
+ Eq
+ Sized
+ Clone
+ std::fmt::Debug
+ std::fmt::Display
+ FromStr
+ Default
+ serde::Serialize
where
Self::SpinIndexType: SpinIndex,
Self::BosonicIndexType: BosonIndex,
Self::FermionicIndexType: FermionIndex,
{
type SpinIndexType;
type BosonicIndexType;
type FermionicIndexType;
fn new(
spins: impl IntoIterator<Item = Self::SpinIndexType>,
bosons: impl IntoIterator<Item = Self::BosonicIndexType>,
fermions: impl IntoIterator<Item = Self::FermionicIndexType>,
) -> Result<Self, StruqtureError>;
fn spins(&self) -> std::slice::Iter<'_, Self::SpinIndexType>;
fn bosons(&self) -> std::slice::Iter<'_, Self::BosonicIndexType>;
fn fermions(&self) -> std::slice::Iter<'_, Self::FermionicIndexType>;
fn current_number_spins(&self) -> Vec<usize> {
self.spins().map(|s| s.current_number_spins()).collect()
}
fn current_number_bosonic_modes(&self) -> Vec<usize> {
self.bosons().map(|b| b.current_number_modes()).collect()
}
fn current_number_fermionic_modes(&self) -> Vec<usize> {
self.fermions().map(|f| f.current_number_modes()).collect()
}
fn create_valid_pair(
spins: impl IntoIterator<Item = Self::SpinIndexType>,
bosons: impl IntoIterator<Item = Self::BosonicIndexType>,
fermions: impl IntoIterator<Item = Self::FermionicIndexType>,
value: CalculatorComplex,
) -> Result<(Self, CalculatorComplex), StruqtureError>;
}
pub trait GetValueMixed<'a, T>: MixedIndex
where
T: MixedIndex,
T::SpinIndexType: SpinIndex,
T::BosonicIndexType: BosonIndex,
T::FermionicIndexType: FermionIndex,
{
fn get_key(index: &T) -> Self;
fn get_transform(index: &T, value: CalculatorComplex) -> CalculatorComplex;
}
pub trait OperateOnMixedSystems<'a>: PartialEq + Clone {
fn current_number_spins(&self) -> Vec<usize>;
fn current_number_bosonic_modes(&self) -> Vec<usize>;
fn current_number_fermionic_modes(&self) -> Vec<usize>;
}
pub trait HermitianOperateOnMixedSystems<'a>:
OperateOnMixedSystems<'a>
+ OperateOnDensityMatrix<'a>
+ IntoIterator
+ FromIterator<(Self::Index, CalculatorComplex)>
+ Extend<(Self::Index, CalculatorComplex)>
+ PartialEq
+ Clone
where
&'a Self: IntoIterator<Item = (&'a Self::Index, &'a Self::Value)>,
{
}