Skip to content

Commit

Permalink
Expose the nnzJ argument in KN_set_cb_grad. (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
cgeoga authored Jul 20, 2022
1 parent e7be793 commit f61bed3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ function KN_set_cb_grad(
cb::CallbackContext,
gradcallback;
nV::Integer=KN_DENSE,
nnzJ::Integer=(iszero(KNITRO.KN_get_number_cons(m)) ? KNLONG(0) : KNITRO.KN_DENSE_COLMAJOR),
objGradIndexVars=C_NULL,
jacIndexCons=C_NULL,
jacIndexVars=C_NULL,
Expand All @@ -344,7 +345,6 @@ function KN_set_cb_grad(
@assert (objGradIndexVars != C_NULL) && (length(objGradIndexVars) == nV)
end

nnzJ = KNLONG(0)
if jacIndexCons != C_NULL && jacIndexVars != C_NULL
@assert length(jacIndexCons) == length(jacIndexVars)
nnzJ = KNLONG(length(jacIndexCons))
Expand Down Expand Up @@ -372,7 +372,7 @@ function KN_set_cb_grad(
cb,
nV,
objGradIndexVars,
nnzJ,
KNLONG(nnzJ),
jacIndexCons,
jacIndexVars,
c_grad_g
Expand Down

0 comments on commit f61bed3

Please sign in to comment.