Open albertomercurio opened 5 months ago
It’s useful to keep it mutable because in optimization, a Hessian or Jacobian often retains the same sparsity pattern; only the nonzero values change from one iteration to the next. That is what happens in NLPModels.jl.
But than one can still change the vals
vector inplace. The struct would be immutable, but the vectors inside not. Even for the SparseMatrixCSC
I can update its nonzero values.
Well, yes, I suppose you're right. Do you need the struct to be immutable for a special reason? Or just for uniformity with SparseMatrixCSC?
Yes, for sure because of uniformity. But also because immutable structs would be also faster AFAIK.
Sounds good. Would you like to submit a PR?
Yes, why not. When I will have some free time I will do it.
Hello,
looking at the code I noticed that the
SparseMatrixCOO
constructor is mutable, while theSparseMatrixCSC
one is not.I think that it can be safely converted into immutable. Am I wrong?