-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
NDimensionalSparseArrays.jl/src/ndsparsearray.jl
Lines 489 to 499 in 6fde3dc
# In-place arithmetic operations | |
# Julia doesn't have += as a base function - it's syntax sugar for a = a + b | |
# We'll create optimized in-place functions that users can call directly | |
""" | |
add!(A::NDSparseArray, B::NDSparseArray) | |
In-place addition of sparse array `B` to sparse array `A`. | |
Modifies `A` and returns it. More efficient than `A = A + B`. | |
""" | |
function add!(A::NDSparseArray{T, N}, B::NDSparseArray{S, N}) where {T, S, N} |
Instead of introducing new functions, you could implement MutableArithmetics.jl for NDSparseArray
. That would allow more interoperability, as code that makes use of MutableArithmetics would benefit from the in-place optimizations you implement without having to know about your package.
Metadata
Metadata
Assignees
Labels
No labels