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,

source

pub fn state_owned(self) -> Statewhere State: Sized,

Absorbs self and return the state as owned. It essentially deconstruct the structure.

source

pub const fn lattice_state(&self) -> &State

Get a reference to the state.

source

pub fn lattice_state_mut(&mut self) -> &mut State

Get a mutable reference to the state.

source

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.

source

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)

source

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>where Self: LatticeStateWithEField<D>, State: LatticeState<D> + ?Sized,

source

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>,

source

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>where R: Rng + ?Sized,

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()
);

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.

source

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>where Self: LatticeStateWithEFieldNew<D, Error = StateInitializationError>, State: LatticeState<D>,

source

pub fn new_random_threaded<Distribution>( size: Real, beta: Real, number_of_points: usize, d: &Distribution, number_of_thread: usize ) -> Result<Self, ThreadedStateInitializationError>where Distribution: Distribution<Real> + Sync,

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>where State: LatticeState<D> + ?Sized + Clone,

source§

fn clone(&self) -> LatticeStateEFSyncDefault<State, D>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<State, const D: usize> Debug for LatticeStateEFSyncDefault<State, D>where State: LatticeState<D> + ?Sized + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de, State, const D: usize> Deserialize<'de> for LatticeStateEFSyncDefault<State, D>where State: LatticeState<D> + ?Sized + Deserialize<'de>, SVector<Su3Adjoint, D>: Deserialize<'de>,

source§

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, const D: usize> LatticeState<D> for LatticeStateEFSyncDefault<State, D>where State: LatticeState<D> + ?Sized,

Panic

panic under the same condition as State::set_link_matrix

source§

const CA: Real = State::CA

C_A constant of the model, usually it is 3.
Get the link matrices of this state. Read more
source§

fn lattice(&self) -> &LatticeCyclic<D>

Get the lattice into which the state exists.
source§

fn beta(&self) -> Real

Returns the beta parameter of the states.
Returns the Hamiltonian of the links configuration.
source§

fn average_trace_plaquette(&self) -> Option<Complex>

Take the average of the trace of all plaquettes. Read more
source§

impl<const D: usize> LatticeStateWithEField<D> for LatticeStateEFSyncDefault<LatticeStateDefault<D>, D>where Direction<D>: DirectionList,

source§

fn hamiltonian_efield(&self) -> Real

By default \sum_x Tr(E_i E_i)

source§

fn e_field(&self) -> &EField<D>

The “Electrical” field of this state.

source§

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 t(&self) -> usize

return the time state, i.e. the number of time the simulation ran.

source§

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>>

Get the derive of E(x) (as a vector of Su3Adjoint).

source§

fn reset_e_field<Rng>( &mut self, rng: &mut Rng ) -> Result<(), StateInitializationError>where Rng: Rng + ?Sized,

Reset the e_field with radom value distributed as N(0, 1 / beta) rand_distr::StandardNormal. Read more
source§

fn hamiltonian_total(&self) -> Real

Get the total energy, by default LatticeStateWithEField::hamiltonian_efield Read more
source§

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>

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.

§

type Error = <State as LatticeStateNew<D>>::Error

Error type
source§

fn new_random_e<R>( lattice: LatticeCyclic<D>, beta: Real, link_matrix: LinkMatrix, rng: &mut R ) -> Result<Self, Self::Error>where R: Rng + ?Sized,

Create a new state with e_field randomly distributed as rand_distr::Normal^. Read more
source§

impl<State, const D: usize> PartialEq<LatticeStateEFSyncDefault<State, D>> for LatticeStateEFSyncDefault<State, D>where State: LatticeState<D> + ?Sized + PartialEq,

source§

