Skip to content

Fix cholesky interface with singularities #168

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 3 commits into from
Jan 21, 2024
Merged

Conversation

dlfivefifty
Copy link
Member

No description provided.

Copy link

codecov bot commented Jan 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (fb28b6f) 92.69% compared to head (24491ca) 92.70%.

❗ Current head 24491ca differs from pull request most recent head 3ea4841. Consider uploading reports for the commit 3ea4841 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #168      +/-   ##
==========================================
+ Coverage   92.69%   92.70%   +0.01%     
==========================================
  Files          17       17              
  Lines        1861     1864       +3     
==========================================
+ Hits         1725     1728       +3     
  Misses        136      136              

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

@dlfivefifty dlfivefifty merged commit 5256e8e into main Jan 21, 2024
@dlfivefifty dlfivefifty deleted the dl/choleskyinterface branch January 21, 2024 09:38
@@ -43,7 +45,8 @@ cholesky_jacobimatrix(w::Function, P) = cholesky_jacobimatrix(w.(axes(P,1)), P)

function cholesky_jacobimatrix(w::AbstractQuasiVector, P)
Q = normalized(P)
W = Symmetric(Q \ (w .* Q)) # Compute weight multiplication via Clenshaw
w_P = orthogonalityweight(P)
W = Symmetric(Q \ ((w ./ w_P) .* Q)) # Compute weight multiplication via Clenshaw
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I missing something - doesn't this break the package?

The convention is that the supplied w is the modification, meaning that as the doc string says we "return the Jacobi matrix X associated to a quasi-matrix of polynomials orthogonal with respect to w(x) w_p(x) where w_p(x) is the weight of the polynomials in P".

If you divide by the orthogonality weight first then instead of the modification, you are supplying the target weight. This will break SemiclassicalOPs among other things.

I am surprised the tests didn't catch this but I guess it's because they are all Legendre based so the w_P term is a constant and thus irrelevant.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can change this convention of course but it's a breaking change and needs adjustments downstream.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The convention should have been the same as Lanczos polynomial. Now it is.

if tests pass it’s by definition not breaking. Downstream packages were therefore using the routine wrong.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, technically true due to test design, but at the very least the docstring is wrong now and we should fix it downstream since it's our downstream. I'll just fix this in the speed improvements PR then if you think it isn't urgent

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old version was just broken, eg

OrthogonalPolynomial(w::AbstractQuasiVector) = OrthogonalPolynomial(w, orthogonalpolynomial(singularities(w)))

Is consistent with my change.

so yes just fix the docstring and down stream packages

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