Skip to content

Commit

Permalink
Implement suggestions by @PerezHz
Browse files Browse the repository at this point in the history
  • Loading branch information
lbenet committed Dec 6, 2023
1 parent 0c5c8c0 commit 28c2ca0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/arithmetic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ end

function ==(a::Taylor1{TaylorN{T}}, b::TaylorN{Taylor1{S}}) where {T, S}
R = promote_type(T, S)
return a == convert(Taylor1{TaylorN{S}}, b)
return a == convert(Taylor1{TaylorN{R}}, b)
end
==(b::TaylorN{Taylor1{S}}, a::Taylor1{TaylorN{T}}) where {T, S} = a == b

Expand Down Expand Up @@ -465,7 +465,7 @@ function *(a::Taylor1{TaylorN{T}}, b::Taylor1{TaylorN{S}}) where
end

function *(a::Taylor1{TaylorN{T}}, b::Taylor1{TaylorN{T}}) where {T<:NumberNotSeries}
if (a.order != b.order) || any(get_order.(a[:]) .!= get_order.(b[:]))
if (a.order != b.order) || any(get_order.(a.coeffs) .!= get_order.(b.coeffs))
a, b = fixorder(a, b)
end
res = Taylor1(zero(a[0]), a.order)
Expand Down Expand Up @@ -677,7 +677,7 @@ end

function /(a::Taylor1{TaylorN{T}}, b::Taylor1{TaylorN{T}}) where {T<:NumberNotSeries}
iszero(a) && !iszero(b) && return zero(a)
if (a.order != b.order) || any(get_order.(a[:]) .!= get_order.(b[:]))
if (a.order != b.order) || any(get_order.(a.coeffs) .!= get_order.(b.coeffs))
a, b = fixorder(a, b)
end

Expand Down Expand Up @@ -774,7 +774,7 @@ div!(v::Taylor1, b::NumberNotSeries, a::Taylor1, k::Int) =
return nothing
end

# NOTE: Here `div!` *accumulates* the result of a / b in c[k] (k > 0)
# NOTE: Here `div!` *accumulates* the result of a / b in res[k] (k > 0)
@inline function div!(res::Taylor1{TaylorN{T}}, a::Taylor1{TaylorN{T}},
b::Taylor1{TaylorN{T}}, ordT::Int) where {T<:NumberNotSeriesN}

Expand Down
2 changes: 1 addition & 1 deletion src/auxiliary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ end
for T in (:HomogeneousPolynomial, :TaylorN)
@eval function fixorder(a::Taylor1{$T{T}}, b::Taylor1{$T{S}}) where
{T<:NumberNotSeries, S<:NumberNotSeries}
(a.order == b.order) && (all(get_order.(a[:]) .== get_order.(b[:]))) && return a, b
(a.order == b.order) && (all(get_order.(a.coeffs) .== get_order.(b.coeffs))) && return a, b
minordT = _minorder(a, b)
aa = Taylor1(copy(a.coeffs), minordT)
bb = Taylor1(copy(b.coeffs), minordT)
Expand Down

0 comments on commit 28c2ca0

Please sign in to comment.