Skip to content
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

Operator constructor instead of convert #399

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

jishnub
Copy link
Member

@jishnub jishnub commented Mar 15, 2023

This is a somewhat large PR, but the idea is the same across files: define the constructor Operator{T}(x::Operator) and the constructor (::Type{T})(x:Operator) where {T<:Operator}, where T and typeof(x) only differ in some type parameter.

After this, something like this would work:

julia> D = Derivative(Chebyshev())
ConcreteDerivative : Chebyshev()  Ultraspherical(1)
   1.0                                  
       2.0                              
           3.0                          
               4.0                      
                   5.0                  
                       6.0              
                           7.0          
                               8.0      
                                   9.0  
                                       
                                       

julia> typeof(D)(D)
ConcreteDerivative : Chebyshev()  Ultraspherical(1)
   1.0                                  
       2.0                              
           3.0                          
               4.0                      
                   5.0                  
                       6.0              
                           7.0          
                               8.0      
                                   9.0  
                                       
                                       

The motivation behind this is to get something like the following to work:

julia> C1 = Conversion(Chebyshev(), Ultraspherical(1));

julia> C2 = Conversion(Chebyshev(), Ultraspherical(1.0));

julia> push!([C1], C2)
2-element Vector{ApproxFunBase.ConcreteConversion{Chebyshev{ChebyshevInterval{Float64}, Float64}, Ultraspherical{Int64, ChebyshevInterval{Float64}, Float64}, Float64}}:
 ConcreteConversion : Chebyshev()  Ultraspherical(1)
 ConcreteConversion : Chebyshev()  Ultraspherical(1)

julia> push!([C2], C1)
2-element Vector{ApproxFunBase.ConcreteConversion{Chebyshev{ChebyshevInterval{Float64}, Float64}, Ultraspherical{Float64, ChebyshevInterval{Float64}, Float64}, Float64}}:
 ConcreteConversion : Chebyshev()  Ultraspherical(1.0)
 ConcreteConversion : Chebyshev()  Ultraspherical(1.0)

@codecov
Copy link

codecov bot commented Mar 15, 2023

Codecov Report

Patch coverage: 69.23% and project coverage change: -9.40 ⚠️

Comparison is base (e3f9926) 71.68% compared to head (da0a6f8) 62.29%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #399      +/-   ##
==========================================
- Coverage   71.68%   62.29%   -9.40%     
==========================================
  Files          80       80              
  Lines        8456     8514      +58     
==========================================
- Hits         6062     5304     -758     
- Misses       2394     3210     +816     
Impacted Files Coverage Δ
src/ApproxFunBase.jl 75.00% <ø> (-8.34%) ⬇️
src/Operators/banded/Reverse.jl 33.33% <0.00%> (-41.67%) ⬇️
src/Operators/general/PartialInverseOperator.jl 46.55% <0.00%> (-51.67%) ⬇️
src/Spaces/ArraySpace.jl 50.00% <0.00%> (-26.28%) ⬇️
src/Spaces/ContinuousSpace.jl 66.31% <0.00%> (-15.41%) ⬇️
src/Spaces/DiracSpace.jl 70.00% <0.00%> (-1.19%) ⬇️
src/Spaces/HeavisideSpace.jl 34.84% <0.00%> (-2.66%) ⬇️
src/Spaces/QuotientSpace.jl 38.20% <0.00%> (-43.99%) ⬇️
src/Spaces/SubSpace.jl 49.00% <0.00%> (-16.31%) ⬇️
src/Spaces/SumSpace.jl 67.33% <0.00%> (-3.98%) ⬇️
... and 24 more

... and 27 files with indirect coverage changes

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

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

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