diff --git a/src/TaylorSeries.jl b/src/TaylorSeries.jl index 8df08885..d8e446a5 100644 --- a/src/TaylorSeries.jl +++ b/src/TaylorSeries.jl @@ -40,7 +40,7 @@ import Base: iterate, size, eachindex, firstindex, lastindex, eltype, length, getindex, setindex!, axes, copyto! import Base: zero, one, zeros, ones, isinf, isnan, iszero, isless, - convert, promote_rule, promote, show, + convert, promote_rule, promote, show, sum!, real, imag, conj, adjoint, rem, mod, mod2pi, abs, abs2, sqrt, exp, expm1, log, log1p, diff --git a/src/arithmetic.jl b/src/arithmetic.jl index e44a856a..d822d7c4 100644 --- a/src/arithmetic.jl +++ b/src/arithmetic.jl @@ -405,6 +405,27 @@ for (f, fc) in ((:+, :(add!)), (:-, :(subst!))) end end +for T in (:Taylor1, :TaylorN) + @eval begin + function sum!(v::$T{S}, a::AbstractArray{$T{S}}) where {S <: Number} + for i in eachindex(a) + for k in eachindex(v) + add!(v, v, a[i], k) + end + end + return nothing + end + end +end + +function sum!(v::TaylorN{S}, a::AbstractArray{HomogeneousPolynomial{S}}) where {S <: Number} + for i in eachindex(a) + for k in eachindex(v) + add!(v, v, a[i], k) + end + end + return nothing +end ## Multiplication ## for T in (:Taylor1, :HomogeneousPolynomial, :TaylorN)