Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions c++/cppdlr/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace cppdlr {
auto [xgl, wgl] = gaussquad(n); // Get Gauss-Legendre nodes and weights
for (int j = 0; j < n; j++) {
x(j) = xgl(j);
w(j) = pow(-1, j) * sqrt((1 - pow(x(j), 2)) * wgl(j)); // Barycentric weights
w(j) = std::pow(-1, j) * std::sqrt((1 - std::pow(x(j), 2)) * wgl(j)); // Barycentric weights
}
}

Expand Down Expand Up @@ -136,7 +136,7 @@ namespace cppdlr {
xgl(n / 2) = 0; // If odd number of nodes, middle node is 0
for (int i = 0; i < n / 2; i++) { // Loop through nodes
convcount = 0;
x = cos((2 * i + 1) * std::numbers::pi / (2 * n)); // Initial guess: Chebyshev node
x = std::cos((2 * i + 1) * std::numbers::pi / (2 * n)); // Initial guess: Chebyshev node
while (true) { // Newton iteration
auto [p, dp] = leg_eval(n, x);
dx = -p / dp;
Expand Down