h=jac\x</code></pre><p>However, without a priori information on sparsity, ForwardDiff calls element insertion for the full range of n^2 indices, leading to a O(n^2) scaling behavior due to the nevertheless necessary search operations, see this <a href="https://discourse.julialang.org/t/non-sorted-sparsematrixcsc/37133">discourse thread</a>.</p><p><strong>updateindex!</strong></p><p>In addition, the package provides a method <code>updateindex!(A,op,v,i,j)</code> for both <code>SparseMatrixCSC</code> and for <code>ExtendableSparse</code> which allows to update a matrix element with one index search instead of two. It allows to replace e.g. <code>A[i,j]+=v</code> by <code>updateindex!(A,+,v,i,j)</code>. The former operation is lowered to</p><pre><code class="language-julia hljs">%1 = Base.getindex(A, 1, 2)
0 commit comments