Because of the linear API, the cost of the function jac_structure! is now prohibitive for large scale problems.
If we have as much linear constraints as nonlinear constraints, we need 2 * (ncon / 2)^2 comparisons (hidden in the calls to count).
|
function jac_structure!( |
|
nlp::AbstractNLPModel, |
|
rows::AbstractVector{T}, |
|
cols::AbstractVector{T}, |
|
) where {T} |
|
@lencheck nlp.meta.nnzj rows cols |
|
lin_ind = 1:(nlp.meta.lin_nnzj) |
|
if nlp.meta.nlin > 0 |
|
if nlp.meta.nnln == 0 |
|
jac_lin_structure!(nlp, rows, cols) |
|
else |
|
jac_lin_structure!(nlp, view(rows, lin_ind), view(cols, lin_ind)) |
|
for i in lin_ind |
|
rows[i] += count(x < nlp.meta.lin[rows[i]] for x in nlp.meta.nln) |
|
end |
|
end |
|
end |
|
if nlp.meta.nnln > 0 |
|
if nlp.meta.nlin == 0 |
|
jac_nln_structure!(nlp, rows, cols) |
|
else |
|
nln_ind = (nlp.meta.lin_nnzj + 1):(nlp.meta.lin_nnzj + nlp.meta.nln_nnzj) |
|
jac_nln_structure!(nlp, view(rows, nln_ind), view(cols, nln_ind)) |
|
for i in nln_ind |
|
rows[i] += count(x < nlp.meta.nln[rows[i]] for x in nlp.meta.lin) |
|
end |
|
end |
|
end |
|
return rows, cols |
|
end |
Because of the linear API, the cost of the function
jac_structure!is now prohibitive for large scale problems.If we have as much linear constraints as nonlinear constraints, we need
2 * (ncon / 2)^2comparisons (hidden in the calls tocount).NLPModels.jl/src/nlp/api.jl
Lines 192 to 221 in ac1213a