From 7679454fc8fe37d2823ff88093d073f0ed53973b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Fri, 14 Jun 2024 12:02:24 +0200 Subject: [PATCH] Fixes --- src/arithmetic.jl | 5 +++++ test/test_example_acoeffs.jl | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/arithmetic.jl b/src/arithmetic.jl index b2f078e..b78bf49 100644 --- a/src/arithmetic.jl +++ b/src/arithmetic.jl @@ -133,3 +133,8 @@ function unsafe_push!(a::SparseArrays.SparseVector, k, v) a[k] = MA.add!!(a[k], v) return a end + +function unsafe_push!(a::Vector, k, v) + a[k] = MA.add!!(a[k], v) + return a +end diff --git a/test/test_example_acoeffs.jl b/test/test_example_acoeffs.jl index 2c9272f..60d5291 100644 --- a/test/test_example_acoeffs.jl +++ b/test/test_example_acoeffs.jl @@ -25,3 +25,7 @@ end # the default arithmetic implementation uses this access Base.getindex(ac::ACoeffs, idx) = ac.vals[idx] Base.setindex!(ac::ACoeffs, val, idx) = ac.vals[idx] = val +function SA.unsafe_push!(ac::ACoeffs, idx, val) + ac.vals[idx] = val + return ac +end