pub struct RandomWalk<T: FloatExt = f64> { /* private fields */ }Expand description
Random walk with heavy-tailed jump lengths.
§Mathematical Formulation
The path is represented by
$$X_n = X_0 + \sum_{i=1}^{n} A_i,$$
where the jump lengths (A_i) are sampled from an alpha-stable law and then
assigned a sign according to probability.
Implementations§
Source§impl<T: FloatExt> RandomWalk<T>
impl<T: FloatExt> RandomWalk<T>
Sourcepub fn new(probability: T, alpha: T, start_position: T) -> XResult<Self>
pub fn new(probability: T, alpha: T, start_position: T) -> XResult<Self>
Create a new RandomWalk
§Arguments
probability- The probability of the step in the positive directionalpha- The alpha parameter of the stable distributionstart_position- The starting position
§Example
use diffusionx::simulation::discrete::RandomWalk;
let rw = RandomWalk::new(0.5, 1.0, 0.0).unwrap();Sourcepub fn probability(&self) -> T
pub fn probability(&self) -> T
Get the probability of the step in the positive direction
Sourcepub fn start_position(&self) -> T
pub fn start_position(&self) -> T
Get the starting position
Trait Implementations§
Source§impl<T: Clone + FloatExt> Clone for RandomWalk<T>
impl<T: Clone + FloatExt> Clone for RandomWalk<T>
Source§fn clone(&self) -> RandomWalk<T>
fn clone(&self) -> RandomWalk<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: FloatExt> Default for RandomWalk<T>
impl<T: FloatExt> Default for RandomWalk<T>
Source§impl<N: IntExt, X: FloatExt + SampleUniform> DiscreteProcess<N, X> for RandomWalk<X>
impl<N: IntExt, X: FloatExt + SampleUniform> DiscreteProcess<N, X> for RandomWalk<X>
Source§fn displacement(&self, num_step: N) -> XResult<X>
fn displacement(&self, num_step: N) -> XResult<X>
Get the displacement of the discrete process Read more
Source§fn mean(&self, num_step: N, particles: usize) -> XResult<f64>where
Self: DiscreteTrajectoryTrait<N, X>,
fn mean(&self, num_step: N, particles: usize) -> XResult<f64>where
Self: DiscreteTrajectoryTrait<N, X>,
Get the mean of the discrete process Read more
Source§fn msd(&self, num_step: N, particles: usize) -> XResult<f64>where
Self: DiscreteTrajectoryTrait<N, X>,
fn msd(&self, num_step: N, particles: usize) -> XResult<f64>where
Self: DiscreteTrajectoryTrait<N, X>,
Get the mean square displacement of the discrete process Read more
Source§fn raw_moment(&self, num_step: N, order: i32, particles: usize) -> XResult<f64>where
Self: DiscreteTrajectoryTrait<N, X>,
fn raw_moment(&self, num_step: N, order: i32, particles: usize) -> XResult<f64>where
Self: DiscreteTrajectoryTrait<N, X>,
Get the raw moment of the discrete process Read more
Source§fn central_moment(
&self,
num_step: N,
order: i32,
particles: usize,
) -> XResult<f64>where
Self: DiscreteTrajectoryTrait<N, X>,
fn central_moment(
&self,
num_step: N,
order: i32,
particles: usize,
) -> XResult<f64>where
Self: DiscreteTrajectoryTrait<N, X>,
Get the central moment of the discrete process Read more
Source§fn frac_raw_moment(
&self,
num_step: N,
order: f64,
particles: usize,
) -> XResult<f64>where
Self: DiscreteTrajectoryTrait<N, X>,
fn frac_raw_moment(
&self,
num_step: N,
order: f64,
particles: usize,
) -> XResult<f64>where
Self: DiscreteTrajectoryTrait<N, X>,
Get the fractional raw moment of the discrete process Read more
Source§fn frac_central_moment(
&self,
num_step: N,
order: f64,
particles: usize,
) -> XResult<f64>where
Self: DiscreteTrajectoryTrait<N, X>,
fn frac_central_moment(
&self,
num_step: N,
order: f64,
particles: usize,
) -> XResult<f64>where
Self: DiscreteTrajectoryTrait<N, X>,
Get the fractional central moment of the discrete process Read more
Auto Trait Implementations§
impl<T> Freeze for RandomWalk<T>where
T: Freeze,
impl<T> RefUnwindSafe for RandomWalk<T>where
T: RefUnwindSafe,
impl<T> Send for RandomWalk<T>
impl<T> Sync for RandomWalk<T>
impl<T> Unpin for RandomWalk<T>where
T: Unpin,
impl<T> UnsafeUnpin for RandomWalk<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for RandomWalk<T>where
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SP, N, X> DiscreteTrajectoryTrait<N, X> for SP
impl<SP, N, X> DiscreteTrajectoryTrait<N, X> for SP
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>
Converts
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>
Converts
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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§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).Source§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.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.