diff --git a/src/nls/problems/lls.jl b/src/nls/problems/lls.jl index 2cb7c7a..a18c996 100644 --- a/src/nls/problems/lls.jl +++ b/src/nls/problems/lls.jl @@ -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] diff --git a/src/nls/problems/nlshs20.jl b/src/nls/problems/nlshs20.jl index 39d0bcd..44f7e2c 100644 --- a/src/nls/problems/nlshs20.jl +++ b/src/nls/problems/nlshs20.jl @@ -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!( diff --git a/src/nls/problems/nlslc.jl b/src/nls/problems/nlslc.jl index 808e617..244746f 100644 --- a/src/nls/problems/nlslc.jl +++ b/src/nls/problems/nlslc.jl @@ -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})