Skip to content

Commit

Permalink
rustfmt nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
johann-cm committed Sep 25, 2024
1 parent 6ec035a commit daf98ef
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/numeric/impl_numeric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ where
/// assert_eq!(a.sum(), 10.);
/// ```
pub fn sum(&self) -> A
where
A: Clone + Add<Output = A> + num_traits::Zero,
where A: Clone + Add<Output = A> + num_traits::Zero
{
if let Some(slc) = self.as_slice_memory_order() {
return numeric_util::unrolled_fold(slc, A::zero, A::add);
Expand Down Expand Up @@ -63,8 +62,7 @@ where
///
/// [arithmetic mean]: https://en.wikipedia.org/wiki/Arithmetic_mean
pub fn mean(&self) -> Option<A>
where
A: Clone + FromPrimitive + Add<Output = A> + Div<Output = A> + Zero,
where A: Clone + FromPrimitive + Add<Output = A> + Div<Output = A> + Zero
{
let n_elements = self.len();
if n_elements == 0 {
Expand All @@ -85,8 +83,7 @@ where
/// assert_eq!(a.product(), 24.);
/// ```
pub fn product(&self) -> A
where
A: Clone + Mul<Output = A> + num_traits::One,
where A: Clone + Mul<Output = A> + num_traits::One
{
if let Some(slc) = self.as_slice_memory_order() {
return numeric_util::unrolled_fold(slc, A::one, A::mul);
Expand Down Expand Up @@ -144,8 +141,7 @@ where
#[track_caller]
#[cfg(feature = "std")]
pub fn var(&self, ddof: A) -> A
where
A: Float + FromPrimitive,
where A: Float + FromPrimitive
{
let zero = A::from_usize(0).expect("Converting 0 to `A` must not fail.");
let n = A::from_usize(self.len()).expect("Converting length to `A` must not fail.");
Expand Down Expand Up @@ -210,8 +206,7 @@ where
#[track_caller]
#[cfg(feature = "std")]
pub fn std(&self, ddof: A) -> A
where
A: Float + FromPrimitive,
where A: Float + FromPrimitive
{
self.var(ddof).sqrt()
}
Expand Down Expand Up @@ -461,8 +456,7 @@ where
/// array![1.0, 2.0, 3.0].diff(10, Axis(0));
/// ```
pub fn diff(&self, n: usize, axis: Axis) -> Array<A, D>
where
A: Sub<A, Output = A> + Zero + Clone,
where A: Sub<A, Output = A> + Zero + Clone
{
assert!(axis.0 < self.ndim(), "The array has only ndim {}, but `axis` {:?} is given.", self.ndim(), axis);
assert!(
Expand Down

0 comments on commit daf98ef

Please sign in to comment.