-
Notifications
You must be signed in to change notification settings - Fork 1
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
Given n recurrence compute up to Pn #16
Conversation
evaluates the first `N` orthogonal polynomials at point `x`, | ||
where `A`, `B`, and `C` are `AbstractVector`s containing the first form recurrence coefficients as defined in | ||
[DLMF](https://dlmf.nist.gov/18.9), i.e. it returns Pᵢ(x) for i = 0, 1, ..., N-1 | ||
""" | ||
forwardrecurrence(N::Integer, A::AbstractVector, B::AbstractVector, C::AbstractVector, x) = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the meaning of N
change here? Currently it means compute the first N
(including P0) vs compute up to PN. To me, the later makes more sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Julia uses 1-based indexing so I think N specifying the length of the vector is more natural
@test clenshaw(vec(clenshaw(coeffs, x; dims=1)), A, B, C, y) ≈ clenshaw(vec(clenshaw(coeffs, A, B, C, y; dims=2)), x) ≈ | ||
only(clenshaw!([0.0], clenshaw!(Matrix{Float64}(undef,1,n), coeffs, x), A, B, C, y)) ≈ | ||
only(clenshaw!([0.0], clenshaw!(Matrix{Float64}(undef,m,1), coeffs, A, B, C, y), x)) ≈ | ||
forwardrecurrence(A_T, B_T, C_T, x)'coeffs*forwardrecurrence(A, B, C, y) | ||
forwardrecurrence(A_T, B_T, C_T, x)'coeffs*forwardrecurrence(A, B, C, y)[1:end-1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the clenshaw
code enough to know if a similar change is needed there. In order to pass tests I am dropping the last element of forwardrecurrence
to replicate the previous behavior.
From looking at clenshaw
it seems that P0 isn't explicitly included, while it is in forwardrecurrence
. Ideally, they would be consistent, but I'm not familiar with this domain enough to address it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since clenshaw
returns a single value there's no point in including p0
as you can just multiply the returned value by p0
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #16 +/- ##
===========================================
+ Coverage 99.44% 100.00% +0.55%
===========================================
Files 7 7
Lines 181 186 +5
===========================================
+ Hits 180 186 +6
+ Misses 1 0 -1 ☔ View full report in Codecov by Sentry. |
@dlfivefifty I took this "PR" out of draft mode. If you are happy with it, it is ready to merge. |
Fixes #15