fix needless-range and clippy::ptr_arg warnings. (#36)

* Fix needless for loop range

* Do not ignore clippy::ptr_arg
This commit is contained in:
morenol
2020-12-11 16:52:39 -04:00
committed by GitHub
parent 2650416235
commit 53351b2ece
27 changed files with 208 additions and 219 deletions
+3 -3
View File
@@ -85,9 +85,9 @@ pub trait BiconjugateGradientSolver<T: RealNumber, M: Matrix<T>> {
let diag = Self::diag(a);
let n = diag.len();
for i in 0..n {
if diag[i] != T::zero() {
x.set(i, 0, b.get(i, 0) / diag[i]);
for (i, diag_i) in diag.iter().enumerate().take(n) {
if *diag_i != T::zero() {
x.set(i, 0, b.get(i, 0) / *diag_i);
} else {
x.set(i, 0, b.get(i, 0));
}