at-points: change at-points operators to use Chebyshev polynomials of the first kind (normalized)#1963
at-points: change at-points operators to use Chebyshev polynomials of the first kind (normalized)#1963zatkins-dev wants to merge 2 commits intomainfrom
Conversation
… the first kind (normalized)
|
we could possibly squeeze an extra register out of the cuda and hip impls, since they use 3 doubles for the derivative calculation right now and we should only need two with this change. |
| static int CeedChebyshevPolynomialsAtPoint(CeedScalar x, CeedInt n, CeedScalar *chebyshev_x) { | ||
| chebyshev_x[0] = 1.0; | ||
| chebyshev_x[1] = 2 * x; | ||
| chebyshev_x[1] = x; |
There was a problem hiding this comment.
Can you toss references to Chebyshev of the first kind for the future grad student trying to grok what we're doing here? (Also for the derivative function)
There was a problem hiding this comment.
Yeah for sure, though tbh the options are wikipedia or a book (or both)
There was a problem hiding this comment.
Yea, Wikipedia is probably good for a quick reference to get people oriented, and I like the refs being here in this file. That makes the most sense I think
|
|
||
| chebyshev_x[1] = 1.0; | ||
| chebyshev_x[2] = 2 * x; | ||
| chebyshev_x[0] = 1.0; |
There was a problem hiding this comment.
specifically we should note here that the second kind is used to make the derivatives of the first kind (probably why I stuck with the second kind throughout? I don't recall)
There was a problem hiding this comment.
(I know you have it there mathematically, but I'm trying to picture the theoretical new grad student)
| @@ -47,7 +47,7 @@ const CeedBasis CEED_BASIS_NONE = &ceed_basis_none; | |||
| **/ | |||
| static int CeedChebyshevPolynomialsAtPoint(CeedScalar x, CeedInt n, CeedScalar *chebyshev_x) { | |||
| chebyshev_x[0] = 1.0; | |||
There was a problem hiding this comment.
| chebyshev_x[0] = 1.0; | |
| // Chebyshev polynomials of the first kind, 3 term recurrence: T_0(x) = 1, T_1(x) = x, T_n = 2 x T_{n-1} - T_{n-2} | |
| // For more info, see e.g. https://en.wikipedia.org/wiki/Chebyshev_polynomials#Recurrence_definition | |
| chebyshev_x[0] = 1.0; |
| chebyshev_x[1] = 1.0; | ||
| chebyshev_x[2] = 2 * x; |
There was a problem hiding this comment.
| chebyshev_x[1] = 1.0; | |
| chebyshev_x[2] = 2 * x; | |
| // Note, these are Chebyshev polynomials of the 2nd kind, used for derivatives | |
| // See e.g. https://en.wikipedia.org/wiki/Chebyshev_polynomials#Differentiation_and_integration for the recurrence | |
| chebyshev_x[1] = 1.0; | |
| chebyshev_x[2] = 2 * x; |
Purpose:
We're currently using Chebyshev polynomials of the second kind, which don't have their range bounded to the same [-1,1] as their domain. I'm really not sure why we would be using the second kind, since they're numerically less stable and have a more complicated derivative.
This doesn't cause any issues with tests here or in Ratel.
LLM/GenAI Disclosure:
None