Skip to content

Commit

Permalink
🤖 Format .jl files (#288)
Browse files Browse the repository at this point in the history
Co-authored-by: tmigot <[email protected]>
  • Loading branch information
github-actions[bot] and tmigot authored Aug 6, 2024
1 parent 71ee496 commit 725413c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
22 changes: 12 additions & 10 deletions src/ad.jl
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,12 @@ function ADModelNLSBackend(

JBLS = jacobian_residual_backend
b = @elapsed begin
jacobian_residual_backend = if jacobian_residual_backend isa Union{AbstractNLPModel, ADBackend}
jacobian_residual_backend
else
JBLS(nvar, x -> zero(eltype(x)), nequ, F!; kwargs...)
end
jacobian_residual_backend =
if jacobian_residual_backend isa Union{AbstractNLPModel, ADBackend}
jacobian_residual_backend
else
JBLS(nvar, x -> zero(eltype(x)), nequ, F!; kwargs...)
end
end
show_time && println("jacobian_residual backend $JBLS: $b seconds;")

Expand Down Expand Up @@ -466,11 +467,12 @@ function ADModelNLSBackend(

JBLS = jacobian_residual_backend
b = @elapsed begin
jacobian_residual_backend = if jacobian_residual_backend isa Union{AbstractNLPModel, ADBackend}
jacobian_residual_backend
else
JBLS(nvar, x -> zero(eltype(x)), nequ, F!; kwargs...)
end
jacobian_residual_backend =
if jacobian_residual_backend isa Union{AbstractNLPModel, ADBackend}
jacobian_residual_backend
else
JBLS(nvar, x -> zero(eltype(x)), nequ, F!; kwargs...)
end
end
show_time && println("jacobian_residual backend $JBLS: $b seconds;")

Expand Down
15 changes: 12 additions & 3 deletions test/manual.jl
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,11 @@ end
lcon = ucon = zeros(1)
adbackend = ADNLPModels.ADModelBackend(nvar, f, ncon, c!)
nlp = ADNLPModel!(
f, x0, c!, lcon, ucon,
f,
x0,
c!,
lcon,
ucon,
gradient_backend = adbackend.gradient_backend,
hprod_backend = adbackend.hprod_backend,
hessian_backend = adbackend.hessian_backend,
Expand Down Expand Up @@ -240,7 +244,12 @@ end
x0 = zeros(nvar)
adbackend = ADNLPModels.ADModelNLSBackend(nvar, F!, nequ, ncon, c!)
nlp = ADNLSModel!(
F!, x0, nequ, c!, lcon, ucon,
F!,
x0,
nequ,
c!,
lcon,
ucon,
gradient_backend = adbackend.gradient_backend,
hprod_backend = adbackend.hprod_backend,
hessian_backend = adbackend.hessian_backend,
Expand All @@ -255,4 +264,4 @@ end
hessian_residual_backend = adbackend.hessian_residual_backend,
)
test_nlp_consistency(nlp, nlp; counters = false)
end
end

0 comments on commit 725413c

Please sign in to comment.