-
Notifications
You must be signed in to change notification settings - Fork 69
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
Implement an automatic Clenshaw-Curtis quadrature and use it in the Poisson series inner product and norm #2756
Conversation
This reverts commit 3f06008.
// If we identify [lower_bound, upper_bound] with [-1, 1], | ||
// f_cos_N⁻¹π[s] is f(cos πs/N). | ||
std::vector<Value> f_cos_N⁻¹π; | ||
f_cos_N⁻¹π.resize(2 * N); |
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.
It would be more efficient to do reserve
and then push_back
in the loops: no need to zero-initialize the vector.
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.
Shrug; let’s remain close to the notation from the paper.
f_cos_N⁻¹π, N⁻¹π); | ||
auto const& a = *fft; | ||
|
||
// [Gen72b] (7), factoring out the division by N. |
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.
"equation (7)".
numerics/quadrature_body.hpp
Outdated
Value Σʺ{}; | ||
for (std::int64_t n = 0; n <= N; n += 2) { | ||
// The notation g is from [OLBC10], 3.5.17. | ||
int gₙ = n == 0 || n == N ? 1 : 2; |
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.
const
Note that the ?:
is likely to involve a jump. A slightly faster way to write it would be to extract n = 0
and n = N
from the loop, and loop from n = 1
to n < N
.
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.
Shrug.
#2400.