Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-k committed Nov 3, 2023
1 parent 864cf92 commit 13a39ea
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions argmin/src/solver/conjugategradient/cg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,10 @@ mod tests {

assert_relative_eq!(b[0], 1.0, epsilon = f64::EPSILON);
assert_relative_eq!(b[1], 2.0, epsilon = f64::EPSILON);
let r0 = vec![2.0f64, 2.0];
let r0 = [2.0f64, 2.0];
assert_relative_eq!(r0[0], r.as_ref().unwrap()[0], epsilon = f64::EPSILON);
assert_relative_eq!(r0[1], r.as_ref().unwrap()[1], epsilon = f64::EPSILON);
let pp = vec![-2.0f64, -2.0];
let pp = [-2.0f64, -2.0];
assert_relative_eq!(pp[0], p.as_ref().unwrap()[0], epsilon = f64::EPSILON);
assert_relative_eq!(pp[1], p.as_ref().unwrap()[1], epsilon = f64::EPSILON);
assert_relative_eq!(rtr, 8.0, epsilon = f64::EPSILON);
Expand Down
8 changes: 4 additions & 4 deletions argmin/src/solver/linesearch/morethuente.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ fn cstep<F: ArgminFloat>(
info = 1;
bound = true;
let theta = float!(3.0) * (stx.fx - stp.fx) / (stp.x - stx.x) + stx.gx + stp.gx;
let tmp = vec![theta, stx.gx, stp.gx];
let tmp = [theta, stx.gx, stp.gx];
// Check for a NaN or Inf in tmp before sorting
if tmp.iter().any(|n| n.is_nan() || n.is_infinite()) {
return Err(argmin_error!(
Expand Down Expand Up @@ -578,7 +578,7 @@ fn cstep<F: ArgminFloat>(
info = 2;
bound = false;
let theta = float!(3.0) * (stx.fx - stp.fx) / (stp.x - stx.x) + stx.gx + stp.gx;
let tmp = vec![theta, stx.gx, stp.gx];
let tmp = [theta, stx.gx, stp.gx];
// Check for a NaN or Inf in tmp before sorting
if tmp.iter().any(|n| n.is_nan() || n.is_infinite()) {
return Err(argmin_error!(
Expand Down Expand Up @@ -612,7 +612,7 @@ fn cstep<F: ArgminFloat>(
info = 3;
bound = true;
let theta = float!(3.0) * (stx.fx - stp.fx) / (stp.x - stx.x) + stx.gx + stp.gx;
let tmp = vec![theta, stx.gx, stp.gx];
let tmp = [theta, stx.gx, stp.gx];
// Check for a NaN or Inf in tmp before sorting
if tmp.iter().any(|n| n.is_nan() || n.is_infinite()) {
return Err(argmin_error!(
Expand Down Expand Up @@ -662,7 +662,7 @@ fn cstep<F: ArgminFloat>(
bound = false;
if brackt {
let theta = float!(3.0) * (stp.fx - sty.fx) / (sty.x - stp.x) + sty.gx + stp.gx;
let tmp = vec![theta, sty.gx, stp.gx];
let tmp = [theta, sty.gx, stp.gx];
// Check for a NaN or Inf in tmp before sorting
if tmp.iter().any(|n| n.is_nan() || n.is_infinite()) {
return Err(argmin_error!(
Expand Down
4 changes: 2 additions & 2 deletions argmin/src/solver/particleswarm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ where

let mut particles = positions
.into_iter()
.zip(velocities.into_iter())
.zip(costs.into_iter())
.zip(velocities)
.zip(costs)
.map(|((p, v), c)| Particle::new(p, c, v))
.collect::<Vec<_>>();

Expand Down

0 comments on commit 13a39ea

Please sign in to comment.