Skip to content

Commit 4c65171

Browse files
committed
More comments
1 parent c0ca600 commit 4c65171

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/Nonlinear/operators.jl

+5-4
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,7 @@ end
625625

626626
_nan_to_zero(x) = isnan(x) ? 0.0 : x
627627

628+
# No docstring because this function is still a WIP.
628629
function eval_multivariate_hessian(
629630
registry::OperatorRegistry,
630631
op::Symbol,
@@ -657,8 +658,8 @@ function eval_multivariate_hessian(
657658
# ∇f(x) = x[2]*x[1]^(x[2]-1)
658659
# x[1]^x[2]*log(x[1])
659660
#
660-
# ∇²f(x) = x[2]*(x[2]-1)*x[1]^(x[2]-2) x[1]^(x[2]-1)*(x[2]*log(x[1])+1)
661-
# . x[1]^x[2]*log(x[1])^2
661+
# ∇²f(x) = x[2]*(x[2]-1)*x[1]^(x[2]-2)
662+
# x[1]^(x[2]-1)*(x[2]*log(x[1])+1) x[1]^x[2]*log(x[1])^2
662663
ln = x[1] > 0 ? log(x[1]) : NaN
663664
if x[2] == one(T)
664665
H[2, 1] = _nan_to_zero(ln + one(T))
@@ -678,8 +679,8 @@ function eval_multivariate_hessian(
678679
# ∇f(x) = 1/x[2]
679680
# -x[1]/x[2]^2
680681
#
681-
# ∇²(x) = 0.0 -1/x[2]^2
682-
# . 2x[1]/x[2]^3
682+
# ∇²(x) = 0.0
683+
# -1/x[2]^2 2x[1]/x[2]^3
683684
d = 1 / x[2]^2
684685
H[2, 1] = -d
685686
H[2, 2] = 2 * x[1] * d / x[2]

src/Nonlinear/types.jl

+2
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ mutable struct NonlinearData <: MOI.AbstractNLPEvaluator
151151
last_constraint_index::Int64
152152
# Fields for initialize
153153
julia_expressions::Vector{Any} # Any because expressions may be constants
154+
# ordered_constraints is needed because `OrderedDict` doesn't support
155+
# looking up a key by the linear index.
154156
ordered_constraints::Vector{ConstraintIndex}
155157
constraint_dual::Vector{Float64}
156158
# Timers

0 commit comments

Comments
 (0)