93 const InitialGuessType& initial_guess_type = InitialGuessType::Chebyshev;
101 const scalar_t tolerance = 2e-16;
106 const scalar_t alpha = this->alpha_m;
107 const scalar_t beta = this->beta_m;
109 const scalar_t alfbet = alpha + beta;
124 for (
size_t i = 0; i < NumNodes1D; ++i) {
126 if (initial_guess_type == InitialGuessType::LehrFEM) {
127 z = this->getLehrFEMInitialGuess(i, integration_nodes);
128 }
else if (initial_guess_type == InitialGuessType::Chebyshev) {
129 z = -this->getChebyshevNodes(i);
131 throw IpplException(
"GaussJacobiQuadrature::computeNodesAndWeights",
132 "Unknown initial guess type");
145 p1 = (alpha - beta + temp * z) / 2.0;
147 for (
size_t j = 2; j <= NumNodes1D; ++j) {
150 temp = 2 * j + alfbet;
151 a = 2 * j * (j + alfbet) * (temp - 2.0);
152 b = (temp - 1.0) * (alpha * alpha - beta * beta + temp * (temp - 2.0) * z);
153 c = 2.0 * (j - 1 + alpha) * (j - 1 + beta) * temp;
154 p1 = (b * p2 - c * p3) / a;
156 pp = (NumNodes1D * (alpha - beta - temp * z) * p1
157 + 2.0 * (NumNodes1D + alpha) * (NumNodes1D + beta) * p2)
158 / (temp * (1.0 - z * z));
168 if (its > this->min_newton_iterations_m && Kokkos::abs(z - z1) <= tolerance) {
172 }
while (its <= this->max_newton_iterations_m);
174 if (its > this->max_newton_iterations_m) {
176 std::cout <<
"Root " << NumNodes1D - i - 1
177 <<
" didn't converge. Tolerance may be too high for data type"
184 integration_nodes[i] = z;
188 Kokkos::exp(Kokkos::lgamma(alpha + NumNodes1D) + Kokkos::lgamma(beta + NumNodes1D)
189 - Kokkos::lgamma(NumNodes1D + 1.)
190 - Kokkos::lgamma(
static_cast<double>(NumNodes1D) + alfbet + 1.0))
191 * temp * Kokkos::pow(2.0, alfbet) / (pp * p2);
194 this->integration_nodes_m[i] =
static_cast<T
>(-integration_nodes[i]);
195 this->weights_m[i] =
static_cast<T
>(weights[i]);