NLPModels.jl icon indicating copy to clipboard operation
NLPModels.jl copied to clipboard

Integrate SparseMatricesCOO

Open dpo opened this issue 3 years ago • 3 comments

dpo avatar Dec 17 '21 20:12 dpo

Should I modify

function jprod!(
  nlp::AbstractNLPModel,
  rows::AbstractVector{<:Integer},
  cols::AbstractVector{<:Integer},
  vals::AbstractVector,
  v::AbstractVector,
  Jv::AbstractVector,
)

to something like

function jprod!(
  nlp::AbstractNLPModel,
  M::SparseMatrixCOO{T, <: Integer},
  v::AbstractVector,
  Jv::AbstractVector,
) where {T}

? This may break a lot of code, but otherwise I would have to use the SparseMatrixCOO constructor at each product.

geoffroyleconte avatar Dec 21 '21 17:12 geoffroyleconte

We should think of a complete integration of SparseMatricesCOO. NLPModels could return sparse Jacobians and Hessians in COO format. Then we need to update methods to update the elements of those matrices. After that, I'm not sure if jprod!(nlp, rows, cols, vals, v, Jv), etc., still make much sense.

dpo avatar Dec 21 '21 20:12 dpo

Maybe a first step along this way, would be to replace the following two functions by SparseMatrixCOO functions:

  • [ ] coo_prod! https://github.com/JuliaSmoothOptimizers/NLPModels.jl/blob/3b5ec8eedf78eaa609447456f69e01f55f0209ca/src/nlp/utils.jl#L76
  • [ ] coo_sym_prod! https://github.com/JuliaSmoothOptimizers/NLPModels.jl/blob/3b5ec8eedf78eaa609447456f69e01f55f0209ca/src/nlp/utils.jl#L99

tmigot avatar Aug 05 '22 13:08 tmigot