pub struct LatticeStateEFSyncDefault<State, const D: usize>where
State: LatticeState<D> + ?Sized,{ /* private fields */ }Expand description
wrapper to implement LatticeStateWithEField from a LatticeState using
the default implementation of conjugate momenta.
It also implement SimulationStateSynchronous.
Implementations§
Source§impl<State, const D: usize> LatticeStateEFSyncDefault<State, D>where
State: LatticeState<D> + ?Sized,
impl<State, const D: usize> LatticeStateEFSyncDefault<State, D>where
State: LatticeState<D> + ?Sized,
Sourcepub fn state_owned(self) -> Statewhere
State: Sized,
pub fn state_owned(self) -> Statewhere
State: Sized,
Absorbs self and return the state as owned. It essentially deconstruct the structure.
Sourcepub const fn lattice_state(&self) -> &State
pub const fn lattice_state(&self) -> &State
Get a reference to the state.
Sourcepub fn lattice_state_mut(&mut self) -> &mut State
pub fn lattice_state_mut(&mut self) -> &mut State
Get a mutable reference to the state.
Sourcepub fn new_random_e_state(lattice_state: State, rng: &mut impl Rng) -> Selfwhere
State: Sized,
pub fn new_random_e_state(lattice_state: State, rng: &mut impl Rng) -> Selfwhere
State: Sized,
Take a state and generate a new random one and try projecting it to the Gauss law.
§Panic
Panics if N(0, 0.5/beta ) is not a valid distribution (for example beta = 0). Panics if the field could not be projected to the Gauss law.
Sourcepub fn new_e_cold(lattice_state: State) -> Selfwhere
State: Sized,
pub fn new_e_cold(lattice_state: State) -> Selfwhere
State: Sized,
Create a new Self from a state and a cold configuration of the e field (i.e. set to 0)
Sourcepub fn e_field_mut(&mut self) -> &mut EField<D>
pub fn e_field_mut(&mut self) -> &mut EField<D>
Get a mutable reference to the efield
Source§impl<State, const D: usize> LatticeStateEFSyncDefault<State, D>
impl<State, const D: usize> LatticeStateEFSyncDefault<State, D>
Sourcepub fn gauss(&self, point: &LatticePoint<D>) -> Option<CMatrix3>
pub fn gauss(&self, point: &LatticePoint<D>) -> Option<CMatrix3>
Get the gauss coefficient G(x) = \sum_i E_i(x) - U_{-i}(x) E_i(x - i) U^\dagger_{-i}(x).
Source§impl<State, const D: usize> LatticeStateEFSyncDefault<State, D>where
Self: LatticeStateWithEFieldNew<D>,
<Self as LatticeStateWithEFieldNew<D>>::Error: From<LatticeInitializationError>,
State: LatticeState<D>,
impl<State, const D: usize> LatticeStateEFSyncDefault<State, D>where
Self: LatticeStateWithEFieldNew<D>,
<Self as LatticeStateWithEFieldNew<D>>::Error: From<LatticeInitializationError>,
State: LatticeState<D>,
Sourcepub fn new_determinist<R>(
size: Real,
beta: Real,
number_of_points: usize,
rng: &mut R,
d: &impl Distribution<Real>,
) -> Result<Self, <Self as LatticeStateWithEFieldNew<D>>::Error>
pub fn new_determinist<R>( size: Real, beta: Real, number_of_points: usize, rng: &mut R, d: &impl Distribution<Real>, ) -> Result<Self, <Self as LatticeStateWithEFieldNew<D>>::Error>
Generate a hot (i.e. random) initial state.
Single threaded generation with a given random number generator.
size is the size parameter of the lattice and number_of_points is the number of points
in each spatial dimension of the lattice. See LatticeCyclic::new for more info.
useful to reproduce a set of data but slower than
LatticeStateEFSyncDefault::new_random_threaded.
§Errors
Return StateInitializationError::LatticeInitializationError if the parameter is invalid
for LatticeCyclic.
Or propagates the error form Self::new.
§Example
use rand::{SeedableRng,rngs::StdRng};
let mut rng_1 = StdRng::seed_from_u64(0);
let mut rng_2 = StdRng::seed_from_u64(0);
// They have the same seed and should generate the same numbers
let distribution = rand::distributions::Uniform::from(-1_f64..1_f64);
assert_eq!(
LatticeStateEFSyncDefault::<LatticeStateDefault<4>, 4>::new_determinist(1_f64, 1_f64, 4, &mut rng_1, &distribution).unwrap(),
LatticeStateEFSyncDefault::<LatticeStateDefault<4>, 4>::new_determinist(1_f64, 1_f64, 4, &mut rng_2, &distribution).unwrap()
);Sourcepub fn new_determinist_cold_e_hot_link<R>(
size: Real,
beta: Real,
number_of_points: usize,
rng: &mut R,
) -> Result<Self, <Self as LatticeStateWithEFieldNew<D>>::Error>
pub fn new_determinist_cold_e_hot_link<R>( size: Real, beta: Real, number_of_points: usize, rng: &mut R, ) -> Result<Self, <Self as LatticeStateWithEFieldNew<D>>::Error>
Generate a configuration with cold e_field and hot link matrices
§Errors
Return StateInitializationError::LatticeInitializationError if the parameter is invalid
for LatticeCyclic.
Or propagates the error form Self::new.
Sourcepub fn new_cold(
size: Real,
beta: Real,
number_of_points: usize,
) -> Result<Self, <Self as LatticeStateWithEFieldNew<D>>::Error>
pub fn new_cold( size: Real, beta: Real, number_of_points: usize, ) -> Result<Self, <Self as LatticeStateWithEFieldNew<D>>::Error>
Generate a new cold state.
It meas that the link matrices are set to the identity and electrical field are set to 0.
§Errors
Return StateInitializationError::LatticeInitializationError if the parameter is invalid
for LatticeCyclic.
Or propagates the error form Self::new.
Source§impl<State, const D: usize> LatticeStateEFSyncDefault<State, D>
impl<State, const D: usize> LatticeStateEFSyncDefault<State, D>
Sourcepub fn new_random_threaded<Distribution>(
size: Real,
beta: Real,
number_of_points: usize,
d: &Distribution,
number_of_thread: usize,
) -> Result<Self, ThreadedStateInitializationError>
pub fn new_random_threaded<Distribution>( size: Real, beta: Real, number_of_points: usize, d: &Distribution, number_of_thread: usize, ) -> Result<Self, ThreadedStateInitializationError>
Generate a hot (i.e. random) initial state.
Multi threaded generation of random data. Due to the non deterministic way threads
operate a set cannot be reproduce easily, In that case use
LatticeStateEFSyncDefault::new_determinist.
§Errors
Return StateInitializationError::LatticeInitializationError if the parameter is invalid
for LatticeCyclic.
Return ThreadError::ThreadNumberIncorrect if number_of_points = 0.
Returns an error if a thread panicked. Finally, propagates the error form Self::new.
Trait Implementations§
Source§impl<State, const D: usize> Clone for LatticeStateEFSyncDefault<State, D>
impl<State, const D: usize> Clone for LatticeStateEFSyncDefault<State, D>
Source§fn clone(&self) -> LatticeStateEFSyncDefault<State, D>
fn clone(&self) -> LatticeStateEFSyncDefault<State, D>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<State, const D: usize> Debug for LatticeStateEFSyncDefault<State, D>
impl<State, const D: usize> Debug for LatticeStateEFSyncDefault<State, D>
Source§impl<'de, State, const D: usize> Deserialize<'de> for LatticeStateEFSyncDefault<State, D>
impl<'de, State, const D: usize> Deserialize<'de> for LatticeStateEFSyncDefault<State, D>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<State, const D: usize> LatticeState<D> for LatticeStateEFSyncDefault<State, D>where
State: LatticeState<D> + ?Sized,
impl<State, const D: usize> LatticeState<D> for LatticeStateEFSyncDefault<State, D>where
State: LatticeState<D> + ?Sized,
Source§fn set_link_matrix(&mut self, link_matrix: LinkMatrix)
fn set_link_matrix(&mut self, link_matrix: LinkMatrix)
§Panic
panic under the same condition as State::set_link_matrix
Source§fn link_matrix(&self) -> &LinkMatrix
fn link_matrix(&self) -> &LinkMatrix
Source§fn lattice(&self) -> &LatticeCyclic<D>
fn lattice(&self) -> &LatticeCyclic<D>
Source§fn hamiltonian_links(&self) -> Real
fn hamiltonian_links(&self) -> Real
Source§impl<const D: usize> LatticeStateWithEField<D> for LatticeStateEFSyncDefault<LatticeStateDefault<D>, D>where
Direction<D>: DirectionList,
impl<const D: usize> LatticeStateWithEField<D> for LatticeStateEFSyncDefault<LatticeStateDefault<D>, D>where
Direction<D>: DirectionList,
Source§fn hamiltonian_efield(&self) -> Real
fn hamiltonian_efield(&self) -> Real
By default \sum_x Tr(E_i E_i)
Source§fn set_e_field(&mut self, e_field: EField<D>)
fn set_e_field(&mut self, e_field: EField<D>)
§Panic
Panic if the length of link_matrix is different from lattice.get_number_of_points()
Source§fn derivative_u(
link: &LatticeLinkCanonical<D>,
link_matrix: &LinkMatrix,
e_field: &EField<D>,
lattice: &LatticeCyclic<D>,
) -> Option<CMatrix3>
fn derivative_u( link: &LatticeLinkCanonical<D>, link_matrix: &LinkMatrix, e_field: &EField<D>, lattice: &LatticeCyclic<D>, ) -> Option<CMatrix3>
Get the derive of U_i(x).
Source§fn derivative_e(
point: &LatticePoint<D>,
link_matrix: &LinkMatrix,
_e_field: &EField<D>,
lattice: &LatticeCyclic<D>,
) -> Option<SVector<Su3Adjoint, D>>
fn derivative_e( point: &LatticePoint<D>, link_matrix: &LinkMatrix, _e_field: &EField<D>, lattice: &LatticeCyclic<D>, ) -> Option<SVector<Su3Adjoint, D>>
Get the derive of E(x) (as a vector of Su3Adjoint).
Source§fn reset_e_field<Rng>(
&mut self,
rng: &mut Rng,
) -> Result<(), StateInitializationError>
fn reset_e_field<Rng>( &mut self, rng: &mut Rng, ) -> Result<(), StateInitializationError>
rand_distr::StandardNormal. Read moreSource§fn hamiltonian_total(&self) -> Real
fn hamiltonian_total(&self) -> Real
LatticeStateWithEField::hamiltonian_efield Read moreSource§impl<State, const D: usize> LatticeStateWithEFieldNew<D> for LatticeStateEFSyncDefault<State, D>where
State: LatticeState<D> + LatticeStateNew<D>,
Self: LatticeStateWithEField<D>,
StateInitializationError: Into<State::Error>,
State::Error: From<NormalError>,
impl<State, const D: usize> LatticeStateWithEFieldNew<D> for LatticeStateEFSyncDefault<State, D>where
State: LatticeState<D> + LatticeStateNew<D>,
Self: LatticeStateWithEField<D>,
StateInitializationError: Into<State::Error>,
State::Error: From<NormalError>,
Source§fn 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. If e_field or link_matrix does not have the corresponding
amount of data compared to lattice it fails to create the state.
t is the number of time the simulation ran. i.e. the time sate.
Source§type Error = <State as LatticeStateNew<D>>::Error
type Error = <State as LatticeStateNew<D>>::Error
Source§fn 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>
rand_distr::Normal^. Read moreSource§impl<State, const D: usize> PartialEq for LatticeStateEFSyncDefault<State, D>
impl<State, const D: usize> PartialEq for LatticeStateEFSyncDefault<State, D>
Source§fn eq(&self, other: &LatticeStateEFSyncDefault<State, D>) -> bool
fn eq(&self, other: &LatticeStateEFSyncDefault<State, D>) -> bool
self and other values to be equal, and is used by ==.Source§impl<State, const D: usize> Serialize for LatticeStateEFSyncDefault<State, D>
impl<State, const D: usize> Serialize for LatticeStateEFSyncDefault<State, D>
Source§impl<State, const D: usize> SimulationStateSynchronous<D> for LatticeStateEFSyncDefault<State, D>
This is an sync State
impl<State, const D: usize> SimulationStateSynchronous<D> for LatticeStateEFSyncDefault<State, D>
This is an sync State
Source§fn simulate_to_leapfrog<I, State>(
&self,
integrator: &I,
delta_t: Real,
) -> Result<State, I::Error>
fn simulate_to_leapfrog<I, State>( &self, integrator: &I, delta_t: Real, ) -> Result<State, I::Error>
Source§fn simulate_using_leapfrog_n<I, State>(
&self,
integrator: &I,
delta_t: Real,
number_of_steps: usize,
) -> Result<Self, MultiIntegrationError<I::Error>>
fn simulate_using_leapfrog_n<I, State>( &self, integrator: &I, delta_t: Real, number_of_steps: usize, ) -> Result<Self, MultiIntegrationError<I::Error>>
number_of_steps with delta_t at each step using a leap_frog algorithm by fist
doing half a step and then finishing by doing half step. Read moreSource§fn simulate_using_leapfrog_n_auto<I>(
&self,
integrator: &I,
delta_t: Real,
number_of_steps: usize,
) -> Result<Self, MultiIntegrationError<I::Error>>
fn simulate_using_leapfrog_n_auto<I>( &self, integrator: &I, delta_t: Real, number_of_steps: usize, ) -> Result<Self, MultiIntegrationError<I::Error>>
SimulationStateSynchronous::simulate_using_leapfrog_n
but use the default wrapper SimulationStateLeap for the leap frog state. Read moreSource§fn simulate_sync<I, T>(
&self,
integrator: &I,
delta_t: Real,
) -> Result<Self, I::Error>
fn simulate_sync<I, T>( &self, integrator: &I, delta_t: Real, ) -> Result<Self, I::Error>
Source§fn simulate_sync_n<I, T>(
&self,
integrator: &I,
delta_t: Real,
numbers_of_times: usize,
) -> Result<Self, MultiIntegrationError<I::Error>>
fn simulate_sync_n<I, T>( &self, integrator: &I, delta_t: Real, numbers_of_times: usize, ) -> Result<Self, MultiIntegrationError<I::Error>>
Source§fn simulate_symplectic<I, T>(
&self,
integrator: &I,
delta_t: Real,
) -> Result<Self, I::Error>
fn simulate_symplectic<I, T>( &self, integrator: &I, delta_t: Real, ) -> Result<Self, I::Error>
Source§fn simulate_symplectic_n<I, T>(
&self,
integrator: &I,
delta_t: Real,
numbers_of_times: usize,
) -> Result<Self, MultiIntegrationError<I::Error>>
fn simulate_symplectic_n<I, T>( &self, integrator: &I, delta_t: Real, numbers_of_times: usize, ) -> Result<Self, MultiIntegrationError<I::Error>>
Source§fn simulate_symplectic_n_auto<I>(
&self,
integrator: &I,
delta_t: Real,
number_of_steps: usize,
) -> Result<Self, MultiIntegrationError<I::Error>>
fn simulate_symplectic_n_auto<I>( &self, integrator: &I, delta_t: Real, number_of_steps: usize, ) -> Result<Self, MultiIntegrationError<I::Error>>
SimulationStateSynchronous::simulate_symplectic_n
but use the default wrapper SimulationStateLeap for the leap frog state. Read moreimpl<State, const D: usize> StructuralPartialEq for LatticeStateEFSyncDefault<State, D>where
State: LatticeState<D> + ?Sized,
Auto Trait Implementations§
impl<State, const D: usize> Freeze for LatticeStateEFSyncDefault<State, D>
impl<State, const D: usize> RefUnwindSafe for LatticeStateEFSyncDefault<State, D>where
State: RefUnwindSafe + ?Sized,
impl<State, const D: usize> Send for LatticeStateEFSyncDefault<State, D>
impl<State, const D: usize> Sync for LatticeStateEFSyncDefault<State, D>
impl<State, const D: usize> Unpin for LatticeStateEFSyncDefault<State, D>
impl<State, const D: usize> UnwindSafe for LatticeStateEFSyncDefault<State, D>where
State: UnwindSafe + ?Sized,
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> 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<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.