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

Buffer checking breaks buffer re-use

Open fredrikekre opened this issue 2 years ago • 0 comments

https://github.com/JuliaLang/julia/pull/40523 introduced buffer checks in the inner constructor which breaks this code:

using SparseArrays

Tv, Ti = Float64, Int
I = Ti[1, 1, 2, 3]
J = Ti[1, 1, 2, 3]
V = zeros(Tv, length(I))
m, n = 3, 3
klasttouch = Vector{Ti}(undef, n)
csrrowptr = Vector{Ti}(undef, m + 1)
csrcolval = Vector{Ti}(undef, length(I))
csrnzval = Vector{Tv}(undef, length(I))

SparseArrays.sparse!(
    I, J, V, m, n, +,
    klasttouch,
    csrrowptr, csrcolval, csrnzval,
    I, J, V
)

Since it seems that we have now settled on not allowing longer buffer vectors the fix seems to automatically resize the vectors, and document that?

fredrikekre avatar Dec 08 '22 22:12 fredrikekre