I am building sparse matrices with the same sparsity pattern. The function sparse(...) represent 90% of the computation time, the rest being a linear solve.

I am wondering if sparse! could help this but I did not find any example of its use.

Let me explain what my goal is so that other might benefit from it.

What I am trying to improve is in fact a bit more sophisticated. I presume it is a sparse version of what is explained in the beginning of the docs of BlockArrays.jl.

In my package PseudoArcLengthContinuation.jl, I create a Block matrix with some sparse blocks in the function JacobianPeriodicFD.

Then, at line 137, I create a sparse matrix version of the Block matrix in order to solve a linear problem associated to it. This line 137, makes up for most of the computational cost. I will try to replace it using sparse! or the trick by @bennedich.