fn eq(&self, other: &LatticeStateEFSyncDefault<State, D>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<State, const D: usize> Serialize for LatticeStateEFSyncDefault<State, D>where State: LatticeState<D> + ?Sized + Serialize, SVector<Su3Adjoint, D>: Serialize,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<State, const D: usize> SimulationStateSynchronous<D> for LatticeStateEFSyncDefault<State, D>where State: LatticeState<D> + Clone + ?Sized, Self: LatticeStateWithEField<D>,

This is an sync State

source§

fn simulate_to_leapfrog<I, State>( &self, integrator: &I, delta_t: Real ) -> Result<State, I::Error>where State: SimulationStateLeapFrog<D>, I: SymplecticIntegrator<Self, State, D> + ?Sized,

does half a step for the conjugate momenta. Read more
source§

fn simulate_using_leapfrog_n<I, State>( &self, integrator: &I, delta_t: Real, number_of_steps: usize ) -> Result<Self, MultiIntegrationError<I::Error>>where State: SimulationStateLeapFrog<D>, I: SymplecticIntegrator<Self, State, D> + ?Sized,

Does 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 more
source§

fn simulate_using_leapfrog_n_auto<I>( &self, integrator: &I, delta_t: Real, number_of_steps: usize ) -> Result<Self, MultiIntegrationError<I::Error>>where I: SymplecticIntegrator<Self, SimulationStateLeap<Self, D>, D> + ?Sized,

Does the same thing as SimulationStateSynchronous::simulate_using_leapfrog_n but use the default wrapper SimulationStateLeap for the leap frog state. Read more
source§

fn simulate_sync<I, T>( &self, integrator: &I, delta_t: Real ) -> Result<Self, I::Error>where I: SymplecticIntegrator<Self, T, D> + ?Sized, T: SimulationStateLeapFrog<D>,

Does a simulation step using the sync algorithm Read more
source§

fn simulate_sync_n<I, T>( &self, integrator: &I, delta_t: Real, numbers_of_times: usize ) -> Result<Self, MultiIntegrationError<I::Error>>where I: SymplecticIntegrator<Self, T, D> + ?Sized, T: SimulationStateLeapFrog<D>,

Does numbers_of_times of step of size delta_t using the sync algorithm Read more
source§

fn simulate_symplectic<I, T>( &self, integrator: &I, delta_t: Real ) -> Result<Self, I::Error>where I: SymplecticIntegrator<Self, T, D> + ?Sized, T: SimulationStateLeapFrog<D>,

Integrate the state using the symplectic algorithm ( by going to leapfrog and back to sync) Read more
source§

fn simulate_symplectic_n<I, T>( &self, integrator: &I, delta_t: Real, numbers_of_times: usize ) -> Result<Self, MultiIntegrationError<I::Error>>where I: SymplecticIntegrator<Self, T, D> + ?Sized, T: SimulationStateLeapFrog<D>,

Does numbers_of_times of step of size delta_t using the symplectic algorithm Read more
source§

fn simulate_symplectic_n_auto<I>( &self, integrator: &I, delta_t: Real, number_of_steps: usize ) -> Result<Self, MultiIntegrationError<I::Error>>where I: SymplecticIntegrator<Self, SimulationStateLeap<Self, D>, D> + ?Sized,

Does the same thing as SimulationStateSynchronous::simulate_symplectic_n but use the default wrapper SimulationStateLeap for the leap frog state. Read more
source§

impl<State, const D: usize> StructuralPartialEq for LatticeStateEFSyncDefault<State, D>where State: LatticeState<D> + ?Sized,

Auto Trait Implementations§

§

impl<State: ?Sized, const D: usize> RefUnwindSafe for LatticeStateEFSyncDefault<State, D>where State: RefUnwindSafe,

§

impl<State: ?Sized, const D: usize> Send for LatticeStateEFSyncDefault<State, D>where State: Send,

§

impl<State: ?Sized, const D: usize> Sync for LatticeStateEFSyncDefault<State, D>where State: Sync,

§

impl<State: ?Sized, const D: usize> Unpin for LatticeStateEFSyncDefault<State, D>where State: Unpin,

§

impl<State: ?Sized, const D: usize> UnwindSafe for LatticeStateEFSyncDefault<State, D>where State: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,

§

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

Checks if self is actually part of its subset T (and can be converted to it).
§

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

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,

source§

impl<T> Scalar for Twhere T: 'static + Clone + PartialEq<T> + Debug,