41 #include <boost/core/ignore_unused.hpp>
47 #define EPS 100 * DBL_EPSILON
49 #define sign(a, b) ((b) < 0 ? -fabs(a) : fabs(a))
61 int m_digits =
static_cast<int>(fabs(floor(log10(DBL_EPSILON))) - 1);
63 if (fabs(xl - xr) < 1.e-4)
66 m_expn =
static_cast<int>(floor(log10(fabs(xl - xr))));
67 m_xln = xl * powl(10.0L, -m_expn) -
68 floor(xl * powl(10.0L,
71 xr * powl(10.0L, -m_expn) -
76 round(m_xln * powl(10.0L, m_digits + m_expn));
77 m_xrn = round(m_xrn * powl(10.0L, m_digits + m_expn));
79 return powl(10.0L, -m_digits) * (m_xln - m_xrn);
87 double laginterp(
double z,
int j,
const double *zj,
int np)
90 for (
int i = 0; i < np; i++)
94 temp *=
optdiff(z, zj[i]) / (zj[j] - zj[i]);
100 #define POLYNOMIAL_DEFLATION 0
102 #ifdef POLYNOMIAL_DEFLATION
104 #define jacobz(n, z, alpha, beta) Jacobz(n, z, alpha, beta)
107 #define jacobz(n, z, alpha, beta) JacZeros(n, z, alpha, beta)
111 static void Jacobz(
const int n,
double *z,
const double alpha,
116 static void TriQL(
const int,
double *,
double *,
double **);
117 double gammaF(
const double);
118 double gammaFracGammaF(
const int,
const double,
const int,
const double);
119 static void RecCoeff(
const int,
double *,
double *,
const double,
const double);
120 void JKMatrix(
int,
double *,
double *);
121 void chri1(
int,
double *,
double *,
double *,
double *,
double);
133 void zwgj(
double *z,
double *w,
const int np,
const double alpha,
137 double fac, one = 1.0, two = 2.0, apb = alpha +
beta;
142 fac = pow(two, apb + one) *
gammaFracGammaF(np + 1, alpha, np + 1, 0.0) *
145 for (i = 0; i < np; ++i)
146 w[i] = fac / (w[i] * w[i] * (one - z[i] * z[i]));
161 void zwgrjm(
double *z,
double *w,
const int np,
const double alpha,
173 double fac, one = 1.0, two = 2.0, apb = alpha +
beta;
183 for (i = 0; i < np; ++i)
184 w[i] = fac * (1 - z[i]) / (w[i] * w[i]);
185 w[0] *= (
beta + one);
202 void zwgrjp(
double *z,
double *w,
const int np,
const double alpha,
214 double fac, one = 1.0, two = 2.0, apb = alpha +
beta;
224 for (i = 0; i < np; ++i)
225 w[i] = fac * (1 + z[i]) / (w[i] * w[i]);
226 w[np - 1] *= (alpha + one);
241 void zwglj(
double *z,
double *w,
const int np,
const double alpha,
261 double fac, one = 1.0, apb = alpha +
beta, two = 2.0;
265 jacobz(np - 2, z + 1, alpha + one,
beta + one);
272 for (i = 0; i < np; ++i)
273 w[i] = fac / (w[i] * w[i]);
274 w[0] *= (
beta + one);
275 w[np - 1] *= (alpha + one);
290 void zwgk(
double *z,
double *w,
const int npt,
const double alpha,
294 int np = (npt - 1) / 2;
299 int kpoints = 2 * np + 1;
302 int ncoeffs = (int)floor(3.0 * (np + 1) / 2);
307 double *a =
new double[kpoints];
308 double *b =
new double[kpoints];
311 for (i = 0; i < kpoints; i++)
324 double **zmatrix =
new double *[kpoints];
325 for (i = 0; i < kpoints; i++)
327 zmatrix[i] =
new double[kpoints];
328 for (j = 0; j < kpoints; j++)
333 for (i = 0; i < kpoints; i++)
339 TriQL(kpoints, a, b, zmatrix);
341 for (i = 0; i < kpoints; i++)
348 for (i = 0; i < kpoints; i++)
362 void zwrk(
double *z,
double *w,
const int npt,
const double alpha,
370 fprintf(stderr,
"too few points in formula\n");
379 int kpoints = 2 * np;
382 int ncoeffs = (int)ceil(3.0 * np / 2);
385 double *a =
new double[ncoeffs + 1];
386 double *b =
new double[ncoeffs + 1];
389 for (i = 0; i < ncoeffs + 1; i++)
398 double *a0 =
new double[ncoeffs];
399 double *b0 =
new double[ncoeffs];
401 chri1(ncoeffs, a, b, a0, b0, end0);
403 double s = b0[0] / fabs(b0[0]);
407 double *z1 =
new double[2 * np - 1];
408 double *w1 =
new double[2 * np - 1];
409 for (i = 0; i < ncoeffs; i++)
416 double **zmatrix =
new double *[2 * np - 1];
417 for (i = 0; i < 2 * np - 1; i++)
419 zmatrix[i] =
new double[2 * np - 1];
420 for (j = 0; j < 2 * np - 1; j++)
425 for (i = 0; i < 2 * np - 1; i++)
431 TriQL(2 * np - 1, z1, w1, zmatrix);
434 for (i = 0; i < 2 * np - 1; i++)
436 w1[i] = s * w1[i] / (z1[i] - end0);
442 for (i = 1; i < kpoints; i++)
454 for (i = 0; i < 2 * np - 1; i++)
468 void zwlk(
double *z,
double *w,
const int npt,
const double alpha,
472 int np = (npt + 1) / 2;
476 fprintf(stderr,
"too few points in formula\n");
485 int kpoints = 2 * np - 1;
488 int ncoeffs = (int)ceil(3.0 * np / 2) - 1;
491 double *a =
new double[ncoeffs + 1];
492 double *b =
new double[ncoeffs + 1];
495 for (i = 0; i < ncoeffs + 1; i++)
504 double *a0 =
new double[ncoeffs];
505 double *b0 =
new double[ncoeffs];
507 chri1(ncoeffs, a, b, a0, b0, endl);
509 double *a1 =
new double[ncoeffs - 1];
510 double *b1 =
new double[ncoeffs - 1];
512 chri1(ncoeffs - 1, a0, b0, a1, b1, endr);
514 double s = b1[0] / fabs(b1[0]);
518 double *z1 =
new double[2 * np - 3];
519 double *w1 =
new double[2 * np - 3];
520 for (i = 0; i < ncoeffs; i++)
527 double **zmatrix =
new double *[2 * np - 3];
528 for (i = 0; i < 2 * np - 3; i++)
530 zmatrix[i] =
new double[2 * np - 3];
531 for (j = 0; j < 2 * np - 3; j++)
536 for (i = 0; i < 2 * np - 3; i++)
542 TriQL(2 * np - 3, z1, w1, zmatrix);
545 double sumW1Z1 = 0.0;
546 for (i = 0; i < 2 * np - 3; i++)
548 w1[i] = s * w1[i] / (z1[i] - endl) / (z1[i] - endr);
550 sumW1Z1 += z1[i] * w1[i];
553 double c0 = b[0] - sumW1;
554 double c1 = a[0] * b[0] - sumW1Z1;
557 z[2 * np - 2] = endr;
558 w[0] = (c0 * endr - c1) / (endr - endl);
559 w[2 * np - 2] = (c1 - c0 * endl) / (endr - endl);
561 for (i = 1; i < kpoints - 1; i++)
574 for (i = 0; i < 2 * np - 3; i++)
584 void Qg(
double *Q,
const double *z,
const int np,
const int offset)
596 pd = (
double *)malloc(np *
sizeof(
double));
598 for (i = 0; i < np; i++)
601 for (j = 0; j < np; j++)
603 Q[j * (np + offset) + i + offset] = 0.0;
604 for (k = 0; k < np; k++)
606 Q[j * (np + offset) + i + offset] +=
607 pd[k] / (k + 1) * pow(z[j], k + 1);
627 void Dgj(
double *D,
const double *z,
const int np,
const double alpha,
631 double one = 1.0, two = 2.0;
642 pd = (
double *)malloc(np *
sizeof(
double));
645 for (i = 0; i < np; i++)
647 for (j = 0; j < np; j++)
651 D[i * np + j] = pd[j] / (pd[i] * (z[j] - z[i]));
654 (alpha -
beta + (alpha +
beta + two) * z[j]) /
655 (two * (one - z[j] * z[j]));
674 void Dgrjm(
double *D,
const double *z,
const int np,
const double alpha,
685 double one = 1.0, two = 2.0;
688 pd = (
double *)malloc(np *
sizeof(
double));
692 jacobd(np - 1, z + 1, pd + 1, np - 1, alpha,
beta + 1);
693 for (i = 1; i < np; ++i)
696 for (i = 0; i < np; i++)
698 for (j = 0; j < np; j++)
701 D[i * np + j] = pd[j] / (pd[i] * (z[j] - z[i]));
705 D[i * np + j] = -(np + alpha +
beta + one) *
706 (np - one) / (two * (
beta + two));
709 (alpha -
beta + one + (alpha +
beta + one) * z[j]) /
710 (two * (one - z[j] * z[j]));
730 void Dgrjp(
double *D,
const double *z,
const int np,
const double alpha,
741 double one = 1.0, two = 2.0;
744 pd = (
double *)malloc(np *
sizeof(
double));
746 jacobd(np - 1, z, pd, np - 1, alpha + 1,
beta);
747 for (i = 0; i < np - 1; ++i)
750 pd[np - 1] /=
gammaF(alpha + two);
752 for (i = 0; i < np; i++)
754 for (j = 0; j < np; j++)
757 D[i * np + j] = pd[j] / (pd[i] * (z[j] - z[i]));
761 D[i * np + j] = (np + alpha +
beta + one) * (np - one) /
762 (two * (alpha + two));
765 (alpha -
beta - one + (alpha +
beta + one) * z[j]) /
766 (two * (one - z[j] * z[j]));
787 void Dglj(
double *D,
const double *z,
const int np,
const double alpha,
797 double one = 1.0, two = 2.0;
800 pd = (
double *)malloc(np *
sizeof(
double));
804 jacobd(np - 2, z + 1, pd + 1, np - 2, alpha + 1,
beta + 1);
805 for (i = 1; i < np - 1; ++i)
806 pd[i] *= (one - z[i] * z[i]);
808 pd[np - 1] /=
gammaF(alpha + two);
810 for (i = 0; i < np; i++)
812 for (j = 0; j < np; j++)
815 D[i * np + j] = pd[j] / (pd[i] * (z[j] - z[i]));
820 (alpha - (np - 1) * (np + alpha +
beta)) /
821 (two * (
beta + two));
822 else if (j == np - 1)
824 -(
beta - (np - 1) * (np + alpha +
beta)) /
825 (two * (alpha + two));
827 D[i * np + j] = (alpha -
beta + (alpha +
beta) * z[j]) /
828 (two * (one - z[j] * z[j]));
858 double hgj(
const int i,
const double z,
const double *zgj,
const int np,
859 const double alpha,
const double beta)
861 boost::ignore_unused(alpha,
beta);
893 double hgrjm(
const int i,
const double z,
const double *zgrj,
const int np,
894 const double alpha,
const double beta)
896 boost::ignore_unused(alpha,
beta);
929 double hgrjp(
const int i,
const double z,
const double *zgrj,
const int np,
930 const double alpha,
const double beta)
932 boost::ignore_unused(alpha,
beta);
964 double hglj(
const int i,
const double z,
const double *zglj,
const int np,
965 const double alpha,
const double beta)
967 boost::ignore_unused(alpha,
beta);
992 void Imgj(
double *im,
const double *zgj,
const double *zm,
const int nz,
993 const int mz,
const double alpha,
const double beta)
998 for (i = 0; i < nz; ++i)
1000 for (j = 0; j < mz; ++j)
1003 im[i * mz + j] =
hgj(i, zp, zgj, nz, alpha,
beta);
1023 void Imgrjm(
double *im,
const double *zgrj,
const double *zm,
const int nz,
1024 const int mz,
const double alpha,
const double beta)
1029 for (i = 0; i < nz; i++)
1031 for (j = 0; j < mz; j++)
1034 im[i * mz + j] =
hgrjm(i, zp, zgrj, nz, alpha,
beta);
1054 void Imgrjp(
double *im,
const double *zgrj,
const double *zm,
const int nz,
1055 const int mz,
const double alpha,
const double beta)
1060 for (i = 0; i < nz; i++)
1062 for (j = 0; j < mz; j++)
1065 im[i * mz + j] =
hgrjp(i, zp, zgrj, nz, alpha,
beta);
1085 void Imglj(
double *im,
const double *zglj,
const double *zm,
const int nz,
1086 const int mz,
const double alpha,
const double beta)
1091 for (i = 0; i < nz; i++)
1093 for (j = 0; j < mz; j++)
1096 im[i * mz + j] =
hglj(i, zp, zglj, nz, alpha,
beta);
1103 void polycoeffs(
const int i,
const double *z,
double *c,
const int np)
1109 for (j = 0; j < np; j++)
1121 for (j = 0; j < np; j++)
1127 for (k = m - 1; k > 0; k--)
1129 c[k] *= -1.0 * z[j];
1132 c[0] *= -1.0 * z[j];
1135 for (j = 0; j < np; j++)
1181 void jacobfd(
const int np,
const double *z,
double *poly_in,
double *polyd,
1182 const int n,
const double alpha,
const double beta)
1185 double zero = 0.0, one = 1.0, two = 2.0;
1193 for (i = 0; i < np; ++i)
1196 for (i = 0; i < np; ++i)
1202 for (i = 0; i < np; ++i)
1203 poly_in[i] = 0.5 * (alpha -
beta + (alpha +
beta + two) * z[i]);
1205 for (i = 0; i < np; ++i)
1206 polyd[i] = 0.5 * (alpha +
beta + two);
1211 double a1, a2, a3, a4;
1212 double two = 2.0, apb = alpha +
beta;
1213 double *poly, *polyn1, *polyn2;
1217 polyn1 = (
double *)malloc(2 * np *
sizeof(
double));
1218 polyn2 = polyn1 + np;
1223 polyn1 = (
double *)malloc(3 * np *
sizeof(
double));
1224 polyn2 = polyn1 + np;
1228 for (i = 0; i < np; ++i)
1231 polyn1[i] = 0.5 * (alpha -
beta + (alpha +
beta + two) * z[i]);
1234 for (k = 2; k <= n; ++k)
1236 a1 = two * k * (k + apb) * (two * k + apb - two);
1237 a2 = (two * k + apb - one) * (alpha * alpha -
beta *
beta);
1239 (two * k + apb - two) * (two * k + apb - one) * (two * k + apb);
1240 a4 = two * (k + alpha - one) * (k +
beta - one) * (two * k + apb);
1246 for (i = 0; i < np; ++i)
1248 poly[i] = (a2 + a3 * z[i]) * polyn1[i] - a4 * polyn2[i];
1249 polyn2[i] = polyn1[i];
1250 polyn1[i] = poly[i];
1256 a1 = n * (alpha -
beta);
1257 a2 = n * (two * n + alpha +
beta);
1258 a3 = two * (n + alpha) * (n +
beta);
1259 a4 = (two * n + alpha +
beta);
1265 for (i = 0; i < np; ++i)
1267 polyd[i] = (a1 - a2 * z[i]) * poly[i] + a3 * polyn2[i];
1268 polyd[i] /= (one - z[i] * z[i]);
1293 void jacobd(
const int np,
const double *z,
double *polyd,
const int n,
1294 const double alpha,
const double beta)
1299 for (i = 0; i < np; ++i)
1304 jacobfd(np, z, polyd, NULL, n - 1, alpha + one,
beta + one);
1305 for (i = 0; i < np; ++i)
1306 polyd[i] *= 0.5 * (alpha +
beta + (
double)n + one);
1327 gamma = -2.0 *
sqrt(M_PI);
1330 else if ((x - (
int)x) == 0.5)
1342 else if ((x - (
int)x) == 0.0)
1354 fprintf(stderr,
"%lf is not of integer or half order\n", x);
1375 double halfa = fabs(alpha -
int(alpha));
1376 double halfb = fabs(
beta -
int(
beta));
1377 if (halfa == 0.0 && halfb == 0.0)
1383 for (
int tmp = X - 1; tmp > Y - 1; tmp -= 1)
1388 for (
int tmp = Y - 1; tmp > X - 1; tmp -= 1)
1393 else if (halfa == 0.5 && halfb == 0.5)
1395 double X = x + alpha;
1396 double Y = y +
beta;
1399 for (
int tmp =
int(X); tmp > int(Y); tmp -= 1)
1404 for (
int tmp =
int(Y); tmp > int(X); tmp -= 1)
1411 double X = x + alpha;
1412 double Y = y +
beta;
1413 while (X > 1 || Y > 1)
1428 gamma *=
sqrt(M_PI);
1432 gamma /=
sqrt(M_PI);
1436 fprintf(stderr,
"%lf or %lf is not of integer or half order\n", X,
1452 static void Jacobz(
const int n,
double *z,
const double alpha,
1456 double dth = M_PI / (2.0 * (double)n);
1457 double poly, pder, rlast = 0.0;
1458 double sum, delr, r;
1459 double one = 1.0, two = 2.0;
1464 for (k = 0; k < n; ++k)
1466 r = -cos((two * (
double)k + one) * dth);
1468 r = 0.5 * (r + rlast);
1470 for (j = 1; j <
STOP; ++j)
1474 for (i = 0, sum = 0.0; i < k; ++i)
1475 sum += one / (r - z[i]);
1477 delr = -poly / (pder - sum * poly);
1479 if (fabs(delr) <
EPS)
1512 void JacZeros(
const int n,
double *a,
double *b,
const double alpha,
1519 double **z =
new double *[n];
1520 for (i = 0; i < n; i++)
1522 z[i] =
new double[n];
1523 for (j = 0; j < n; j++)
1528 for (i = 0; i < n; i++)
1544 static void RecCoeff(
const int n,
double *a,
double *b,
const double alpha,
1549 double apb, apbi, a2b2;
1560 a[0] = (
beta - alpha) / apbi;
1561 b[1] = (4.0 * (1.0 + alpha) * (1.0 +
beta) / ((apbi + 1.0) * apbi * apbi));
1563 a2b2 =
beta *
beta - alpha * alpha;
1565 for (i = 1; i < n - 1; i++)
1567 apbi = 2.0 * (i + 1) + apb;
1568 a[i] = a2b2 / ((apbi - 2.0) * apbi);
1569 b[i + 1] = (4.0 * (i + 1) * (i + 1 + alpha) * (i + 1 +
beta) *
1570 (i + 1 + apb) / ((apbi * apbi - 1) * apbi * apbi));
1573 apbi = 2.0 * n + apb;
1574 a[n - 1] = a2b2 / ((apbi - 2.0) * apbi);
1603 static void TriQL(
const int n,
double *d,
double *e,
double **z)
1605 int m, l, iter, i, k;
1606 double s, r,
p, g, f, dd, c, b;
1608 double MuZero = e[0];
1611 for (i = 0; i < n - 1; i++)
1613 e[i] =
sqrt(e[i + 1]);
1617 for (l = 0; l < n; l++)
1622 for (m = l; m < n - 1; m++)
1624 dd = fabs(d[m]) + fabs(d[m + 1]);
1625 if (fabs(e[m]) + dd == dd)
1632 fprintf(stderr,
"triQL: Too many iterations in TQLI");
1635 g = (d[l + 1] - d[l]) / (2.0 * e[l]);
1636 r =
sqrt((g * g) + 1.0);
1637 g = d[m] - d[l] + e[l] / (g +
sign(r, g));
1640 for (i = m - 1; i >= l; i--)
1644 if (fabs(f) >= fabs(g))
1647 r =
sqrt((c * c) + 1.0);
1654 r =
sqrt((s * s) + 1.0);
1659 r = (d[i] - g) * s + 2.0 * c * b;
1665 for (k = 0; k < n; k++)
1668 z[k][i + 1] = s * z[k][i] + c * f;
1669 z[k][i] = c * z[k][i] - s * f;
1682 for (i = 0; i < n - 1; ++i)
1686 for (l = i + 1; l < n; ++l)
1695 double temp = z[0][k];
1701 for (i = 0; i < n; i++)
1703 e[i] = MuZero * z[0][i] * z[0][i];
1720 int size = (int)floor(n / 2.0) + 2;
1721 double *s =
new double[size];
1722 double *t =
new double[size];
1725 for (i = 0; i < size; i++)
1732 for (m = 0; m <= n - 2; m++)
1735 for (k = (
int)floor((m + 1) / 2.0); k >= 0; k--)
1738 u = u + (a[k + n + 1] - a[l]) * t[k + 1] + b[k + n + 1] * s[k] -
1749 for (j = (
int)floor(n / 2.0); j >= 0; j--)
1754 for (m = n - 1; m <= 2 * n - 3; m++)
1757 for (k = m + 1 - n; k <= floor((m - 1) / 2.0); k++)
1761 u = u - (a[k + n + 1] - a[l]) * t[j + 1] - b[k + n + 1] * s[j + 1] +
1770 a[k] + (s[j + 1] - b[k + n + 1] * s[j + 2]) / t[j + 2];
1775 b[k + n + 1] = s[j + 1] / s[j + 2];
1784 a[2 * n] = a[n - 1] - b[2 * n] * s[1] / t[1];
1797 void chri1(
int n,
double *a,
double *b,
double *a0,
double *b0,
double z)
1800 double q = ceil(3.0 * n / 2);
1801 int size = (int)q + 1;
1804 fprintf(stderr,
"input arrays a and b are too short\n");
1806 double *r =
new double[n + 1];
1808 r[1] = z - a[1] - b[1] / r[0];
1809 a0[0] = a[1] + r[1] - r[0];
1810 b0[0] = -r[0] * b[0];
1818 for (k = 1; k < n; k++)
1820 r[k + 1] = z - a[k + 1] - b[k + 1] / r[k];
1821 a0[k] = a[k + 1] + r[k + 1] - r[k];
1822 b0[k] = b[k] * r[k] / r[k - 1];
1838 int n, std::complex<Nektar::NekDouble> y)
1840 std::complex<Nektar::NekDouble> z(1.0, 0.0);
1841 std::complex<Nektar::NekDouble> zbes(1.0, 0.0);
1842 std::complex<Nektar::NekDouble> zarg;
1847 zarg = -0.25 * y * y;
1849 while (
abs(z) > tol && i <= maxit)
1851 z = z * (1.0 / i / (i + n) * zarg);
1858 for (i = 1; i <= n; i++)
#define jacobz(n, z, alpha, beta)
zero determination using Newton iteration with polynomial deflation
#define sign(a, b)
return the sign(b)*a
#define EPS
Precision tolerance for two points to be similar.
#define STOP
Maximum number of iterations in polynomial defalation routine Jacobz.
@ beta
Gauss Radau pinned at x=-1,.
The namespace associated with the the Polylib library (Polylib introduction)
double gammaF(const double)
Calculate the Gamma function , , for integer values and halves.
void Dgj(double *D, const double *z, const int np, const double alpha, const double beta)
Compute the Derivative Matrix and its transpose associated with the Gauss-Jacobi zeros.
void zwgrjm(double *z, double *w, const int np, const double alpha, const double beta)
Gauss-Radau-Jacobi zeros and weights with end point at z=-1.
void JacZeros(const int n, double *a, double *b, const double alpha, const double beta)
Zero and Weight determination through the eigenvalues and eigenvectors of a tridiagonal matrix from t...
void zwgrjp(double *z, double *w, const int np, const double alpha, const double beta)
Gauss-Radau-Jacobi zeros and weights with end point at z=1.
double laginterp(double z, int j, const double *zj, int np)
void chri1(int, double *, double *, double *, double *, double)
Given a weight function through the first n+1 coefficients a and b of its orthogonal polynomials thi...
void Dglj(double *D, const double *z, const int np, const double alpha, const double beta)
Compute the Derivative Matrix associated with the Gauss-Lobatto-Jacobi zeros.
void Imgrjp(double *im, const double *zgrj, const double *zm, const int nz, const int mz, const double alpha, const double beta)
Interpolation Operator from Gauss-Radau-Jacobi points (including z=1) to an arbitrary distrubtion at ...
void Qg(double *Q, const double *z, const int np, const int offset)
Compute the Integration Matrix.
void zwglj(double *z, double *w, const int np, const double alpha, const double beta)
Gauss-Lobatto-Jacobi zeros and weights with end point at z=-1,1.
void zwgj(double *z, double *w, const int np, const double alpha, const double beta)
Gauss-Jacobi zeros and weights.
void polycoeffs(const int i, const double *z, double *c, const int np)
void Imgj(double *im, const double *zgj, const double *zm, const int nz, const int mz, const double alpha, const double beta)
Interpolation Operator from Gauss-Jacobi points to an arbitrary distribution at points zm.
static void RecCoeff(const int, double *, double *, const double, const double)
The routine finds the recurrence coefficients a and b of the orthogonal polynomials.
double hgrjm(const int i, const double z, const double *zgrj, const int np, const double alpha, const double beta)
Compute the value of the i th Lagrangian interpolant through the np Gauss-Radau-Jacobi points zgrj at...
double gammaFracGammaF(const int, const double, const int, const double)
Calculate fraction of two Gamma functions, , for integer values and halves.
static void TriQL(const int, double *, double *, double **)
QL algorithm for symmetric tridiagonal matrix.
static void Jacobz(const int n, double *z, const double alpha, const double beta)
Calculate the n zeros, z, of the Jacobi polynomial, i.e. .
double hgj(const int i, const double z, const double *zgj, const int np, const double alpha, const double beta)
Compute the value of the i th Lagrangian interpolant through the np Gauss-Jacobi points zgj at the ar...
void Imgrjm(double *im, const double *zgrj, const double *zm, const int nz, const int mz, const double alpha, const double beta)
Interpolation Operator from Gauss-Radau-Jacobi points (including z=-1) to an arbitrary distrubtion at...
void zwgk(double *z, double *w, const int npt, const double alpha, const double beta)
Gauss-Kronrod-Jacobi zeros and weights.
void Dgrjm(double *D, const double *z, const int np, const double alpha, const double beta)
Compute the Derivative Matrix and its transpose associated with the Gauss-Radau-Jacobi zeros with a z...
std::complex< Nektar::NekDouble > ImagBesselComp(int n, std::complex< Nektar::NekDouble > y)
Calcualte the bessel function of the first kind with complex double input y. Taken from Numerical Rec...
void Dgrjp(double *D, const double *z, const int np, const double alpha, const double beta)
Compute the Derivative Matrix associated with the Gauss-Radau-Jacobi zeros with a zero at z=1.
double hgrjp(const int i, const double z, const double *zgrj, const int np, const double alpha, const double beta)
Compute the value of the i th Lagrangian interpolant through the np Gauss-Radau-Jacobi points zgrj at...
void zwrk(double *z, double *w, const int npt, const double alpha, const double beta)
Gauss-Radau-Kronrod-Jacobi zeros and weights.
double hglj(const int i, const double z, const double *zglj, const int np, const double alpha, const double beta)
Compute the value of the i th Lagrangian interpolant through the np Gauss-Lobatto-Jacobi points zgrj ...
void Imglj(double *im, const double *zglj, const double *zm, const int nz, const int mz, const double alpha, const double beta)
Interpolation Operator from Gauss-Lobatto-Jacobi points to an arbitrary distrubtion at points zm.
void jacobd(const int np, const double *z, double *polyd, const int n, const double alpha, const double beta)
Calculate the derivative of Jacobi polynomials.
double optdiff(double xl, double xr)
The following function is used to circumvent/reduce "Subtractive Cancellation" The expression 1/dz is...
void jacobfd(const int np, const double *z, double *poly_in, double *polyd, const int n, const double alpha, const double beta)
Routine to calculate Jacobi polynomials, , and their first derivative, .
void JKMatrix(int, double *, double *)
Calcualtes the Jacobi-kronrod matrix by determining the a and coefficients.
void zwlk(double *z, double *w, const int npt, const double alpha, const double beta)
Gauss-Lobatto-Kronrod-Jacobi zeros and weights.
scalarT< T > abs(scalarT< T > in)
scalarT< T > sqrt(scalarT< T > in)