fix: Fix new clippy warnings (#79)

* Fix new clippy warnings

* Allow clippy::suspicious-operation-groupings
This commit is contained in:
Luis Moreno
2021-02-16 18:19:14 -04:00
committed by GitHub
parent 745d0b570e
commit 4af69878e0
5 changed files with 7 additions and 4 deletions
+2 -1
View File
@@ -1,7 +1,8 @@
#![allow( #![allow(
clippy::type_complexity, clippy::type_complexity,
clippy::too_many_arguments, clippy::too_many_arguments,
clippy::many_single_char_names clippy::many_single_char_names,
clippy::unnecessary_wraps
)] )]
#![warn(missing_docs)] #![warn(missing_docs)]
#![warn(missing_doc_code_examples)] #![warn(missing_doc_code_examples)]
+2 -1
View File
@@ -1,3 +1,4 @@
#![allow(clippy::wrong_self_convention)]
//! # Linear Algebra and Matrix Decomposition //! # Linear Algebra and Matrix Decomposition
//! //!
//! Most machine learning algorithms in SmartCore depend on linear algebra and matrix decomposition methods from this module. //! Most machine learning algorithms in SmartCore depend on linear algebra and matrix decomposition methods from this module.
@@ -265,7 +266,7 @@ pub trait BaseVector<T: RealNumber>: Clone + Debug {
sum += xi * xi; sum += xi * xi;
} }
mu /= div; mu /= div;
sum / div - mu * mu sum / div - mu.powi(2)
} }
/// Computes the standard deviation. /// Computes the standard deviation.
fn std(&self) -> T { fn std(&self) -> T {
+1 -1
View File
@@ -61,7 +61,7 @@ pub trait MatrixStats<T: RealNumber>: BaseMatrix<T> {
sum += a * a; sum += a * a;
} }
mu /= div; mu /= div;
*x_i = sum / div - mu * mu; *x_i = sum / div - mu.powi(2);
} }
x x
+1 -1
View File
@@ -138,7 +138,7 @@ impl<T: RealNumber, M: Matrix<T>> InteriorPointOptimizer<T, M> {
for i in 0..p { for i in 0..p {
self.prb[i] = T::two() + self.d1[i]; self.prb[i] = T::two() + self.d1[i];
self.prs[i] = self.prb[i] * self.d1[i] - self.d2[i] * self.d2[i]; self.prs[i] = self.prb[i] * self.d1[i] - self.d2[i].powi(2);
} }
let normg = grad.norm2(); let normg = grad.norm2();
+1
View File
@@ -1,3 +1,4 @@
#![allow(clippy::suspicious_operation_groupings)]
use std::default::Default; use std::default::Default;
use std::fmt::Debug; use std::fmt::Debug;