Skip to content
This repository was archived by the owner on Nov 23, 2018. It is now read-only.

Commit 73ec231

Browse files
committed
Invert an if check in LinesearchMethod
1 parent 7ddb87b commit 73ec231

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

linesearch.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,11 @@ func (ls *LinesearchMethod) Iterate(loc *Location) (Operation, error) {
118118
panic("linesearch: Linesearcher returned invalid operation")
119119
}
120120

121-
if step != ls.lastStep {
121+
if step == ls.lastStep {
122+
// Linesearcher is requesting another evaluation at the same point
123+
// which is stored in ls.loc.X.
124+
copy(loc.X, ls.loc.X)
125+
} else {
122126
// We are moving to a new location.
123127

124128
// Compute the next evaluation point and store it in loc.X.
@@ -133,10 +137,6 @@ func (ls *LinesearchMethod) Iterate(loc *Location) (Operation, error) {
133137
ls.lastStep = step
134138
copy(ls.loc.X, loc.X) // Move ls.loc to the next evaluation point
135139
ls.eval = NoOperation // and invalidate all its fields.
136-
} else {
137-
// Linesearcher is requesting another evaluation at the same point
138-
// which is stored in ls.loc.X.
139-
copy(loc.X, ls.loc.X)
140140
}
141141

142142
ls.lastOp = op

0 commit comments

Comments
 (0)