Skip to content

Commit

Permalink
fix major bug in CG
Browse files Browse the repository at this point in the history
  • Loading branch information
Jutho committed Sep 3, 2020
1 parent 7b325c1 commit f3891c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "OptimKit"
uuid = "77e91f04-9b3b-57a6-a776-40b61faaebe0"
authors = ["Jutho Haegeman"]
version = "0.1.0"
version = "0.2.0"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
6 changes: 3 additions & 3 deletions src/cg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ function optimize(fg, x, alg::ConjugateGradient;
@info @sprintf("CG: iter %4d: f = %.12f, ‖∇f‖ = %.4e, α = %.2e, β = %.2e, nfg = %d",
numiter, f, normgrad, α, β, nfg)

# increase α for next step
α = 2*α

# transport gprev, ηprev and vectors in Hessian approximation to x
gprev = transport!(gprev, xprev, ηprev, α, x)
if precondition === _precondition
Expand All @@ -94,6 +91,9 @@ function optimize(fg, x, alg::ConjugateGradient;
Pgprev = transport!(Pgprev, xprev, ηprev, α, x)
end
ηprev = transport!(deepcopy(ηprev), xprev, ηprev, α, x)

# increase α for next step
α = 2*α
end
if verbosity > 0
if normgrad <= alg.gradtol
Expand Down

2 comments on commit f3891c9

@Jutho
Copy link
Owner Author

@Jutho Jutho commented on f3891c9 Sep 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/20760

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.0 -m "<description of version>" f3891c9320a38f11dc21afacae16b9db34b6bb11
git push origin v0.2.0

Please sign in to comment.