Skip to content

Inference in Chebyshev/Ultraspherical conversion #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 14, 2022

Conversation

jishnub
Copy link
Member

@jishnub jishnub commented Aug 14, 2022

This improves the type inference, as the result becomes a union of concrete types.
Master:

julia> @code_warntype Conversion(Chebyshev(), Ultraspherical(1))
MethodInstance for Conversion(::Chebyshev{ChebyshevInterval{Float64}, Float64}, ::Ultraspherical{Int64, ChebyshevInterval{Float64}, Float64})
  from Conversion(A::Chebyshev, B::Ultraspherical) in ApproxFunOrthogonalPolynomials at /home/jishnu/Dropbox/JuliaPackages/ApproxFunOrthogonalPolynomials.jl/src/Spaces/Ultraspherical/UltrasphericalOperators.jl:120
Arguments
  #self#::Type{Conversion}
  A::Core.Const(Chebyshev())
  B::Ultraspherical{Int64, ChebyshevInterval{Float64}, Float64}
Locals
  US::Ultraspherical{Int64, ChebyshevInterval{Float64}, Float64}
  d::ChebyshevInterval{Float64}
Body::Union{ApproxFunBase.ConcreteConversion{Chebyshev{ChebyshevInterval{Float64}, Float64}, Ultraspherical{Int64, ChebyshevInterval{Float64}, Float64}, Float64}, ApproxFunBase.ConversionWrapper}

This PR:

julia> @code_warntype Conversion(Chebyshev(), Ultraspherical(1))
MethodInstance for Conversion(::Chebyshev{ChebyshevInterval{Float64}, Float64}, ::Ultraspherical{Int64, ChebyshevInterval{Float64}, Float64})
  from Conversion(A::Chebyshev, B::Ultraspherical) in ApproxFunOrthogonalPolynomials at /home/jishnu/Dropbox/JuliaPackages/ApproxFunOrthogonalPolynomials.jl/src/Spaces/Ultraspherical/UltrasphericalOperators.jl:120
Arguments
  #self#::Type{Conversion}
  A::Core.Const(Chebyshev())
  B::Ultraspherical{Int64, ChebyshevInterval{Float64}, Float64}
Locals
  US::Ultraspherical{Int64, ChebyshevInterval{Float64}, Float64}
  d::ChebyshevInterval{Float64}
Body::Union{ApproxFunBase.ConcreteConversion{Chebyshev{ChebyshevInterval{Float64}, Float64}, Ultraspherical{Int64, ChebyshevInterval{Float64}, Float64}, Float64}, ApproxFunBase.ConversionWrapper{TimesOperator{Float64, Tuple{Int64, Int64}}, Float64}}

Tests are not ideal here, as they will pass on master as well, but at least they'll prevent against egregious regressions.

@codecov
Copy link

codecov bot commented Aug 14, 2022

Codecov Report

Merging #88 (10de42a) into master (fa98e6b) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master      #88   +/-   ##
=======================================
  Coverage   57.60%   57.60%           
=======================================
  Files          27       27           
  Lines        2413     2413           
=======================================
  Hits         1390     1390           
  Misses       1023     1023           
Impacted Files Coverage Δ
...c/Spaces/Ultraspherical/UltrasphericalOperators.jl 75.92% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@jishnub jishnub merged commit 987df98 into JuliaApproximation:master Aug 14, 2022
@jishnub jishnub deleted the conversionCU branch August 14, 2022 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant