JuliaApproximation / ApproxFunBase.jl

Core functionality of ApproxFun
MIT License
12 stars 13 forks source link

Impove type inference in RaggedMatrix constructor #520

Closed jishnub closed 1 year ago

jishnub commented 1 year ago

This avoids recursion in the RaggedMatrix constructor from SubOperators. After this,

julia> d1, r1 = Legendre(), Jacobi(2,2);

julia> d2, r2 = Chebyshev(), Chebyshev();

julia> K = (Operator(I, d1) ⊗ Operator(I, d2)) → (r1 ⊗ r2)
KroneckerOperator : Legendre() ⊗ Chebyshev() → Jacobi(2,2) ⊗ Chebyshev()
 1.0  0.0  0.0       0.0  0.0       -0.285714  0.0  0.0        0.0        0.0       ⋯
  ⋅   1.0  0.0       0.0  0.0        0.0       0.0  0.0       -0.285714   0.0       ⋱
  ⋅   0.0  0.333333  0.0  0.0        0.0       0.0  0.0        0.0       -0.222222  ⋱
  ⋅    ⋅    ⋅        1.0  0.0        0.0       0.0  0.0        0.0        0.0       ⋱
  ⋅    ⋅    ⋅        0.0  0.333333   0.0       0.0  0.0        0.0        0.0       ⋱
  ⋅    ⋅    ⋅        0.0  0.0        0.214286  0.0  0.0        0.0        0.0       ⋱
  ⋅    ⋅    ⋅         ⋅    ⋅          ⋅        1.0  0.0        0.0        0.0       ⋱
  ⋅    ⋅    ⋅         ⋅    ⋅          ⋅        0.0  0.333333   0.0        0.0       ⋱
  ⋅    ⋅    ⋅         ⋅    ⋅          ⋅        0.0  0.0        0.214286   0.0       ⋱
  ⋅    ⋅    ⋅         ⋅    ⋅          ⋅        0.0  0.0        0.0        0.166667  ⋱
  ⋮    ⋱    ⋱         ⋱    ⋱          ⋱         ⋱    ⋱          ⋱          ⋱        ⋱

julia> @inferred K[1:1, 1:1]
1×1 ApproxFunBase.RaggedMatrix{Float64}:
 1.0
codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 68.33% and project coverage change: -44.48% :warning:

Comparison is base (4f33475) 71.88% compared to head (5890748) 27.40%. Report is 12 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #520 +/- ## =========================================== - Coverage 71.88% 27.40% -44.48% =========================================== Files 81 80 -1 Lines 8546 8360 -186 =========================================== - Hits 6143 2291 -3852 - Misses 2403 6069 +3666 ``` | [Files Changed](https://app.codecov.io/gh/JuliaApproximation/ApproxFunBase.jl/pull/520?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaApproximation) | Coverage Δ | | |---|---|---| | [src/ApproxFunBase.jl](https://app.codecov.io/gh/JuliaApproximation/ApproxFunBase.jl/pull/520?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaApproximation#diff-c3JjL0FwcHJveEZ1bkJhc2Uuamw=) | `44.00% <ø> (-40.00%)` | :arrow_down: | | [src/Operators/SubOperator.jl](https://app.codecov.io/gh/JuliaApproximation/ApproxFunBase.jl/pull/520?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaApproximation#diff-c3JjL09wZXJhdG9ycy9TdWJPcGVyYXRvci5qbA==) | `42.64% <0.00%> (-41.18%)` | :arrow_down: | | [src/Operators/banded/CalculusOperator.jl](https://app.codecov.io/gh/JuliaApproximation/ApproxFunBase.jl/pull/520?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaApproximation#diff-c3JjL09wZXJhdG9ycy9iYW5kZWQvQ2FsY3VsdXNPcGVyYXRvci5qbA==) | `17.35% <0.00%> (-58.46%)` | :arrow_down: | | [src/Operators/banded/Conversion.jl](https://app.codecov.io/gh/JuliaApproximation/ApproxFunBase.jl/pull/520?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaApproximation#diff-c3JjL09wZXJhdG9ycy9iYW5kZWQvQ29udmVyc2lvbi5qbA==) | `22.95% <0.00%> (-63.49%)` | :arrow_down: | | [src/Spaces/ProductSpaceOperators.jl](https://app.codecov.io/gh/JuliaApproximation/ApproxFunBase.jl/pull/520?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaApproximation#diff-c3JjL1NwYWNlcy9Qcm9kdWN0U3BhY2VPcGVyYXRvcnMuamw=) | `0.00% <0.00%> (-65.37%)` | :arrow_down: | | [src/eigen.jl](https://app.codecov.io/gh/JuliaApproximation/ApproxFunBase.jl/pull/520?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaApproximation#diff-c3JjL2VpZ2VuLmps) | `0.00% <0.00%> (-96.43%)` | :arrow_down: | | [src/Fun.jl](https://app.codecov.io/gh/JuliaApproximation/ApproxFunBase.jl/pull/520?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaApproximation#diff-c3JjL0Z1bi5qbA==) | `36.17% <50.00%> (-31.62%)` | :arrow_down: | | [src/Operators/general/InterlaceOperator.jl](https://app.codecov.io/gh/JuliaApproximation/ApproxFunBase.jl/pull/520?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaApproximation#diff-c3JjL09wZXJhdG9ycy9nZW5lcmFsL0ludGVybGFjZU9wZXJhdG9yLmps) | `23.46% <66.66%> (-57.87%)` | :arrow_down: | | [src/LinearAlgebra/helper.jl](https://app.codecov.io/gh/JuliaApproximation/ApproxFunBase.jl/pull/520?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaApproximation#diff-c3JjL0xpbmVhckFsZ2VicmEvaGVscGVyLmps) | `55.58% <100.00%> (-13.35%)` | :arrow_down: | | [src/Multivariate/TensorSpace.jl](https://app.codecov.io/gh/JuliaApproximation/ApproxFunBase.jl/pull/520?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaApproximation#diff-c3JjL011bHRpdmFyaWF0ZS9UZW5zb3JTcGFjZS5qbA==) | `39.83% <100.00%> (-45.34%)` | :arrow_down: | | ... and [2 more](https://app.codecov.io/gh/JuliaApproximation/ApproxFunBase.jl/pull/520?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaApproximation) | | ... and [60 files with indirect coverage changes](https://app.codecov.io/gh/JuliaApproximation/ApproxFunBase.jl/pull/520/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaApproximation)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.