Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose the nnzJ argument in KN_set_cb_grad. #226

Merged
merged 2 commits into from
Jul 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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