Skip to content

Commit 967378c

Browse files
Run cargo fmt
1 parent 4e17a17 commit 967378c

File tree

5 files changed

+10
-15
lines changed

5 files changed

+10
-15
lines changed

src/cubature/adaptive.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,9 +408,7 @@ mod tests {
408408
fn inf_bounds_rejected() {
409409
assert!(adaptive_cubature(|_| 1.0, &[f64::INFINITY], &[1.0], 1e-8).is_err());
410410
assert!(adaptive_cubature(|_| 1.0, &[0.0], &[f64::NEG_INFINITY], 1e-8).is_err());
411-
assert!(
412-
adaptive_cubature(|_| 1.0, &[0.0, f64::INFINITY], &[1.0, 1.0], 1e-8).is_err()
413-
);
411+
assert!(adaptive_cubature(|_| 1.0, &[0.0, f64::INFINITY], &[1.0, 1.0], 1e-8).is_err());
414412
}
415413

416414
#[test]

src/cubature/monte_carlo.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,8 @@ impl MonteCarloIntegrator {
364364
let mean_a = total_sum / total_n as f64;
365365
let mean_b = sum / count as f64;
366366
let delta = mean_b - mean_a;
367-
total_m2 += m2
368-
+ delta * delta * (total_n as f64 * count as f64)
369-
/ (total_n + count) as f64;
367+
total_m2 +=
368+
m2 + delta * delta * (total_n as f64 * count as f64) / (total_n + count) as f64;
370369
} else {
371370
total_m2 += m2;
372371
}

src/gauss_jacobi.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ impl_rule_accessors!(GaussJacobi, nodes_doc: "Returns the nodes on \\[-1, 1\\]."
9898
///
9999
/// μ₀ = 2^(α+β+1) Γ(α+1)Γ(β+1) / Γ(α+β+2)
100100
#[allow(clippy::cast_precision_loss)] // n is a quadrature order, always small enough for exact f64
101-
fn compute_jacobi(n: usize, alpha: f64, beta: f64) -> Result<(Vec<f64>, Vec<f64>), QuadratureError> {
101+
fn compute_jacobi(
102+
n: usize,
103+
alpha: f64,
104+
beta: f64,
105+
) -> Result<(Vec<f64>, Vec<f64>), QuadratureError> {
102106
let ab = alpha + beta;
103107

104108
// Diagonal: α_k = (β²-α²) / ((2k+ab)(2k+ab+2))

src/gauss_lobatto.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,7 @@ fn compute_lobatto(n: usize) -> (Vec<f64>, Vec<f64>) {
137137

138138
// Sort ascending (should already be, but ensure)
139139
let mut pairs: Vec<_> = nodes.into_iter().zip(weights).collect();
140-
pairs.sort_by(|a, b| {
141-
a.0.partial_cmp(&b.0)
142-
.unwrap_or(core::cmp::Ordering::Equal)
143-
});
140+
pairs.sort_by(|a, b| a.0.partial_cmp(&b.0).unwrap_or(core::cmp::Ordering::Equal));
144141
let (nodes, weights) = pairs.into_iter().unzip();
145142

146143
(nodes, weights)

src/golub_welsch.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,7 @@ pub(crate) fn golub_welsch(
6363

6464
// Sort ascending by node
6565
let mut pairs: Vec<_> = d.into_iter().zip(weights).collect();
66-
pairs.sort_by(|a, b| {
67-
a.0.partial_cmp(&b.0)
68-
.unwrap_or(core::cmp::Ordering::Equal)
69-
});
66+
pairs.sort_by(|a, b| a.0.partial_cmp(&b.0).unwrap_or(core::cmp::Ordering::Equal));
7067
Ok(pairs.into_iter().unzip())
7168
}
7269

0 commit comments

Comments
 (0)