Skip to content

Commit 18293d7

Browse files
committed
Update deps and format
1 parent cc1f753 commit 18293d7

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ codegen-units = 1
2424
rand = { version = "0.8.5", features = ["small_rng"] }
2525
rand_distr = "0.4.3"
2626
multiversion = "0.7.2"
27-
itertools = "0.10.5"
27+
itertools = "0.11.0"
2828
crossbeam = "0.8.2"
2929
thiserror = "1.0.40"
3030
rayon = "1.7.0"

src/math.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ pub fn vector_dot(a: &[f64], b: &[f64]) -> f64 {
207207
assert!(a.len() == b.len());
208208

209209
let mut result = 0f64;
210-
for (val1, val2) in a.iter().zip(b) {
211-
result += *val1 * *val2;
210+
for (&val1, &val2) in a.iter().zip(b) {
211+
result += val1 * val2;
212212
}
213213
result
214214
}

src/nuts.rs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -527,14 +527,18 @@ impl<H: Hamiltonian, A: AdaptStrategy> StatsBuilder<H, A> {
527527

528528
let gradient = if settings.store_gradient {
529529
let items = MutablePrimitiveArray::new();
530-
Some(MutableFixedSizeListArray::new_with_field(items, "item", false, dim))
530+
Some(MutableFixedSizeListArray::new_with_field(
531+
items, "item", false, dim,
532+
))
531533
} else {
532534
None
533535
};
534536

535537
let unconstrained = if settings.store_gradient {
536538
let items = MutablePrimitiveArray::new();
537-
Some(MutableFixedSizeListArray::new_with_field(items, "item", false, dim))
539+
Some(MutableFixedSizeListArray::new_with_field(
540+
items, "item", false, dim,
541+
))
538542
} else {
539543
None
540544
};
@@ -572,9 +576,9 @@ impl<H: Hamiltonian, A: AdaptStrategy> ArrowBuilder<NutsSampleStats<H::Stats, A:
572576
store
573577
.try_push(
574578
value
575-
.gradient()
576-
.as_ref()
577-
.map(|vals| vals.iter().map(|&x| Some(x)))
579+
.gradient()
580+
.as_ref()
581+
.map(|vals| vals.iter().map(|&x| Some(x))),
578582
)
579583
.unwrap();
580584
}
@@ -583,9 +587,9 @@ impl<H: Hamiltonian, A: AdaptStrategy> ArrowBuilder<NutsSampleStats<H::Stats, A:
583587
store
584588
.try_push(
585589
value
586-
.unconstrained()
587-
.as_ref()
588-
.map(|vals| vals.iter().map(|&x| Some(x)))
590+
.unconstrained()
591+
.as_ref()
592+
.map(|vals| vals.iter().map(|&x| Some(x))),
589593
)
590594
.unwrap();
591595
}
@@ -634,7 +638,11 @@ impl<H: Hamiltonian, A: AdaptStrategy> ArrowBuilder<NutsSampleStats<H::Stats, A:
634638
}
635639

636640
if let Some(mut unconstrained) = self.unconstrained.take() {
637-
fields.push(Field::new("unconstrained_draw", unconstrained.data_type().clone(), true));
641+
fields.push(Field::new(
642+
"unconstrained_draw",
643+
unconstrained.data_type().clone(),
644+
true,
645+
));
638646
arrays.push(unconstrained.as_box());
639647
}
640648

0 commit comments

Comments
 (0)