pub trait LatticeStateWithEFieldNew<const D: usize>where
Self: LatticeStateWithEField<D> + Sized,{
type Error: From<NormalError>;
// Required method
fn new(
lattice: LatticeCyclic<D>,
beta: Real,
e_field: EField<D>,
link_matrix: LinkMatrix,
t: usize,
) -> Result<Self, Self::Error>;
// Provided method
fn new_random_e<R>(
lattice: LatticeCyclic<D>,
beta: Real,
link_matrix: LinkMatrix,
rng: &mut R,
) -> Result<Self, Self::Error>
where R: Rng + ?Sized { ... }
}Expand description
Trait to create a simulation state.
It is used by the super::monte_carlo::HybridMonteCarlo algorithm to create new state.
Required Associated Types§
Sourcetype Error: From<NormalError>
type Error: From<NormalError>
Error type
Required Methods§
Sourcefn new(
lattice: LatticeCyclic<D>,
beta: Real,
e_field: EField<D>,
link_matrix: LinkMatrix,
t: usize,
) -> Result<Self, Self::Error>
fn new( lattice: LatticeCyclic<D>, beta: Real, e_field: EField<D>, link_matrix: LinkMatrix, t: usize, ) -> Result<Self, Self::Error>
Create a new simulation state
§Errors
Give an error if the parameter are incorrect or the length of link_matrix
and e_field does not correspond to lattice
Provided Methods§
Sourcefn new_random_e<R>(
lattice: LatticeCyclic<D>,
beta: Real,
link_matrix: LinkMatrix,
rng: &mut R,
) -> Result<Self, Self::Error>
fn new_random_e<R>( lattice: LatticeCyclic<D>, beta: Real, link_matrix: LinkMatrix, rng: &mut R, ) -> Result<Self, Self::Error>
Create a new state with e_field randomly distributed as rand_distr::Normal^.
§Errors
Gives an error if N(0, 0.5/beta ) is not a valid distribution (for example beta = 0)
or propagate the error from LatticeStateWithEFieldNew::new
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.