Skip to content
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

Merged
merged 25 commits into from
Oct 9, 2020

Conversation

eggrobin
Copy link
Member

@eggrobin eggrobin commented Oct 8, 2020

numerics/poisson_series_body.hpp Show resolved Hide resolved
numerics/quadrature.hpp Outdated Show resolved Hide resolved
numerics/quadrature_body.hpp Outdated Show resolved Hide resolved
numerics/quadrature_body.hpp Outdated Show resolved Hide resolved
// 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);
Copy link
Member

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.

Copy link
Member Author

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.

numerics/quadrature_body.hpp Outdated Show resolved Hide resolved
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;
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Shrug.

@pleroy pleroy added the LGTM label Oct 8, 2020
@eggrobin eggrobin merged commit 46eb777 into mockingbirdnest:master Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants