Skip to content

Commit 1778a92

Browse files
committed
Fix allocations in ntuple
1 parent 38e9024 commit 1778a92

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/arithmetic.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,16 +217,17 @@ end
217217
@inline -(a::STaylor1) = STaylor1(minus_tuple(a.coeffs))
218218

219219
function +(a::STaylor1{N,T}, b::T) where {N, T<:Number}
220-
STaylor1{N,T}(ntuple(i -> i == 1 ? a.coeffs[1] + b : a.coeffs[i], N))
220+
STaylor1{N,T}(ntuple(i -> i == 1 ? a.coeffs[1] + b : a.coeffs[i], Val(N)))
221221
end
222222
function +(b::T, a::STaylor1{N,T}) where {N, T<:Number}
223-
STaylor1{N,T}(ntuple(i -> i == 1 ? a.coeffs[1] + b : a.coeffs[i], N))
223+
STaylor1{N,T}(ntuple(i -> i == 1 ? a.coeffs[1] + b : a.coeffs[i], Val(N)))
224224
end
225225
function -(a::STaylor1{N,T}, b::T) where {N, T<:Number}
226-
STaylor1{N,T}(ntuple(i -> i == 1 ? a.coeffs[1] - b : a.coeffs[i], N))
226+
STaylor1{N,T}(ntuple(i -> i == 1 ? a.coeffs[1] - b : a.coeffs[i], Val(N)))
227227
end
228228
-(b::T, a::STaylor1{N,T}) where {N, T<:Number} = b + (-a)
229229

230+
#+(a::STaylor1{N,T}, b::S) where {N, T<:NumberNotSeries, S<:NumberNotSeries} = +(promote(a,b)...)
230231
#+(a::STaylor1{N,T}, b::STaylor1{N,S}) where {N, T<:NumberNotSeries, S<:NumberNotSeries} = +(promote(a,b)...)
231232
#+(a::STaylor1{N,T}, b::S) where {N, T<:NumberNotSeries, S<:NumberNotSeries} = +(promote(a,b)...)
232233
#+(b::S, a::STaylor1{N,T}) where {N, T<:NumberNotSeries, S<:NumberNotSeries} = +(promote(b,a)...)

0 commit comments

Comments
 (0)