From 28c2ca0c712fdf7c7cfc3a0386bc8ba4a32ad046 Mon Sep 17 00:00:00 2001 From: Luis Benet Date: Tue, 5 Dec 2023 21:15:50 -0600 Subject: [PATCH] Implement suggestions by @PerezHz --- src/arithmetic.jl | 8 ++++---- src/auxiliary.jl | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/arithmetic.jl b/src/arithmetic.jl index 1b35c556..e8f9e1ae 100644 --- a/src/arithmetic.jl +++ b/src/arithmetic.jl @@ -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 @@ -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) @@ -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 @@ -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} diff --git a/src/auxiliary.jl b/src/auxiliary.jl index f862b612..fd0406f5 100644 --- a/src/auxiliary.jl +++ b/src/auxiliary.jl @@ -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)