Run cargo clippy --fix (#250)
* Run `cargo clippy --fix` * Run `cargo clippy --all-features --fix` * Fix other clippy warnings * cargo fmt Co-authored-by: Luis Moreno <morenol@users.noreply.github.com>
This commit is contained in:
@@ -113,12 +113,13 @@ mod tests {
|
||||
g[1] = 200. * (x[1] - x[0].powf(2.));
|
||||
};
|
||||
|
||||
let mut ls: Backtracking<f64> = Default::default();
|
||||
ls.order = FunctionOrder::THIRD;
|
||||
let ls: Backtracking<f64> = Backtracking::<f64> {
|
||||
order: FunctionOrder::THIRD,
|
||||
..Default::default()
|
||||
};
|
||||
let optimizer: GradientDescent = Default::default();
|
||||
|
||||
let result = optimizer.optimize(&f, &df, &x0, &ls);
|
||||
println!("{:?}", result);
|
||||
|
||||
assert!((result.f_x - 0.0).abs() < 1e-5);
|
||||
assert!((result.x[0] - 1.0).abs() < 1e-2);
|
||||
|
||||
@@ -196,9 +196,9 @@ impl LBFGS {
|
||||
}
|
||||
|
||||
///
|
||||
fn update_hessian<'a, T: FloatNumber, X: Array1<T>>(
|
||||
fn update_hessian<T: FloatNumber, X: Array1<T>>(
|
||||
&self,
|
||||
_: &'a DF<'_, X>,
|
||||
_: &DF<'_, X>,
|
||||
state: &mut LBFGSState<T, X>,
|
||||
) {
|
||||
state.dg = state.x_df.sub(&state.x_df_prev);
|
||||
@@ -291,8 +291,10 @@ mod tests {
|
||||
g[0] = -2. * (1. - x[0]) - 400. * (x[1] - x[0].powf(2.)) * x[0];
|
||||
g[1] = 200. * (x[1] - x[0].powf(2.));
|
||||
};
|
||||
let mut ls: Backtracking<f64> = Default::default();
|
||||
ls.order = FunctionOrder::THIRD;
|
||||
let ls: Backtracking<f64> = Backtracking::<f64> {
|
||||
order: FunctionOrder::THIRD,
|
||||
..Default::default()
|
||||
};
|
||||
let optimizer: LBFGS = Default::default();
|
||||
|
||||
let result = optimizer.optimize(&f, &df, &x0, &ls);
|
||||
|
||||
Reference in New Issue
Block a user