pub struct HybridMonteCarlo<State, Rng, I, const D: usize>where
State: LatticeState<D> + Clone + ?Sized,
LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>,
I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D>,
Rng: Rng,{ /* private fields */ }
Expand description
Hybrid Monte Carlo algorithm (HCM for short).
The idea of HCM is to generate a random set on conjugate momenta to the link matrices.
This conjugated momenta is also refed as the “Electric” field
or e_field
with distribution N(0, 1 / beta). And to solve the equation of motion.
The new state is accepted with probability Exp( -H_old + H_new) where the Hamiltonian has an extra term Tr(E_i ^ 2).
The advantage is that the simulation can be done in a symplectic way i.e. it conserved the Hamiltonian.
Which means that the method has a high acceptance rate.
Example
See the the level module documentation.
Implementations§
source§impl<State, Rng, I, const D: usize> HybridMonteCarlo<State, Rng, I, D>where
State: LatticeState<D> + Clone + ?Sized,
LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>,
I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D>,
Rng: Rng,
impl<State, Rng, I, const D: usize> HybridMonteCarlo<State, Rng, I, D>where State: LatticeState<D> + Clone + ?Sized, LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>, I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D>, Rng: Rng,
sourcepub const fn integrator(&self) -> &I
pub const fn integrator(&self) -> &I
Get the integrator.
sourcepub fn integrator_mut(&mut self) -> &mut I
pub fn integrator_mut(&mut self) -> &mut I
Get a mut ref to the integrator.
sourcepub const fn number_of_steps(&self) -> usize
pub const fn number_of_steps(&self) -> usize
Get the number of steps.
sourcepub const fn new(
delta_t: Real,
number_of_steps: usize,
integrator: I,
rng: Rng
) -> Self
pub const fn new( delta_t: Real, number_of_steps: usize, integrator: I, rng: Rng ) -> Self
gives the following parameter for the HCM :
- delta_t is the step size per integration of the equation of motion
- number_of_steps is the number of time
- integrator is the methods to solve the equation of motion
- rng, a random number generator
Trait Implementations§
source§impl<State, Rng, I, const D: usize> AsMut<Rng> for HybridMonteCarlo<State, Rng, I, D>where
State: LatticeState<D> + Clone + ?Sized,
LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>,
I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D>,
Rng: Rng,
impl<State, Rng, I, const D: usize> AsMut<Rng> for HybridMonteCarlo<State, Rng, I, D>where State: LatticeState<D> + Clone + ?Sized, LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>, I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D>, Rng: Rng,
source§impl<State, Rng, I, const D: usize> AsRef<Rng> for HybridMonteCarlo<State, Rng, I, D>where
State: LatticeState<D> + Clone + ?Sized,
LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>,
I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D>,
Rng: Rng,
impl<State, Rng, I, const D: usize> AsRef<Rng> for HybridMonteCarlo<State, Rng, I, D>where State: LatticeState<D> + Clone + ?Sized, LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>, I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D>, Rng: Rng,
source§impl<State, Rng, I, const D: usize> Clone for HybridMonteCarlo<State, Rng, I, D>where
State: LatticeState<D> + Clone + ?Sized + Clone,
LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>,
I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D> + Clone,
Rng: Rng + Clone,
impl<State, Rng, I, const D: usize> Clone for HybridMonteCarlo<State, Rng, I, D>where State: LatticeState<D> + Clone + ?Sized + Clone, LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>, I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D> + Clone, Rng: Rng + Clone,
source§fn clone(&self) -> HybridMonteCarlo<State, Rng, I, D>
fn clone(&self) -> HybridMonteCarlo<State, Rng, I, D>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<State, Rng, I, const D: usize> Debug for HybridMonteCarlo<State, Rng, I, D>where
State: LatticeState<D> + Clone + ?Sized + Debug,
LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>,
I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D> + Debug,
Rng: Rng + Debug,
impl<State, Rng, I, const D: usize> Debug for HybridMonteCarlo<State, Rng, I, D>where State: LatticeState<D> + Clone + ?Sized + Debug, LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>, I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D> + Debug, Rng: Rng + Debug,
source§impl<'de, State, Rng, I, const D: usize> Deserialize<'de> for HybridMonteCarlo<State, Rng, I, D>where
State: LatticeState<D> + Clone + ?Sized + Deserialize<'de>,
LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>,
I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D> + Deserialize<'de>,
Rng: Rng + Deserialize<'de>,
impl<'de, State, Rng, I, const D: usize> Deserialize<'de> for HybridMonteCarlo<State, Rng, I, D>where State: LatticeState<D> + Clone + ?Sized + Deserialize<'de>, LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>, I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D> + Deserialize<'de>, Rng: Rng + Deserialize<'de>,
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>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<State, Rng, I, const D: usize> MonteCarlo<State, D> for HybridMonteCarlo<State, Rng, I, D>where
State: LatticeState<D> + Clone + ?Sized,
LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>,
I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D>,
Rng: Rng,
impl<State, Rng, I, const D: usize> MonteCarlo<State, D> for HybridMonteCarlo<State, Rng, I, D>where State: LatticeState<D> + Clone + ?Sized, LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>, I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D>, Rng: Rng,
§type Error = MultiIntegrationError<<I as SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D>>::Error>
type Error = MultiIntegrationError<<I as SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D>>::Error>
Error returned while getting the next element.
source§impl<State, Rng, I, const D: usize> PartialEq<HybridMonteCarlo<State, Rng, I, D>> for HybridMonteCarlo<State, Rng, I, D>where
State: LatticeState<D> + Clone + ?Sized + PartialEq,
LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>,
I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D> + PartialEq,
Rng: Rng + PartialEq,
impl<State, Rng, I, const D: usize> PartialEq<HybridMonteCarlo<State, Rng, I, D>> for HybridMonteCarlo<State, Rng, I, D>where State: LatticeState<D> + Clone + ?Sized + PartialEq, LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>, I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D> + PartialEq, Rng: Rng + PartialEq,
source§fn eq(&self, other: &HybridMonteCarlo<State, Rng, I, D>) -> bool
fn eq(&self, other: &HybridMonteCarlo<State, Rng, I, D>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<State, Rng, I, const D: usize> Serialize for HybridMonteCarlo<State, Rng, I, D>where
State: LatticeState<D> + Clone + ?Sized + Serialize,
LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>,
I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D> + Serialize,
Rng: Rng + Serialize,
impl<State, Rng, I, const D: usize> Serialize for HybridMonteCarlo<State, Rng, I, D>where State: LatticeState<D> + Clone + ?Sized + Serialize, LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>, I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D> + Serialize, Rng: Rng + Serialize,
impl<State, Rng, I, const D: usize> StructuralPartialEq for HybridMonteCarlo<State, Rng, I, D>where State: LatticeState<D> + Clone + ?Sized, LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>, I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D>, Rng: Rng,
Auto Trait Implementations§
impl<State, Rng, I, const D: usize> RefUnwindSafe for HybridMonteCarlo<State, Rng, I, D>where I: RefUnwindSafe, Rng: RefUnwindSafe, State: RefUnwindSafe,
impl<State, Rng, I, const D: usize> Send for HybridMonteCarlo<State, Rng, I, D>where I: Send, Rng: Send, State: Send,
impl<State, Rng, I, const D: usize> Sync for HybridMonteCarlo<State, Rng, I, D>where I: Sync, Rng: Sync, State: Sync,
impl<State, Rng, I, const D: usize> Unpin for HybridMonteCarlo<State, Rng, I, D>where I: Unpin, Rng: Unpin, State: Unpin,
impl<State, Rng, I, const D: usize> UnwindSafe for HybridMonteCarlo<State, Rng, I, D>where I: UnwindSafe, Rng: UnwindSafe, State: UnwindSafe,
Blanket Implementations§
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.