pub struct MetropolisHastingsSweep<Rng: Rng> { /* private fields */ }
Expand description

Metropolis Hastings method by doing a pass on all points

Example

use lattice_qcd_rs::error::ImplementationError;
use lattice_qcd_rs::simulation::{LatticeState, LatticeStateDefault, MetropolisHastingsSweep};
use rand::SeedableRng;

let rng = rand::rngs::StdRng::seed_from_u64(0); // change with your seed
let mut mh = MetropolisHastingsSweep::new(1, 0.1_f64, rng)
    .ok_or(ImplementationError::OptionWithUnexpectedNone)?;
// Realistically you want more steps than 10

let mut state = LatticeStateDefault::<3>::new_cold(1_f64, 6_f64, 4)?;
for _ in 0..10 {
    state = state.monte_carlo_step(&mut mh)?;
    println!(
        "mean probability of acceptance during last step {} and replaced {} links",
        mh.prob_replace_mean(),
        mh.number_replace_last()
    );
    // operation to track the progress or the evolution
}
// operation at the end of the simulation

Implementations

Get a ref to the rng.

spread should be between 0 and 1 both not included and number_of_update should be greater than 0.

number_of_update is the number of times a link matrix is randomly changed. spread is the spread factor for the random matrix change ( used in su3::random_su3_close_to_unity).

Get the mean of last probably of acceptance of the random change.

Number of accepted change during last sweep

Get the last probably of acceptance of the random change.

Get a mutable reference to the rng.

Trait Implementations

Converts this type into a mutable reference of the (usually inferred) input type.

Converts this type into a shared reference of the (usually inferred) input type.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Error returned while getting the next element.

Do one Monte Carlo simulation step. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

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

Should always be Self

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

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

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

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

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.