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

Rewrite JacobiSNCNDNReduced #2220

Merged
merged 6 commits into from
Jun 24, 2019
Merged

Conversation

pleroy
Copy link
Member

@pleroy pleroy commented Jun 23, 2019

No description provided.

namespace numerics {
namespace {

void JacobiSNCNDNReduced(double u, double mc, double& s, double& c, double& d);

// Maclaurin series for Fukushima b₀. These are polynomials in m that are used
// to build a polynomial in u₀². The index gives the degree of the polynomial.
Copy link
Member

Choose a reason for hiding this comment

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

that are used to build as coefficients of a polynomial in u₀²

The index gives the degree of the polynomial

The index should give the corresponding power of u₀² .

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

double const uA = 1.76269 + 1.16357 * mc;
bool const may_have_cancellation = u > uA;
double aᵢ = 1.0;
for (int j = 0; j < n; ++j) {
Copy link
Member

Choose a reason for hiding this comment

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

Rename j to i, for consistency with the subscript.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

double cᵢ = aᵢ - bᵢ;
double const two_mc = 2.0 * mc;
double const two_m = 2.0 * m;
for (int i = j; i < n; ++i) {
Copy link
Member

Choose a reason for hiding this comment

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

This just finishes the outer loop; reuse the same index accordingly.

Sorry, something went wrong.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Sorry, something went wrong.

@eggrobin eggrobin added the LGTM label Jun 24, 2019
@pleroy pleroy merged commit e9d6896 into mockingbirdnest:master Jun 24, 2019
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