From 9744b27514a3e4c839b4f8e9d4ea9461e645659c Mon Sep 17 00:00:00 2001 From: Vedant Puri Date: Wed, 6 Mar 2024 12:22:58 -0500 Subject: [PATCH] sum --- src/linear_algebra.jl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/linear_algebra.jl b/src/linear_algebra.jl index 6c2efedb..85788bb8 100644 --- a/src/linear_algebra.jl +++ b/src/linear_algebra.jl @@ -57,3 +57,14 @@ function LinearAlgebra.axpby!(α::Number, x::ComponentArray, β::Number, y::Comp axpby!(α, getdata(x), β, getdata(y)) return ComponentArray(y, getaxes(y)) end + +# Base.sum! +function Base.sum!(f::Function, r::ComponentArray, A::AbstractArray; init::Bool = true) + sum!(f, getdata(r), A; init) +end +function Base.sum!(f::Function, r::AbstractArray, A::ComponentArray; init::Bool = true) + sum!(f, getdata(r), getdata(A); init) +end +function Base.sum!(f::Function, r::ComponentArray, A::ComponentArray; init::Bool = true) + sum!(f, getdata(r), getdata(A); init) +end