diff --git a/src/SparseMatrixCOO.jl b/src/SparseMatrixCOO.jl index 2c4d692..d3c3ebf 100644 --- a/src/SparseMatrixCOO.jl +++ b/src/SparseMatrixCOO.jl @@ -103,8 +103,8 @@ end findnz(coo::SparseMatrixCOO) = (coo.is, coo.js, coo.vs) isdense(::SparseMatrixCOO) = false -function Base.setindex!(coo::SparseMatrixCOO{Tv,Ti}, v, i::Ti, j::Ti) where {Tv,Ti} - (1 <= i <= coo.m) && (1 <= j <= coo.n) || throw(BoundsError(coo, (i, j))) +Base.@propagate_inbounds function Base.setindex!(coo::SparseMatrixCOO{Tv,Ti}, v, i::Ti, j::Ti) where {Tv,Ti} + @boundscheck (1 <= i <= coo.m) && (1 <= j <= coo.n) || throw(BoundsError(coo, (i, j))) push!(coo.is, i) push!(coo.js, j)