Skip to content

Commit

Permalink
Issue 403c (#419)
Browse files Browse the repository at this point in the history
* avoid invalidation; warning with v1.8

* push off warning removal for another day
  • Loading branch information
jverzani authored Jun 2, 2022
1 parent d1782dc commit a563487
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,7 @@ end

return quote
Base.@_inline_meta
#Base.@inline
tuple($(exprs...))
end

Expand Down
6 changes: 4 additions & 2 deletions src/polynomials/ImmutablePolynomial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ LinearAlgebra.norm(q::ImmutablePolynomial, p::Real) = _norm(q.coeffs, p)
end

return quote
$(Expr(:meta, :inline))
$(Expr(:meta, :inline)) # 1.8 deprecation
#Base.@inline
@inbounds return sqrt($expr)
end

Expand All @@ -259,7 +260,8 @@ _norm_p0(x) = iszero(x) ? zero(x) : one(x)
end

return quote
$(Expr(:meta, :inline))
$(Expr(:meta, :inline)) # 1.8 deprecation
#Base.@inline
if p == Inf
return mapreduce(abs, max, a)
elseif p == 1
Expand Down
8 changes: 5 additions & 3 deletions src/polynomials/pi_n_polynomial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ Polynomials.@register PnPolynomial
# change broadcast semantics
Base.broadcastable(p::PnPolynomial) = p.coeffs;
Base.ndims(::Type{<:PnPolynomial}) = 1
Base.copyto!(p::PnPolynomial, x) = copyto!(p.coeffs, x);
Base.copyto!(p::PnPolynomial{T, X}, x::S) where
{T, X,
S<:Union{AbstractVector, Base.AbstractBroadcasted, Tuple} # to avoid an invalidation. Might need to be more general?
} = copyto!(p.coeffs, x)

function Polynomials.degree(p::PnPolynomial)
i = findlast(!iszero, p.coeffs)
Expand All @@ -43,9 +46,8 @@ function LinearAlgebra.mul!(pq, p::PnPolynomial{T,X}, q) where {T,X}
for i 0:m
for j 0:n
k = i + j
pq.coeffs[1+k] += p.coeffs[1+i] * q.coeffs[1+j]
@inbounds pq.coeffs[1+k] += p.coeffs[1+i] * q.coeffs[1+j]
end
end
nothing
end

2 changes: 1 addition & 1 deletion src/polynomials/standard-basis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ end
end

return quote
Base.@_inline_meta
Base.@_inline_meta # 1.8 deprecation
tuple($(exprs...))
end

Expand Down

0 comments on commit a563487

Please sign in to comment.