45#define EPS 100 * DBL_EPSILON
47#define sign(a, b) ((b) < 0 ? -fabs(a) : fabs(a))
59 int m_digits =
static_cast<int>(fabs(floor(log10(DBL_EPSILON))) - 1);
61 if (fabs(xl - xr) < 1.e-4)
64 m_expn =
static_cast<int>(floor(log10(fabs(xl - xr))));
65 m_xln = xl * powl(10.0L, -m_expn) -
66 floor(xl * powl(10.0L,
69 xr * powl(10.0L, -m_expn) -
74 round(m_xln * powl(10.0L, m_digits + m_expn));
75 m_xrn = round(m_xrn * powl(10.0L, m_digits + m_expn));
77 return powl(10.0L, -m_digits) * (m_xln - m_xrn);
85double laginterp(
double z,
int j,
const double *zj,
int np)
88 for (
int i = 0; i < np; i++)
92 temp *=
optdiff(
z, zj[i]) / (zj[j] - zj[i]);
101 for (
int j = 0; j < np; ++j)
106 for (
int i = 0; i < np; ++i)
114 tmp /= (zj[k] - zj[i]);
124#define POLYNOMIAL_DEFLATION 0
126#ifdef POLYNOMIAL_DEFLATION
128#define jacobz(n, z, alpha, beta) Jacobz(n, z, alpha, beta)
131#define jacobz(n, z, alpha, beta) JacZeros(n, z, alpha, beta)
135static void Jacobz(
const int n,
double *
z,
const double alpha,
137static void RecCoeff(
const int,
double *,
double *,
const double,
const double);
138static void TriQL(
const int,
double *,
double *,
double **);
139void JKMatrix(
int,
double *,
double *);
140void chri1(
int,
double *,
double *,
double *,
double *,
double);
152void zwgj(
double *
z,
double *
w,
const int np,
const double alpha,
156 double fac, one = 1.0, two = 2.0, apb = alpha +
beta;
161 fac = pow(two, apb + one) *
gammaFracGammaF(np + 1, alpha, np + 1, 0.0) *
164 for (i = 0; i < np; ++i)
166 w[i] = fac / (
w[i] *
w[i] * (one -
z[i] *
z[i]));
182void zwgrjm(
double *
z,
double *
w,
const int np,
const double alpha,
194 double fac, one = 1.0, two = 2.0, apb = alpha +
beta;
204 for (i = 0; i < np; ++i)
206 w[i] = fac * (1 -
z[i]) / (
w[i] *
w[i]);
208 w[0] *= (
beta + one);
225void zwgrjp(
double *
z,
double *
w,
const int np,
const double alpha,
237 double fac, one = 1.0, two = 2.0, apb = alpha +
beta;
247 for (i = 0; i < np; ++i)
249 w[i] = fac * (1 +
z[i]) / (
w[i] *
w[i]);
251 w[np - 1] *= (alpha + one);
266void zwglj(
double *
z,
double *
w,
const int np,
const double alpha,
286 double fac, one = 1.0, apb = alpha +
beta, two = 2.0;
297 for (i = 0; i < np; ++i)
299 w[i] = fac / (
w[i] *
w[i]);
301 w[0] *= (
beta + one);
302 w[np - 1] *= (alpha + one);
317void zwgk(
double *
z,
double *
w,
const int npt,
const double alpha,
321 int np = (npt - 1) / 2;
326 int kpoints = 2 * np + 1;
329 int ncoeffs = (int)floor(3.0 * (np + 1) / 2);
334 double *a =
new double[kpoints];
335 double *b =
new double[kpoints];
338 for (i = 0; i < kpoints; i++)
351 double **zmatrix =
new double *[kpoints];
352 for (i = 0; i < kpoints; i++)
354 zmatrix[i] =
new double[kpoints];
355 for (j = 0; j < kpoints; j++)
360 for (i = 0; i < kpoints; i++)
366 TriQL(kpoints, a, b, zmatrix);
368 for (i = 0; i < kpoints; i++)
375 for (i = 0; i < kpoints; i++)
389void zwrk(
double *
z,
double *
w,
const int npt,
const double alpha,
397 fprintf(stderr,
"too few points in formula\n");
406 int kpoints = 2 * np;
409 int ncoeffs = (int)ceil(3.0 * np / 2);
412 double *a =
new double[ncoeffs + 1];
413 double *b =
new double[ncoeffs + 1];
416 for (i = 0; i < ncoeffs + 1; i++)
425 double *a0 =
new double[ncoeffs];
426 double *b0 =
new double[ncoeffs];
428 chri1(ncoeffs, a, b, a0, b0, end0);
430 double s = b0[0] / fabs(b0[0]);
434 double *z1 =
new double[2 * np - 1];
435 double *w1 =
new double[2 * np - 1];
436 for (i = 0; i < ncoeffs; i++)
443 double **zmatrix =
new double *[2 * np - 1];
444 for (i = 0; i < 2 * np - 1; i++)
446 zmatrix[i] =
new double[2 * np - 1];
447 for (j = 0; j < 2 * np - 1; j++)
452 for (i = 0; i < 2 * np - 1; i++)
458 TriQL(2 * np - 1, z1, w1, zmatrix);
461 for (i = 0; i < 2 * np - 1; i++)
463 w1[i] = s * w1[i] / (z1[i] - end0);
469 for (i = 1; i < kpoints; i++)
481 for (i = 0; i < 2 * np - 1; i++)
495void zwlk(
double *
z,
double *
w,
const int npt,
const double alpha,
499 int np = (npt + 1) / 2;
503 fprintf(stderr,
"too few points in formula\n");
512 int kpoints = 2 * np - 1;
515 int ncoeffs = (int)ceil(3.0 * np / 2) - 1;
518 double *a =
new double[ncoeffs + 1];
519 double *b =
new double[ncoeffs + 1];
522 for (i = 0; i < ncoeffs + 1; i++)
531 double *a0 =
new double[ncoeffs];
532 double *b0 =
new double[ncoeffs];
534 chri1(ncoeffs, a, b, a0, b0, endl);
536 double *a1 =
new double[ncoeffs - 1];
537 double *b1 =
new double[ncoeffs - 1];
539 chri1(ncoeffs - 1, a0, b0, a1, b1, endr);
541 double s = b1[0] / fabs(b1[0]);
545 double *z1 =
new double[2 * np - 3];
546 double *w1 =
new double[2 * np - 3];
547 for (i = 0; i < ncoeffs; i++)
554 double **zmatrix =
new double *[2 * np - 3];
555 for (i = 0; i < 2 * np - 3; i++)
557 zmatrix[i] =
new double[2 * np - 3];
558 for (j = 0; j < 2 * np - 3; j++)
563 for (i = 0; i < 2 * np - 3; i++)
569 TriQL(2 * np - 3, z1, w1, zmatrix);
572 double sumW1Z1 = 0.0;
573 for (i = 0; i < 2 * np - 3; i++)
575 w1[i] = s * w1[i] / (z1[i] - endl) / (z1[i] - endr);
577 sumW1Z1 += z1[i] * w1[i];
580 double c0 = b[0] - sumW1;
581 double c1 = a[0] * b[0] - sumW1Z1;
584 z[2 * np - 2] = endr;
585 w[0] = (c0 * endr - c1) / (endr - endl);
586 w[2 * np - 2] = (c1 - c0 * endl) / (endr - endl);
588 for (i = 1; i < kpoints - 1; i++)
601 for (i = 0; i < 2 * np - 3; i++)
611void Qg(
double *Q,
const double *
z,
const int np)
623 pd = (
double *)malloc(np *
sizeof(
double));
625 for (i = 0; i < np; i++)
628 for (j = 0; j < np; j++)
631 for (k = 0; k < np; k++)
633 Q[j * np + i] += pd[k] / (k + 1) * pow(
z[j], k + 1);
653void Dgj(
double *D,
const double *
z,
const int np,
const double alpha,
657 double one = 1.0, two = 2.0;
668 pd = (
double *)malloc(np *
sizeof(
double));
671 for (i = 0; i < np; i++)
673 for (j = 0; j < np; j++)
678 D[i * np + j] = pd[j] / (pd[i] * (
z[j] -
z[i]));
683 (alpha -
beta + (alpha +
beta + two) *
z[j]) /
684 (two * (one -
z[j] *
z[j]));
704void Dgrjm(
double *D,
const double *
z,
const int np,
const double alpha,
715 double one = 1.0, two = 2.0;
718 pd = (
double *)malloc(np *
sizeof(
double));
722 jacobd(np - 1,
z + 1, pd + 1, np - 1, alpha,
beta + 1);
723 for (i = 1; i < np; ++i)
728 for (i = 0; i < np; i++)
730 for (j = 0; j < np; j++)
734 D[i * np + j] = pd[j] / (pd[i] * (
z[j] -
z[i]));
740 D[i * np + j] = -(np + alpha +
beta + one) *
741 (np - one) / (two * (
beta + two));
746 (alpha -
beta + one + (alpha +
beta + one) *
z[j]) /
747 (two * (one -
z[j] *
z[j]));
768void Dgrjp(
double *D,
const double *
z,
const int np,
const double alpha,
779 double one = 1.0, two = 2.0;
782 pd = (
double *)malloc(np *
sizeof(
double));
785 for (i = 0; i < np - 1; ++i)
790 pd[np - 1] /=
gammaF(alpha + two);
792 for (i = 0; i < np; i++)
794 for (j = 0; j < np; j++)
798 D[i * np + j] = pd[j] / (pd[i] * (
z[j] -
z[i]));
804 D[i * np + j] = (np + alpha +
beta + one) * (np - one) /
805 (two * (alpha + two));
810 (alpha -
beta - one + (alpha +
beta + one) *
z[j]) /
811 (two * (one -
z[j] *
z[j]));
833void Dglj(
double *D,
const double *
z,
const int np,
const double alpha,
843 double one = 1.0, two = 2.0;
846 pd = (
double *)malloc(np *
sizeof(
double));
850 jacobd(np - 2,
z + 1, pd + 1, np - 2, alpha + 1,
beta + 1);
851 for (i = 1; i < np - 1; ++i)
853 pd[i] *= (one -
z[i] *
z[i]);
856 pd[np - 1] /=
gammaF(alpha + two);
858 for (i = 0; i < np; i++)
860 for (j = 0; j < np; j++)
864 D[i * np + j] = pd[j] / (pd[i] * (
z[j] -
z[i]));
871 (alpha - (np - 1) * (np + alpha +
beta)) /
872 (two * (
beta + two));
874 else if (j == np - 1)
877 -(
beta - (np - 1) * (np + alpha +
beta)) /
878 (two * (alpha + two));
882 D[i * np + j] = (alpha -
beta + (alpha +
beta) *
z[j]) /
883 (two * (one -
z[j] *
z[j]));
914double hgj(
const int i,
const double z,
const double *zgj,
const int np,
915 [[maybe_unused]]
const double alpha,
916 [[maybe_unused]]
const double beta)
951double hgrjm(
const int i,
const double z,
const double *zgrj,
const int np,
952 [[maybe_unused]]
const double alpha,
953 [[maybe_unused]]
const double beta)
988double hgrjp(
const int i,
const double z,
const double *zgrj,
const int np,
989 [[maybe_unused]]
const double alpha,
990 [[maybe_unused]]
const double beta)
1025double hglj(
const int i,
const double z,
const double *zglj,
const int np,
1026 [[maybe_unused]]
const double alpha,
1027 [[maybe_unused]]
const double beta)
1054void Imgj(
double *im,
const double *zgj,
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] =
hgj(i, zp, zgj, nz, alpha,
beta);
1085void Imgrjm(
double *im,
const double *zgrj,
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] =
hgrjm(i, zp, zgrj, nz, alpha,
beta);
1116void Imgrjp(
double *im,
const double *zgrj,
const double *zm,
const int nz,
1117 const int mz,
const double alpha,
const double beta)
1122 for (i = 0; i < nz; i++)
1124 for (j = 0; j < mz; j++)
1127 im[i * mz + j] =
hgrjp(i, zp, zgrj, nz, alpha,
beta);
1147void Imglj(
double *im,
const double *zglj,
const double *zm,
const int nz,
1148 const int mz,
const double alpha,
const double beta)
1153 for (i = 0; i < nz; i++)
1155 for (j = 0; j < mz; j++)
1158 im[i * mz + j] =
hglj(i, zp, zglj, nz, alpha,
beta);
1176 for (j = 0; j < np; j++)
1188 for (j = 0; j < np; j++)
1194 for (k = m - 1; k > 0; k--)
1196 c[k] *= -1.0 *
z[j];
1199 c[0] *= -1.0 *
z[j];
1202 for (j = 0; j < np; j++)
1248void jacobfd(
const int np,
const double *
z,
double *poly_in,
double *polyd,
1249 const int n,
const double alpha,
const double beta)
1252 double zero = 0.0, one = 1.0, two = 2.0;
1263 for (i = 0; i < np; ++i)
1270 for (i = 0; i < np; ++i)
1280 for (i = 0; i < np; ++i)
1282 poly_in[i] = 0.5 * (alpha -
beta + (alpha +
beta + two) *
z[i]);
1287 for (i = 0; i < np; ++i)
1289 polyd[i] = 0.5 * (alpha +
beta + two);
1296 double a1, a2, a3, a4;
1297 double two = 2.0, apb = alpha +
beta;
1298 double *poly, *polyn1, *polyn2;
1302 polyn1 = (
double *)malloc(2 * np *
sizeof(
double));
1303 polyn2 = polyn1 + np;
1308 polyn1 = (
double *)malloc(3 * np *
sizeof(
double));
1309 polyn2 = polyn1 + np;
1313 for (i = 0; i < np; ++i)
1316 polyn1[i] = 0.5 * (alpha -
beta + (alpha +
beta + two) *
z[i]);
1319 for (k = 2; k <= n; ++k)
1321 a1 = two * k * (k + apb) * (two * k + apb - two);
1322 a2 = (two * k + apb - one) * (alpha * alpha -
beta *
beta);
1324 (two * k + apb - two) * (two * k + apb - one) * (two * k + apb);
1325 a4 = two * (k + alpha - one) * (k +
beta - one) * (two * k + apb);
1331 for (i = 0; i < np; ++i)
1333 poly[i] = (a2 + a3 *
z[i]) * polyn1[i] - a4 * polyn2[i];
1334 polyn2[i] = polyn1[i];
1335 polyn1[i] = poly[i];
1341 a1 = n * (alpha -
beta);
1342 a2 = n * (two * n + alpha +
beta);
1343 a3 = two * (n + alpha) * (n +
beta);
1344 a4 = (two * n + alpha +
beta);
1350 for (i = 0; i < np; ++i)
1352 polyd[i] = (a1 - a2 *
z[i]) * poly[i] + a3 * polyn2[i];
1353 polyd[i] /= (one -
z[i] *
z[i]);
1378void jacobd(
const int np,
const double *
z,
double *polyd,
const int n,
1379 const double alpha,
const double beta)
1385 for (i = 0; i < np; ++i)
1393 jacobfd(np,
z, polyd,
nullptr, n - 1, alpha + one,
beta + one);
1394 for (i = 0; i < np; ++i)
1396 polyd[i] *= 0.5 * (alpha +
beta + (double)n + one);
1419 gamma = -2.0 *
sqrt(M_PI);
1425 else if ((x - (
int)x) == 0.5)
1437 else if ((x - (
int)x) == 0.0)
1450 fprintf(stderr,
"%lf is not of integer or half order\n", x);
1472 double halfa = fabs(alpha -
int(alpha));
1473 double halfb = fabs(
beta -
int(
beta));
1474 if (halfa == 0.0 && halfb == 0.0)
1480 for (
int tmp = X - 1; tmp > Y - 1; tmp -= 1)
1487 for (
int tmp = Y - 1; tmp > X - 1; tmp -= 1)
1494 else if (halfa == 0.5 && halfb == 0.5)
1496 double X = x + alpha;
1497 double Y = y +
beta;
1500 for (
int tmp =
int(X); tmp > int(Y); tmp -= 1)
1507 for (
int tmp =
int(Y); tmp > int(X); tmp -= 1)
1516 double X = x + alpha;
1517 double Y = y +
beta;
1518 while (X > 1 || Y > 1)
1533 gamma *=
sqrt(M_PI);
1537 gamma /=
sqrt(M_PI);
1541 fprintf(stderr,
"%lf or %lf is not of integer or half order\n", X,
1560 int n, std::complex<Nektar::NekDouble> y)
1562 std::complex<Nektar::NekDouble>
z(1.0, 0.0);
1563 std::complex<Nektar::NekDouble> zbes(1.0, 0.0);
1564 std::complex<Nektar::NekDouble> zarg;
1569 zarg = -0.25 * y * y;
1571 while (
abs(
z) > tol && i <= maxit)
1573 z =
z * (1.0 / i / (i + n) * zarg);
1582 for (i = 1; i <= n; i++)
1597static void Jacobz(
const int n,
double *
z,
const double alpha,
1601 double dth = M_PI / (2.0 * (double)n);
1602 double poly, pder, rlast = 0.0;
1603 double sum, delr, r;
1604 double one = 1.0, two = 2.0;
1611 for (k = 0; k < n; ++k)
1613 r = -cos((two * (
double)k + one) * dth);
1616 r = 0.5 * (r + rlast);
1619 for (j = 1; j <
STOP; ++j)
1623 for (i = 0, sum = 0.0; i < k; ++i)
1625 sum += one / (r -
z[i]);
1628 delr = -poly / (pder - sum * poly);
1630 if (fabs(delr) <
EPS)
1665void JacZeros(
const int n,
double *a,
double *b,
const double alpha,
1672 double **
z =
new double *[n];
1673 for (i = 0; i < n; i++)
1675 z[i] =
new double[n];
1676 for (j = 0; j < n; j++)
1681 for (i = 0; i < n; i++)
1697static void RecCoeff(
const int n,
double *a,
double *b,
const double alpha,
1702 double apb, apbi, a2b2;
1715 a[0] = (
beta - alpha) / apbi;
1716 b[1] = (4.0 * (1.0 + alpha) * (1.0 +
beta) / ((apbi + 1.0) * apbi * apbi));
1718 a2b2 =
beta *
beta - alpha * alpha;
1720 for (i = 1; i < n - 1; i++)
1722 apbi = 2.0 * (i + 1) + apb;
1723 a[i] = a2b2 / ((apbi - 2.0) * apbi);
1724 b[i + 1] = (4.0 * (i + 1) * (i + 1 + alpha) * (i + 1 +
beta) *
1725 (i + 1 + apb) / ((apbi * apbi - 1) * apbi * apbi));
1728 apbi = 2.0 * n + apb;
1729 a[n - 1] = a2b2 / ((apbi - 2.0) * apbi);
1758static void TriQL(
const int n,
double *
d,
double *e,
double **
z)
1760 int m, l, iter, i, k;
1761 double s, r,
p, g, f, dd, c, b;
1763 double MuZero = e[0];
1766 for (i = 0; i < n - 1; i++)
1768 e[i] =
sqrt(e[i + 1]);
1772 for (l = 0; l < n; l++)
1777 for (m = l; m < n - 1; m++)
1779 dd = fabs(
d[m]) + fabs(
d[m + 1]);
1780 if (fabs(e[m]) + dd == dd)
1789 fprintf(stderr,
"triQL: Too many iterations in TQLI");
1792 g = (
d[l + 1] -
d[l]) / (2.0 * e[l]);
1793 r =
sqrt((g * g) + 1.0);
1794 g =
d[m] -
d[l] + e[l] / (g +
sign(r, g));
1797 for (i = m - 1; i >= l; i--)
1801 if (fabs(f) >= fabs(g))
1804 r =
sqrt((c * c) + 1.0);
1811 r =
sqrt((s * s) + 1.0);
1816 r = (
d[i] - g) * s + 2.0 * c * b;
1822 for (k = 0; k < n; k++)
1825 z[k][i + 1] = s *
z[k][i] + c * f;
1826 z[k][i] = c *
z[k][i] - s * f;
1839 for (i = 0; i < n - 1; ++i)
1843 for (l = i + 1; l < n; ++l)
1854 double temp =
z[0][k];
1860 for (i = 0; i < n; i++)
1862 e[i] = MuZero *
z[0][i] *
z[0][i];
1879 int size = (int)floor(n / 2.0) + 2;
1880 double *s =
new double[size];
1881 double *t =
new double[size];
1884 for (i = 0; i < size; i++)
1891 for (m = 0; m <= n - 2; m++)
1894 for (k = (
int)floor((m + 1) / 2.0); k >= 0; k--)
1897 u = u + (a[k + n + 1] - a[l]) * t[k + 1] + b[k + n + 1] * s[k] -
1908 for (j = (
int)floor(n / 2.0); j >= 0; j--)
1913 for (m = n - 1; m <= 2 * n - 3; m++)
1916 for (k = m + 1 - n; k <= floor((m - 1) / 2.0); k++)
1920 u = u - (a[k + n + 1] - a[l]) * t[j + 1] - b[k + n + 1] * s[j + 1] +
1929 a[k] + (s[j + 1] - b[k + n + 1] * s[j + 2]) / t[j + 2];
1934 b[k + n + 1] = s[j + 1] / s[j + 2];
1943 a[2 * n] = a[n - 1] - b[2 * n] * s[1] / t[1];
1956void chri1(
int n,
double *a,
double *b,
double *a0,
double *b0,
double z)
1959 double q = ceil(3.0 * n / 2);
1960 int size = (int)
q + 1;
1963 fprintf(stderr,
"input arrays a and b are too short\n");
1965 double *r =
new double[n + 1];
1967 r[1] =
z - a[1] - b[1] / r[0];
1968 a0[0] = a[1] + r[1] - r[0];
1969 b0[0] = -r[0] * b[0];
1977 for (k = 1; k < n; k++)
1979 r[k + 1] =
z - a[k + 1] - b[k + 1] / r[k];
1980 a0[k] = a[k + 1] + r[k + 1] - r[k];
1981 b0[k] = b[k] * r[k] / r[k - 1];
#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,.
std::vector< double > w(NPUPPER)
std::vector< double > z(NPUPPER)
std::vector< double > d(NPUPPER *NPUPPER)
std::vector< double > q(NPUPPER *NPUPPER)
The namespace associated with the the Polylib library (Polylib introduction)
double laginterpderiv(double z, int k, const double *zj, int np)
double gammaF(const double x)
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 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 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...
void Qg(double *Q, const double *z, const int np)
Compute the Integration Matrix.
double gammaFracGammaF(const int x, const double alpha, const int y, const double beta)
Calculate fraction of two Gamma functions, , for integer values and halves.
void polycoeffs(double *c, const double *z, const int i, const int np)
Compute the coefficients of Lagrange interpolation polynomials.
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)