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);
87double 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]);
103 for (
int j = 0; j < np; ++j)
108 for (
int i = 0; i < np; ++i)
116 tmp /= (zj[k] - zj[i]);
126#define POLYNOMIAL_DEFLATION 0
128#ifdef POLYNOMIAL_DEFLATION
130#define jacobz(n, z, alpha, beta) Jacobz(n, z, alpha, beta)
133#define jacobz(n, z, alpha, beta) JacZeros(n, z, alpha, beta)
137static void Jacobz(
const int n,
double *
z,
const double alpha,
139static void RecCoeff(
const int,
double *,
double *,
const double,
const double);
140static void TriQL(
const int,
double *,
double *,
double **);
141void JKMatrix(
int,
double *,
double *);
142void chri1(
int,
double *,
double *,
double *,
double *,
double);
154void zwgj(
double *
z,
double *
w,
const int np,
const double alpha,
158 double fac, one = 1.0, two = 2.0, apb = alpha +
beta;
163 fac = pow(two, apb + one) *
gammaFracGammaF(np + 1, alpha, np + 1, 0.0) *
166 for (i = 0; i < np; ++i)
167 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)
205 w[i] = fac * (1 -
z[i]) / (
w[i] *
w[i]);
206 w[0] *= (
beta + one);
223void zwgrjp(
double *
z,
double *
w,
const int np,
const double alpha,
235 double fac, one = 1.0, two = 2.0, apb = alpha +
beta;
245 for (i = 0; i < np; ++i)
246 w[i] = fac * (1 +
z[i]) / (
w[i] *
w[i]);
247 w[np - 1] *= (alpha + one);
262void zwglj(
double *
z,
double *
w,
const int np,
const double alpha,
282 double fac, one = 1.0, apb = alpha +
beta, two = 2.0;
293 for (i = 0; i < np; ++i)
294 w[i] = fac / (
w[i] *
w[i]);
295 w[0] *= (
beta + one);
296 w[np - 1] *= (alpha + one);
311void zwgk(
double *
z,
double *
w,
const int npt,
const double alpha,
315 int np = (npt - 1) / 2;
320 int kpoints = 2 * np + 1;
323 int ncoeffs = (int)floor(3.0 * (np + 1) / 2);
328 double *a =
new double[kpoints];
329 double *b =
new double[kpoints];
332 for (i = 0; i < kpoints; i++)
345 double **zmatrix =
new double *[kpoints];
346 for (i = 0; i < kpoints; i++)
348 zmatrix[i] =
new double[kpoints];
349 for (j = 0; j < kpoints; j++)
354 for (i = 0; i < kpoints; i++)
360 TriQL(kpoints, a, b, zmatrix);
362 for (i = 0; i < kpoints; i++)
369 for (i = 0; i < kpoints; i++)
383void zwrk(
double *
z,
double *
w,
const int npt,
const double alpha,
391 fprintf(stderr,
"too few points in formula\n");
400 int kpoints = 2 * np;
403 int ncoeffs = (int)ceil(3.0 * np / 2);
406 double *a =
new double[ncoeffs + 1];
407 double *b =
new double[ncoeffs + 1];
410 for (i = 0; i < ncoeffs + 1; i++)
419 double *a0 =
new double[ncoeffs];
420 double *b0 =
new double[ncoeffs];
422 chri1(ncoeffs, a, b, a0, b0, end0);
424 double s = b0[0] / fabs(b0[0]);
428 double *z1 =
new double[2 * np - 1];
429 double *w1 =
new double[2 * np - 1];
430 for (i = 0; i < ncoeffs; i++)
437 double **zmatrix =
new double *[2 * np - 1];
438 for (i = 0; i < 2 * np - 1; i++)
440 zmatrix[i] =
new double[2 * np - 1];
441 for (j = 0; j < 2 * np - 1; j++)
446 for (i = 0; i < 2 * np - 1; i++)
452 TriQL(2 * np - 1, z1, w1, zmatrix);
455 for (i = 0; i < 2 * np - 1; i++)
457 w1[i] = s * w1[i] / (z1[i] - end0);
463 for (i = 1; i < kpoints; i++)
475 for (i = 0; i < 2 * np - 1; i++)
489void zwlk(
double *
z,
double *
w,
const int npt,
const double alpha,
493 int np = (npt + 1) / 2;
497 fprintf(stderr,
"too few points in formula\n");
506 int kpoints = 2 * np - 1;
509 int ncoeffs = (int)ceil(3.0 * np / 2) - 1;
512 double *a =
new double[ncoeffs + 1];
513 double *b =
new double[ncoeffs + 1];
516 for (i = 0; i < ncoeffs + 1; i++)
525 double *a0 =
new double[ncoeffs];
526 double *b0 =
new double[ncoeffs];
528 chri1(ncoeffs, a, b, a0, b0, endl);
530 double *a1 =
new double[ncoeffs - 1];
531 double *b1 =
new double[ncoeffs - 1];
533 chri1(ncoeffs - 1, a0, b0, a1, b1, endr);
535 double s = b1[0] / fabs(b1[0]);
539 double *z1 =
new double[2 * np - 3];
540 double *w1 =
new double[2 * np - 3];
541 for (i = 0; i < ncoeffs; i++)
548 double **zmatrix =
new double *[2 * np - 3];
549 for (i = 0; i < 2 * np - 3; i++)
551 zmatrix[i] =
new double[2 * np - 3];
552 for (j = 0; j < 2 * np - 3; j++)
557 for (i = 0; i < 2 * np - 3; i++)
563 TriQL(2 * np - 3, z1, w1, zmatrix);
566 double sumW1Z1 = 0.0;
567 for (i = 0; i < 2 * np - 3; i++)
569 w1[i] = s * w1[i] / (z1[i] - endl) / (z1[i] - endr);
571 sumW1Z1 += z1[i] * w1[i];
574 double c0 = b[0] - sumW1;
575 double c1 = a[0] * b[0] - sumW1Z1;
578 z[2 * np - 2] = endr;
579 w[0] = (c0 * endr - c1) / (endr - endl);
580 w[2 * np - 2] = (c1 - c0 * endl) / (endr - endl);
582 for (i = 1; i < kpoints - 1; i++)
595 for (i = 0; i < 2 * np - 3; i++)
605void Qg(
double *Q,
const double *
z,
const int np)
617 pd = (
double *)malloc(np *
sizeof(
double));
619 for (i = 0; i < np; i++)
622 for (j = 0; j < np; j++)
625 for (k = 0; k < np; k++)
627 Q[j * np + i] += pd[k] / (k + 1) * pow(
z[j], k + 1);
647void Dgj(
double *D,
const double *
z,
const int np,
const double alpha,
651 double one = 1.0, two = 2.0;
662 pd = (
double *)malloc(np *
sizeof(
double));
665 for (i = 0; i < np; i++)
667 for (j = 0; j < np; j++)
671 D[i * np + j] = pd[j] / (pd[i] * (
z[j] -
z[i]));
674 (alpha -
beta + (alpha +
beta + two) *
z[j]) /
675 (two * (one -
z[j] *
z[j]));
694void Dgrjm(
double *D,
const double *
z,
const int np,
const double alpha,
705 double one = 1.0, two = 2.0;
708 pd = (
double *)malloc(np *
sizeof(
double));
712 jacobd(np - 1,
z + 1, pd + 1, np - 1, alpha,
beta + 1);
713 for (i = 1; i < np; ++i)
716 for (i = 0; i < np; i++)
718 for (j = 0; j < np; j++)
721 D[i * np + j] = pd[j] / (pd[i] * (
z[j] -
z[i]));
725 D[i * np + j] = -(np + alpha +
beta + one) *
726 (np - one) / (two * (
beta + two));
729 (alpha -
beta + one + (alpha +
beta + one) *
z[j]) /
730 (two * (one -
z[j] *
z[j]));
750void Dgrjp(
double *D,
const double *
z,
const int np,
const double alpha,
761 double one = 1.0, two = 2.0;
764 pd = (
double *)malloc(np *
sizeof(
double));
767 for (i = 0; i < np - 1; ++i)
770 pd[np - 1] /=
gammaF(alpha + two);
772 for (i = 0; i < np; i++)
774 for (j = 0; j < np; j++)
777 D[i * np + j] = pd[j] / (pd[i] * (
z[j] -
z[i]));
781 D[i * np + j] = (np + alpha +
beta + one) * (np - one) /
782 (two * (alpha + two));
785 (alpha -
beta - one + (alpha +
beta + one) *
z[j]) /
786 (two * (one -
z[j] *
z[j]));
807void Dglj(
double *D,
const double *
z,
const int np,
const double alpha,
817 double one = 1.0, two = 2.0;
820 pd = (
double *)malloc(np *
sizeof(
double));
824 jacobd(np - 2,
z + 1, pd + 1, np - 2, alpha + 1,
beta + 1);
825 for (i = 1; i < np - 1; ++i)
826 pd[i] *= (one -
z[i] *
z[i]);
828 pd[np - 1] /=
gammaF(alpha + two);
830 for (i = 0; i < np; i++)
832 for (j = 0; j < np; j++)
835 D[i * np + j] = pd[j] / (pd[i] * (
z[j] -
z[i]));
840 (alpha - (np - 1) * (np + alpha +
beta)) /
841 (two * (
beta + two));
842 else if (j == np - 1)
844 -(
beta - (np - 1) * (np + alpha +
beta)) /
845 (two * (alpha + two));
847 D[i * np + j] = (alpha -
beta + (alpha +
beta) *
z[j]) /
848 (two * (one -
z[j] *
z[j]));
878double hgj(
const int i,
const double z,
const double *zgj,
const int np,
879 const double alpha,
const double beta)
881 boost::ignore_unused(alpha,
beta);
913double hgrjm(
const int i,
const double z,
const double *zgrj,
const int np,
914 const double alpha,
const double beta)
916 boost::ignore_unused(alpha,
beta);
949double hgrjp(
const int i,
const double z,
const double *zgrj,
const int np,
950 const double alpha,
const double beta)
952 boost::ignore_unused(alpha,
beta);
984double hglj(
const int i,
const double z,
const double *zglj,
const int np,
985 const double alpha,
const double beta)
987 boost::ignore_unused(alpha,
beta);
1012void Imgj(
double *im,
const double *zgj,
const double *zm,
const int nz,
1013 const int mz,
const double alpha,
const double beta)
1018 for (i = 0; i < nz; ++i)
1020 for (j = 0; j < mz; ++j)
1023 im[i * mz + j] =
hgj(i, zp, zgj, nz, alpha,
beta);
1043void Imgrjm(
double *im,
const double *zgrj,
const double *zm,
const int nz,
1044 const int mz,
const double alpha,
const double beta)
1049 for (i = 0; i < nz; i++)
1051 for (j = 0; j < mz; j++)
1054 im[i * mz + j] =
hgrjm(i, zp, zgrj, nz, alpha,
beta);
1074void Imgrjp(
double *im,
const double *zgrj,
const double *zm,
const int nz,
1075 const int mz,
const double alpha,
const double beta)
1080 for (i = 0; i < nz; i++)
1082 for (j = 0; j < mz; j++)
1085 im[i * mz + j] =
hgrjp(i, zp, zgrj, nz, alpha,
beta);
1105void Imglj(
double *im,
const double *zglj,
const double *zm,
const int nz,
1106 const int mz,
const double alpha,
const double beta)
1111 for (i = 0; i < nz; i++)
1113 for (j = 0; j < mz; j++)
1116 im[i * mz + j] =
hglj(i, zp, zglj, nz, alpha,
beta);
1134 for (j = 0; j < np; j++)
1146 for (j = 0; j < np; j++)
1152 for (k = m - 1; k > 0; k--)
1154 c[k] *= -1.0 *
z[j];
1157 c[0] *= -1.0 *
z[j];
1160 for (j = 0; j < np; j++)
1206void jacobfd(
const int np,
const double *
z,
double *poly_in,
double *polyd,
1207 const int n,
const double alpha,
const double beta)
1210 double zero = 0.0, one = 1.0, two = 2.0;
1218 for (i = 0; i < np; ++i)
1221 for (i = 0; i < np; ++i)
1227 for (i = 0; i < np; ++i)
1228 poly_in[i] = 0.5 * (alpha -
beta + (alpha +
beta + two) *
z[i]);
1230 for (i = 0; i < np; ++i)
1231 polyd[i] = 0.5 * (alpha +
beta + two);
1236 double a1, a2, a3, a4;
1237 double two = 2.0, apb = alpha +
beta;
1238 double *poly, *polyn1, *polyn2;
1242 polyn1 = (
double *)malloc(2 * np *
sizeof(
double));
1243 polyn2 = polyn1 + np;
1248 polyn1 = (
double *)malloc(3 * np *
sizeof(
double));
1249 polyn2 = polyn1 + np;
1253 for (i = 0; i < np; ++i)
1256 polyn1[i] = 0.5 * (alpha -
beta + (alpha +
beta + two) *
z[i]);
1259 for (k = 2; k <= n; ++k)
1261 a1 = two * k * (k + apb) * (two * k + apb - two);
1262 a2 = (two * k + apb - one) * (alpha * alpha -
beta *
beta);
1264 (two * k + apb - two) * (two * k + apb - one) * (two * k + apb);
1265 a4 = two * (k + alpha - one) * (k +
beta - one) * (two * k + apb);
1271 for (i = 0; i < np; ++i)
1273 poly[i] = (a2 + a3 *
z[i]) * polyn1[i] - a4 * polyn2[i];
1274 polyn2[i] = polyn1[i];
1275 polyn1[i] = poly[i];
1281 a1 = n * (alpha -
beta);
1282 a2 = n * (two * n + alpha +
beta);
1283 a3 = two * (n + alpha) * (n +
beta);
1284 a4 = (two * n + alpha +
beta);
1290 for (i = 0; i < np; ++i)
1292 polyd[i] = (a1 - a2 *
z[i]) * poly[i] + a3 * polyn2[i];
1293 polyd[i] /= (one -
z[i] *
z[i]);
1318void jacobd(
const int np,
const double *
z,
double *polyd,
const int n,
1319 const double alpha,
const double beta)
1324 for (i = 0; i < np; ++i)
1329 jacobfd(np,
z, polyd, NULL, n - 1, alpha + one,
beta + one);
1330 for (i = 0; i < np; ++i)
1331 polyd[i] *= 0.5 * (alpha +
beta + (
double)n + one);
1352 gamma = -2.0 *
sqrt(M_PI);
1355 else if ((x - (
int)x) == 0.5)
1367 else if ((x - (
int)x) == 0.0)
1379 fprintf(stderr,
"%lf is not of integer or half order\n", x);
1400 double halfa = fabs(alpha -
int(alpha));
1401 double halfb = fabs(
beta -
int(
beta));
1402 if (halfa == 0.0 && halfb == 0.0)
1408 for (
int tmp = X - 1; tmp > Y - 1; tmp -= 1)
1413 for (
int tmp = Y - 1; tmp > X - 1; tmp -= 1)
1418 else if (halfa == 0.5 && halfb == 0.5)
1420 double X = x + alpha;
1421 double Y = y +
beta;
1424 for (
int tmp =
int(X); tmp > int(Y); tmp -= 1)
1429 for (
int tmp =
int(Y); tmp > int(X); tmp -= 1)
1436 double X = x + alpha;
1437 double Y = y +
beta;
1438 while (X > 1 || Y > 1)
1453 gamma *=
sqrt(M_PI);
1457 gamma /=
sqrt(M_PI);
1461 fprintf(stderr,
"%lf or %lf is not of integer or half order\n", X,
1480 int n, std::complex<Nektar::NekDouble> y)
1482 std::complex<Nektar::NekDouble>
z(1.0, 0.0);
1483 std::complex<Nektar::NekDouble> zbes(1.0, 0.0);
1484 std::complex<Nektar::NekDouble> zarg;
1489 zarg = -0.25 * y * y;
1491 while (
abs(
z) > tol && i <= maxit)
1493 z =
z * (1.0 / i / (i + n) * zarg);
1500 for (i = 1; i <= n; i++)
1515static void Jacobz(
const int n,
double *
z,
const double alpha,
1519 double dth = M_PI / (2.0 * (double)n);
1520 double poly, pder, rlast = 0.0;
1521 double sum, delr, r;
1522 double one = 1.0, two = 2.0;
1527 for (k = 0; k < n; ++k)
1529 r = -cos((two * (
double)k + one) * dth);
1531 r = 0.5 * (r + rlast);
1533 for (j = 1; j <
STOP; ++j)
1537 for (i = 0, sum = 0.0; i < k; ++i)
1538 sum += one / (r -
z[i]);
1540 delr = -poly / (pder - sum * poly);
1542 if (fabs(delr) <
EPS)
1575void JacZeros(
const int n,
double *a,
double *b,
const double alpha,
1582 double **
z =
new double *[n];
1583 for (i = 0; i < n; i++)
1585 z[i] =
new double[n];
1586 for (j = 0; j < n; j++)
1591 for (i = 0; i < n; i++)
1607static void RecCoeff(
const int n,
double *a,
double *b,
const double alpha,
1612 double apb, apbi, a2b2;
1623 a[0] = (
beta - alpha) / apbi;
1624 b[1] = (4.0 * (1.0 + alpha) * (1.0 +
beta) / ((apbi + 1.0) * apbi * apbi));
1626 a2b2 =
beta *
beta - alpha * alpha;
1628 for (i = 1; i < n - 1; i++)
1630 apbi = 2.0 * (i + 1) + apb;
1631 a[i] = a2b2 / ((apbi - 2.0) * apbi);
1632 b[i + 1] = (4.0 * (i + 1) * (i + 1 + alpha) * (i + 1 +
beta) *
1633 (i + 1 + apb) / ((apbi * apbi - 1) * apbi * apbi));
1636 apbi = 2.0 * n + apb;
1637 a[n - 1] = a2b2 / ((apbi - 2.0) * apbi);
1666static void TriQL(
const int n,
double *
d,
double *e,
double **
z)
1668 int m, l, iter, i, k;
1669 double s, r,
p, g, f, dd, c, b;
1671 double MuZero = e[0];
1674 for (i = 0; i < n - 1; i++)
1676 e[i] =
sqrt(e[i + 1]);
1680 for (l = 0; l < n; l++)
1685 for (m = l; m < n - 1; m++)
1687 dd = fabs(
d[m]) + fabs(
d[m + 1]);
1688 if (fabs(e[m]) + dd == dd)
1695 fprintf(stderr,
"triQL: Too many iterations in TQLI");
1698 g = (
d[l + 1] -
d[l]) / (2.0 * e[l]);
1699 r =
sqrt((g * g) + 1.0);
1700 g =
d[m] -
d[l] + e[l] / (g +
sign(r, g));
1703 for (i = m - 1; i >= l; i--)
1707 if (fabs(f) >= fabs(g))
1710 r =
sqrt((c * c) + 1.0);
1717 r =
sqrt((s * s) + 1.0);
1722 r = (
d[i] - g) * s + 2.0 * c * b;
1728 for (k = 0; k < n; k++)
1731 z[k][i + 1] = s *
z[k][i] + c * f;
1732 z[k][i] = c *
z[k][i] - s * f;
1745 for (i = 0; i < n - 1; ++i)
1749 for (l = i + 1; l < n; ++l)
1758 double temp =
z[0][k];
1764 for (i = 0; i < n; i++)
1766 e[i] = MuZero *
z[0][i] *
z[0][i];
1783 int size = (int)floor(n / 2.0) + 2;
1784 double *s =
new double[size];
1785 double *t =
new double[size];
1788 for (i = 0; i < size; i++)
1795 for (m = 0; m <= n - 2; m++)
1798 for (k = (
int)floor((m + 1) / 2.0); k >= 0; k--)
1801 u = u + (a[k + n + 1] - a[l]) * t[k + 1] + b[k + n + 1] * s[k] -
1812 for (j = (
int)floor(n / 2.0); j >= 0; j--)
1817 for (m = n - 1; m <= 2 * n - 3; m++)
1820 for (k = m + 1 - n; k <= floor((m - 1) / 2.0); k++)
1824 u = u - (a[k + n + 1] - a[l]) * t[j + 1] - b[k + n + 1] * s[j + 1] +
1833 a[k] + (s[j + 1] - b[k + n + 1] * s[j + 2]) / t[j + 2];
1838 b[k + n + 1] = s[j + 1] / s[j + 2];
1847 a[2 * n] = a[n - 1] - b[2 * n] * s[1] / t[1];
1860void chri1(
int n,
double *a,
double *b,
double *a0,
double *b0,
double z)
1863 double q = ceil(3.0 * n / 2);
1864 int size = (int)
q + 1;
1867 fprintf(stderr,
"input arrays a and b are too short\n");
1869 double *r =
new double[n + 1];
1871 r[1] =
z - a[1] - b[1] / r[0];
1872 a0[0] = a[1] + r[1] - r[0];
1873 b0[0] = -r[0] * b[0];
1881 for (k = 1; k < n; k++)
1883 r[k + 1] =
z - a[k + 1] - b[k + 1] / r[k];
1884 a0[k] = a[k + 1] + r[k + 1] - r[k];
1885 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)