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

ENH: update num_nnz in getCols regardless #465

Closed
odow opened this issue Feb 17, 2021 · 0 comments · Fixed by #466
Closed

ENH: update num_nnz in getCols regardless #465

odow opened this issue Feb 17, 2021 · 0 comments · Fixed by #466

Comments

@odow
Copy link
Collaborator

odow commented Feb 17, 2021

getCols only updates num_nnz if col_matrix_index or col_matrix_value is not NULL.

if (col_matrix_index != NULL || col_matrix_value != NULL) {
for (int el = lp.Astart_[out_from_col]; el < lp.Astart_[out_to_col + 1];
el++) {
if (col_matrix_index != NULL) col_matrix_index[num_nz] = lp.Aindex_[el];
if (col_matrix_value != NULL) col_matrix_value[num_nz] = lp.Avalue_[el];
num_nz++;
}
}

It should update num_nnz regardless, so that you can call it once to get the number of non-zeros, allocate the correct arrays, and then call it again (ala Gurobi and CPLEX).

This is useful for the Julia interface: jump-dev/HiGHS.jl#38 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant