Skip to content

Commit

Permalink
🤖 Format .jl files (#280)
Browse files Browse the repository at this point in the history
Co-authored-by: amontoison <[email protected]>
  • Loading branch information
github-actions[bot] and amontoison authored Oct 6, 2024
1 parent 53a9419 commit 1b47782
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/JSOSolvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Notably, you can access, and modify, the following:
- `stats.elapsed_time`: elapsed time in seconds.
"


"""
normM!(n, x, M, z)
Expand All @@ -37,7 +36,7 @@ function normM!(n, x, M, z)
return nrm2(n, x)
else
mul!(z, M, x)
return (xz)
return (x z)
end
end

Expand Down
12 changes: 6 additions & 6 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,17 @@ end
x0 = [-1.2; 1.0]
nlp = ADNLPModel(x -> 100 * (x[2] - x[1]^2)^2 + (x[1] - 1)^2, x0)
function DiagPrecon(x)
H = Matrix(hess(nlp, x))
λmin = minimum(eigvals(H))
Diagonal(H + λmin * I)
end
H = Matrix(hess(nlp, x))
λmin = minimum(eigvals(H))
Diagonal(H + λmin * I)
end
M = DiagPrecon(x0)
function LinearAlgebra.ldiv!(y, M::Diagonal, x)
y .= M \ x
end
function callback(nlp, solver, stats)
M[:] = DiagPrecon(solver.x)
end
stats = trunk(nlp, callback=callback, M=M)
stats = trunk(nlp, callback = callback, M = M)
@test stats.status == :first_order
end
end

0 comments on commit 1b47782

Please sign in to comment.