Skip to content

Commit

Permalink
🤖 Format .jl files
Browse files Browse the repository at this point in the history
  • Loading branch information
abelsiqueira committed Jul 2, 2021
1 parent 2ba6bad commit b57e37c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
7 changes: 6 additions & 1 deletion src/nls/problems/lls.jl
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,12 @@ function NLPModels.hess_structure!(nls::LLS, rows::AbstractVector{Int}, cols::Ab
return rows, cols
end

function NLPModels.hess_coord!(nls::LLS{T, S}, x::AbstractVector{T}, vals::AbstractVector; obj_weight :: T = one(T)) where {T, S}
function NLPModels.hess_coord!(
nls::LLS{T, S},
x::AbstractVector{T},
vals::AbstractVector;
obj_weight::T = one(T),
) where {T, S}
@lencheck 2 x
@lencheck 2 vals
vals .= [2obj_weight; 3obj_weight]
Expand Down
19 changes: 15 additions & 4 deletions src/nls/problems/nlshs20.jl
Original file line number Diff line number Diff line change
Expand Up @@ -183,17 +183,28 @@ function NLPModels.jtprod!(nls::NLSHS20, x::AbstractVector, v::AbstractVector, J
return Jtv
end

function NLPModels.hess(nls :: NLSHS20, x :: AbstractVector{T}; obj_weight=1.0) where T
function NLPModels.hess(nls::NLSHS20, x::AbstractVector{T}; obj_weight = 1.0) where {T}
@lencheck 2 x
increment!(nls, :neval_hess)
return Symmetric(obj_weight * [T(1)-200*x[2]+600*x[1]^2 T(0);-200*x[1] T(100)], :L)
return Symmetric(obj_weight * [T(1) - 200 * x[2]+600 * x[1]^2 T(0); -200*x[1] T(100)], :L)
end

function NLPModels.hess(nls :: NLSHS20, x :: AbstractVector{T}, y :: AbstractVector{T}; obj_weight=1.0) where T
function NLPModels.hess(
nls::NLSHS20,
x::AbstractVector{T},
y::AbstractVector{T};
obj_weight = 1.0,
) where {T}
@lencheck 2 x
@lencheck 3 y
increment!(nls, :neval_hess)
return Symmetric([obj_weight*(T(1)-200*x[2]+600*x[1]^2)+2*y[2]+2*y[3] T(0);-obj_weight*200*x[1] obj_weight*T(100)+2*y[1]+2*y[3]], :L)
return Symmetric(
[
obj_weight*(T(1) - 200 * x[2] + 600 * x[1]^2)+2*y[2]+2*y[3] T(0)
-obj_weight*200*x[1] obj_weight*T(100)+2*y[1]+2*y[3]
],
:L,
)
end

function NLPModels.hess_structure!(
Expand Down
13 changes: 9 additions & 4 deletions src/nls/problems/nlslc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -216,17 +216,22 @@ function NLPModels.jtprod!(nls::NLSLC, x::AbstractVector, v::AbstractVector, Jtv
return Jtv
end

function NLPModels.hess(nls :: NLSLC, x :: AbstractVector{T}; obj_weight=1.0) where T
function NLPModels.hess(nls::NLSLC, x::AbstractVector{T}; obj_weight = 1.0) where {T}
@lencheck 15 x
increment!(nls, :neval_hess)
return Symmetric(obj_weight * diagm(0 => [6*x[i]^2-2*i^2 for i=1:15]), :L)
return Symmetric(obj_weight * diagm(0 => [6 * x[i]^2 - 2 * i^2 for i = 1:15]), :L)
end

function NLPModels.hess(nls :: NLSLC, x :: AbstractVector{T}, y :: AbstractVector{T}; obj_weight=1.0) where T
function NLPModels.hess(
nls::NLSLC,
x::AbstractVector{T},
y::AbstractVector{T};
obj_weight = 1.0,
) where {T}
@lencheck 15 x
@lencheck 11 y
increment!(nls, :neval_hess)
return Symmetric(hess(nls, x, obj_weight=obj_weight), :L)
return Symmetric(hess(nls, x, obj_weight = obj_weight), :L)
end

function NLPModels.hess_structure!(nls::NLSLC, rows::AbstractVector{Int}, cols::AbstractVector{Int})
Expand Down

2 comments on commit b57e37c

@abelsiqueira
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator register()

@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/40128

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.4.0 -m "<description of version>" b57e37c5e9a2c824900f9ebd22a8f24a1fb4b36f
git push origin v0.4.0

Please sign in to comment.