Skip to content

Commit 298f994

Browse files
committed
refactor: rename Sampling* -> Sampling*Ext
1 parent f15dff1 commit 298f994

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+152
-152
lines changed

src/ai/fou/fou_lstm_datasets.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use ndarray::{s, Array1};
88
use ndarray_rand::RandomExt;
99
use rand_distr::Uniform;
1010

11-
use crate::stochastic::{diffusion::fou::FOU, noise::fgn::FGN, Sampling};
11+
use crate::stochastic::{diffusion::fou::FOU, noise::fgn::FGN, SamplingExt};
1212

1313
pub fn test_vasicek_1_d(
1414
epoch_size: usize,

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ use std::io::{BufRead, BufReader};
66
use std::time::Instant;
77
use stochastic_rs::plot_1d;
88
use stochastic_rs::stochastic::noise::fgn::FGN;
9-
use stochastic_rs::stochastic::Sampling;
9+
use stochastic_rs::stochastic::SamplingExt;
1010
// use stochastic_rs::stochastic::noise::fgn::FGN;
11-
// use stochastic_rs::stochastic::Sampling;
11+
// use stochastic_rs::stochastic::SamplingExt;
1212

1313
use stochastic_rs::stats::fd::FractalDim;
1414
use stochastic_rs::stats::fou_estimator::{

src/stats/fd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl FractalDim {
7777
mod tests {
7878
use approx::assert_relative_eq;
7979

80-
use crate::stochastic::{noise::fgn::FGN, process::fbm::FBM, Sampling, N};
80+
use crate::stochastic::{noise::fgn::FGN, process::fbm::FBM, SamplingExt, N};
8181

8282
use super::*;
8383

src/stats/fou_estimator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use ndarray::{array, s, Array1};
33
use statrs::function::gamma::gamma;
44
use std::f64::consts::SQRT_2;
55

6-
use crate::stochastic::{noise::fgn::FGN, Sampling};
6+
use crate::stochastic::{noise::fgn::FGN, SamplingExt};
77

88
// Version 1: FOUParameterEstimationV1 with linear filter methods
99
#[derive(ImplNew)]
@@ -428,7 +428,7 @@ impl FOUParameterEstimationV3 {
428428
#[cfg(test)]
429429
mod tests {
430430
use super::*;
431-
use crate::stochastic::{diffusion::fou::FOU, noise::fgn::FGN, Sampling};
431+
use crate::stochastic::{diffusion::fou::FOU, noise::fgn::FGN, SamplingExt};
432432

433433
#[test]
434434
fn test_fou_parameter_estimation_v1() {

src/stochastic.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
//!
3333
//! ```rust
3434
//! use stochastic::diffusion::BrownianMotion;
35-
//! use stochastic::Sampling;
35+
//! use stochastic::SamplingExt;
3636
//!
3737
//! let bm = BrownianMotion::new(0.0, 1.0, 1.0, 1000);
3838
//! let path = bm.sample();
@@ -78,7 +78,7 @@ pub const S0: f64 = 100.0;
7878
pub const K: f64 = 100.0;
7979

8080
/// Trait for 1D sampling of stochastic processes
81-
pub trait Sampling<T: Clone + Send + Sync + Zero>: Send + Sync {
81+
pub trait SamplingExt<T: Clone + Send + Sync + Zero>: Send + Sync {
8282
/// Sample the process
8383
fn sample(&self) -> Array1<T>;
8484

@@ -124,7 +124,7 @@ pub trait Sampling<T: Clone + Send + Sync + Zero>: Send + Sync {
124124
}
125125

126126
/// Trait for sampling vector-valued stochastic processes
127-
pub trait SamplingVector<T: Clone + Send + Sync + Zero>: Send + Sync {
127+
pub trait SamplingVExt<T: Clone + Send + Sync + Zero>: Send + Sync {
128128
/// Sample the vector process
129129
fn sample(&self) -> Array2<T>;
130130

@@ -147,7 +147,7 @@ pub trait SamplingVector<T: Clone + Send + Sync + Zero>: Send + Sync {
147147
}
148148

149149
/// Trait for 2D sampling of stochastic processes
150-
pub trait Sampling2D<T: Clone + Send + Sync + Zero>: Send + Sync {
150+
pub trait Sampling2DExt<T: Clone + Send + Sync + Zero>: Send + Sync {
151151
/// Sample the process
152152
fn sample(&self) -> [Array1<T>; 2];
153153

@@ -190,7 +190,7 @@ pub trait Sampling2D<T: Clone + Send + Sync + Zero>: Send + Sync {
190190
}
191191

192192
/// Trait for 3D sampling of stochastic processes
193-
pub trait Sampling3D<T: Clone + Send + Sync + Zero>: Send + Sync {
193+
pub trait Sampling3DExt<T: Clone + Send + Sync + Zero>: Send + Sync {
194194
/// Sample the process
195195
fn sample(&self) -> [Array1<T>; 3];
196196

@@ -207,7 +207,7 @@ pub trait Sampling3D<T: Clone + Send + Sync + Zero>: Send + Sync {
207207
}
208208

209209
/// Provides analytical functions of the distribution (pdf, cdf, etc)
210-
pub trait Distribution {
210+
pub trait DistributionExt {
211211
/// Characteristic function of the distribution
212212
fn characteristic_function(&self, _t: f64) -> Complex64 {
213213
Complex64::new(0.0, 0.0)

src/stochastic/autoregressive/agrach.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use ndarray::Array1;
33
use ndarray_rand::RandomExt;
44
use rand_distr::Normal;
55

6-
use crate::stochastic::Sampling;
6+
use crate::stochastic::SamplingExt;
77

88
/// A generic Asymmetric GARCH(p,q) model (A-GARCH),
99
/// allowing a separate "delta" term for negative-lag effects.
@@ -39,7 +39,7 @@ pub struct AGARCH {
3939
pub m: Option<usize>,
4040
}
4141

42-
impl Sampling<f64> for AGARCH {
42+
impl SamplingExt<f64> for AGARCH {
4343
fn sample(&self) -> Array1<f64> {
4444
let p = self.alpha.len();
4545
let q = self.beta.len();
@@ -101,7 +101,7 @@ mod tests {
101101

102102
use crate::{
103103
plot_1d,
104-
stochastic::{autoregressive::agrach::AGARCH, Sampling},
104+
stochastic::{autoregressive::agrach::AGARCH, SamplingExt},
105105
};
106106

107107
#[test]

src/stochastic/autoregressive/ar.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use ndarray::Array1;
33
use ndarray_rand::RandomExt;
44
use rand_distr::Normal;
55

6-
use crate::stochastic::Sampling;
6+
use crate::stochastic::SamplingExt;
77

88
/// Implements an AR(p) model:
99
///
@@ -33,7 +33,7 @@ pub struct ARp {
3333
pub x0: Option<Array1<f64>>,
3434
}
3535

36-
impl Sampling<f64> for ARp {
36+
impl SamplingExt<f64> for ARp {
3737
fn sample(&self) -> Array1<f64> {
3838
let p = self.phi.len();
3939
let noise = Array1::random(self.n, Normal::new(0.0, self.sigma).unwrap());
@@ -78,7 +78,7 @@ mod tests {
7878

7979
use crate::{
8080
plot_1d,
81-
stochastic::{autoregressive::ar::ARp, Sampling},
81+
stochastic::{autoregressive::ar::ARp, SamplingExt},
8282
};
8383

8484
#[test]

src/stochastic/autoregressive/arch.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use ndarray::Array1;
33
use ndarray_rand::RandomExt;
44
use rand_distr::Normal;
55

6-
use crate::stochastic::Sampling;
6+
use crate::stochastic::SamplingExt;
77

88
/// Implements an ARCH(m) model:
99
///
@@ -29,7 +29,7 @@ pub struct ARCH {
2929
pub m: Option<usize>,
3030
}
3131

32-
impl Sampling<f64> for ARCH {
32+
impl SamplingExt<f64> for ARCH {
3333
fn sample(&self) -> Array1<f64> {
3434
let m = self.alpha.len();
3535
let z = Array1::random(self.n, Normal::new(0.0, 1.0).unwrap());
@@ -66,7 +66,7 @@ mod tests {
6666

6767
use crate::{
6868
plot_1d,
69-
stochastic::{autoregressive::arch::ARCH, Sampling},
69+
stochastic::{autoregressive::arch::ARCH, SamplingExt},
7070
};
7171

7272
#[test]

src/stochastic/autoregressive/arima.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::stochastic::Sampling;
1+
use crate::stochastic::SamplingExt;
22
use impl_new_derive::ImplNew;
33
use ndarray::Array1;
44

@@ -27,7 +27,7 @@ pub struct ARIMA {
2727
pub m: Option<usize>,
2828
}
2929

30-
impl Sampling<f64> for ARIMA {
30+
impl SamplingExt<f64> for ARIMA {
3131
fn sample(&self) -> Array1<f64> {
3232
// 1) Generate an AR(p) series with user-provided coefficients
3333
let ar_model = ARp::new(
@@ -85,7 +85,7 @@ mod tests {
8585

8686
use crate::{
8787
plot_1d,
88-
stochastic::{autoregressive::arima::ARIMA, Sampling},
88+
stochastic::{autoregressive::arima::ARIMA, SamplingExt},
8989
};
9090

9191
#[test]

src/stochastic/autoregressive/egarch.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use ndarray::Array1;
33
use ndarray_rand::RandomExt;
44
use rand_distr::Normal;
55

6-
use crate::stochastic::Sampling;
6+
use crate::stochastic::SamplingExt;
77

88
/// Implements an EGARCH(p,q) model:
99
///
@@ -50,7 +50,7 @@ pub struct EGARCH {
5050
pub m: Option<usize>,
5151
}
5252

53-
impl Sampling<f64> for EGARCH {
53+
impl SamplingExt<f64> for EGARCH {
5454
fn sample(&self) -> Array1<f64> {
5555
let p = self.alpha.len();
5656
let q = self.beta.len();
@@ -118,7 +118,7 @@ mod tests {
118118

119119
use crate::{
120120
plot_1d,
121-
stochastic::{autoregressive::egarch::EGARCH, Sampling},
121+
stochastic::{autoregressive::egarch::EGARCH, SamplingExt},
122122
};
123123

124124
#[test]

0 commit comments

Comments
 (0)