Skip to content

chop! no longer produces empty coefficients #479

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dstahlke
Copy link

Test case:
using ApproxFun
x,y = Fun(identity, Chebyshev() * Chebyshev())
ApproxFun.norm(0*x)
ApproxFun.norm(zero(x))

I didn't create a unit test because I couldn't find a way to reproduce with ApproxFunBase only.

Test case:
    using ApproxFun
    x,y = Fun(identity, Chebyshev() * Chebyshev())
    ApproxFun.norm(0*x)
    ApproxFun.norm(zero(x))
@dstahlke
Copy link
Author

Without this patch, norm(zero(x)) gives the following error in ApproxFunBase/src/Multivariate/ProductFun.jl:177:

ERROR: LoadError: BoundsError: attempt to access 0×0 Matrix{Float64} at index [1:1, 1:1]

Fixing ProductFun to handle empty coefficients just leads to a similar error later on. So it seems this package generally assumes that the coefficients vector is not empty. Thus I modified chop! to never return an empty coefficients vector.

dstahlke added a commit to dstahlke/ApproxFun.jl that referenced this pull request Jun 12, 2023
Test case (requires also JuliaApproximation/ApproxFunBase.jl#479):
    using ApproxFun

    xdom = Chebyshev(-1..1)
    ydom = Chebyshev(-1..1)
    domain = xdom * ydom
    x,y = Fun(identity, domain)
    Dx = Derivative(Chebyshev()^2, [1,0])
    Dy = Derivative(Chebyshev()^2, [0,1])

    N(u, v) = [
        2*u - x;
        3*v + y
    ]

    u0 = one(x) * one(y)
    v0 = one(x) * one(y)
    u, v = newton(N, [u0, v0])

Bug report:
JuliaApproximation#887
@jishnub
Copy link
Member

jishnub commented Jun 12, 2023

Thanks! ideally the empty ProductFun and LowRankFun should be made to work, but that requires fixing a lot of code, so I think this should be fine

@codecov
Copy link

codecov bot commented Jun 12, 2023

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 26.38%. Comparing base (2f401fa) to head (20867a2).
Report is 151 commits behind head on master.

Files with missing lines Patch % Lines
src/Fun.jl 0.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (2f401fa) and HEAD (20867a2). Click for more details.

HEAD has 12 uploads less than BASE
Flag BASE (2f401fa) HEAD (20867a2)
16 4
Additional details and impacted files
@@             Coverage Diff             @@
##           master     #479       +/-   ##
===========================================
- Coverage   71.22%   26.38%   -44.84%     
===========================================
  Files          80       81        +1     
  Lines        8331     8443      +112     
===========================================
- Hits         5934     2228     -3706     
- Misses       2397     6215     +3818     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants