Skip to content

Commit 36ee823

Browse files
Change from statrs to special for usage of special functions in tests
1 parent dbf7e94 commit 36ee823

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

rand_distr/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ rand = { path = "..", version = "0.8.0", default-features = false, features = ["
3434
# Histogram implementation for testing uniformity
3535
average = { version = "0.13", features = [ "std" ] }
3636
# Special functions for testing distributions
37-
statrs = "0.15.0"
37+
special = "0.8.1"

rand_distr/tests/pdf.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,13 @@ fn skew_normal() {
119119
sparkline::render_u64_as_string(hist.bins())
120120
);
121121

122+
use special::Error;
122123
fn pdf(x: f64) -> f64 {
123124
let x_normalized = (x - LOCATION) / SCALE;
124125
let normal_density_x =
125126
(-0.5 * (x_normalized).powi(2)).exp() / (2. * core::f64::consts::PI).sqrt();
126-
let normal_distribution_x = 0.5
127-
* (1.0 + statrs::function::erf::erf(SHAPE * x_normalized / core::f64::consts::SQRT_2));
127+
let normal_distribution_x =
128+
0.5 * (1.0 + (SHAPE * x_normalized / core::f64::consts::SQRT_2).error());
128129
2.0 / SCALE * normal_density_x * normal_distribution_x
129130
}
130131

0 commit comments

Comments
 (0)