Skip to content

Commit

Permalink
optimal-linesearch: fix fixed step-size optimizer
Browse files Browse the repository at this point in the history
  • Loading branch information
justinlovinger committed Jan 12, 2024
1 parent 4397667 commit 6e10bcb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions optimal-linesearch/src/fixed_step_size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
//! ```

use std::{
ops::{Mul, RangeInclusive, SubAssign},
ops::{AddAssign, Mul, RangeInclusive},
sync::Arc,
};

Expand Down Expand Up @@ -177,7 +177,7 @@ impl<A> Config<A> {

impl<A, D> StreamingIterator for FixedStepSize<A, D>
where
A: Clone + SubAssign + Mul<Output = A>,
A: Clone + AddAssign + Mul<Output = A>,
D: StepDirection<Elem = A, Point = Arc<Vec<A>>>,
{
type Item = Self;
Expand All @@ -195,7 +195,7 @@ where
point
.iter_mut()
.zip(step_direction.step_direction)
.for_each(|(x, d)| *x -= self.config.step_size.clone() * d);
.for_each(|(x, d)| *x += self.config.step_size.clone() * d);
State::Stepped { point }
}
None => State::GettingStepDirection { point },
Expand Down

0 comments on commit 6e10bcb

Please sign in to comment.