7 #include <boost/core/ignore_unused.hpp>
13 #define EPS 100 * DBL_EPSILON
15 #define sign(a, b) ((b) < 0 ? -fabs(a) : fabs(a))
27 int m_digits =
static_cast<int>(fabs(floor(log10(DBL_EPSILON))) - 1);
29 if (fabs(xl - xr) < 1.e-4)
32 m_expn =
static_cast<int>(floor(log10(fabs(xl - xr))));
33 m_xln = xl * powl(10.0L, -m_expn) -
34 floor(xl * powl(10.0L,
37 xr * powl(10.0L, -m_expn) -
42 round(m_xln * powl(10.0L, m_digits + m_expn));
43 m_xrn = round(m_xrn * powl(10.0L, m_digits + m_expn));
45 return powl(10.0L, -m_digits) * (m_xln - m_xrn);
53 double laginterp(
double z,
int j,
const double *zj,
int np)
56 for (
int i = 0; i < np; i++)
60 temp *=
optdiff(z, zj[i]) / (zj[j] - zj[i]);
66 #define POLYNOMIAL_DEFLATION 0
68 #ifdef POLYNOMIAL_DEFLATION
70 #define jacobz(n, z, alpha, beta) Jacobz(n, z, alpha, beta)
73 #define jacobz(n, z, alpha, beta) JacZeros(n, z, alpha, beta)
77 static void Jacobz(
const int n,
double *z,
const double alpha,
82 static void TriQL(
const int,
double *,
double *,
double **);
83 double gammaF(
const double);
84 double gammaFracGammaF(
const int,
const double,
const int,
const double);
85 static void RecCoeff(
const int,
double *,
double *,
const double,
const double);
86 void JKMatrix(
int,
double *,
double *);
87 void chri1(
int,
double *,
double *,
double *,
double *,
double);
99 void zwgj(
double *z,
double *w,
const int np,
const double alpha,
103 double fac, one = 1.0, two = 2.0, apb = alpha +
beta;
108 fac = pow(two, apb + one) *
gammaFracGammaF(np + 1, alpha, np + 1, 0.0) *
111 for (i = 0; i < np; ++i)
112 w[i] = fac / (w[i] * w[i] * (one - z[i] * z[i]));
127 void zwgrjm(
double *z,
double *w,
const int np,
const double alpha,
139 double fac, one = 1.0, two = 2.0, apb = alpha +
beta;
149 for (i = 0; i < np; ++i)
150 w[i] = fac * (1 - z[i]) / (w[i] * w[i]);
151 w[0] *= (
beta + one);
168 void zwgrjp(
double *z,
double *w,
const int np,
const double alpha,
180 double fac, one = 1.0, two = 2.0, apb = alpha +
beta;
190 for (i = 0; i < np; ++i)
191 w[i] = fac * (1 + z[i]) / (w[i] * w[i]);
192 w[np - 1] *= (alpha + one);
207 void zwglj(
double *z,
double *w,
const int np,
const double alpha,
227 double fac, one = 1.0, apb = alpha +
beta, two = 2.0;
231 jacobz(np - 2, z + 1, alpha + one,
beta + one);
238 for (i = 0; i < np; ++i)
239 w[i] = fac / (w[i] * w[i]);
240 w[0] *= (
beta + one);
241 w[np - 1] *= (alpha + one);
256 void zwgk(
double *z,
double *w,
const int npt,
const double alpha,
260 int np = (npt - 1) / 2;
265 int kpoints = 2 * np + 1;
268 int ncoeffs = (int)floor(3.0 * (np + 1) / 2);
273 double *a =
new double[kpoints];
274 double *b =
new double[kpoints];
277 for (i = 0; i < kpoints; i++)
290 double **zmatrix =
new double *[kpoints];
291 for (i = 0; i < kpoints; i++)
293 zmatrix[i] =
new double[kpoints];
294 for (j = 0; j < kpoints; j++)
299 for (i = 0; i < kpoints; i++)
305 TriQL(kpoints, a, b, zmatrix);
307 for (i = 0; i < kpoints; i++)
314 for (i = 0; i < kpoints; i++)
328 void zwrk(
double *z,
double *w,
const int npt,
const double alpha,
336 fprintf(stderr,
"too few points in formula\n");
345 int kpoints = 2 * np;
348 int ncoeffs = (int)ceil(3.0 * np / 2);
351 double *a =
new double[ncoeffs + 1];
352 double *b =
new double[ncoeffs + 1];
355 for (i = 0; i < ncoeffs + 1; i++)
364 double *a0 =
new double[ncoeffs];
365 double *b0 =
new double[ncoeffs];
367 chri1(ncoeffs, a, b, a0, b0, end0);
369 double s = b0[0] / fabs(b0[0]);
373 double *z1 =
new double[2 * np - 1];
374 double *w1 =
new double[2 * np - 1];
375 for (i = 0; i < ncoeffs; i++)
382 double **zmatrix =
new double *[2 * np - 1];
383 for (i = 0; i < 2 * np - 1; i++)
385 zmatrix[i] =
new double[2 * np - 1];
386 for (j = 0; j < 2 * np - 1; j++)
391 for (i = 0; i < 2 * np - 1; i++)
397 TriQL(2 * np - 1, z1, w1, zmatrix);
400 for (i = 0; i < 2 * np - 1; i++)
402 w1[i] = s * w1[i] / (z1[i] - end0);
408 for (i = 1; i < kpoints; i++)
420 for (i = 0; i < 2 * np - 1; i++)
434 void zwlk(
double *z,
double *w,
const int npt,
const double alpha,
438 int np = (npt + 1) / 2;
442 fprintf(stderr,
"too few points in formula\n");
451 int kpoints = 2 * np - 1;
454 int ncoeffs = (int)ceil(3.0 * np / 2) - 1;
457 double *a =
new double[ncoeffs + 1];
458 double *b =
new double[ncoeffs + 1];
461 for (i = 0; i < ncoeffs + 1; i++)
470 double *a0 =
new double[ncoeffs];
471 double *b0 =
new double[ncoeffs];
473 chri1(ncoeffs, a, b, a0, b0, endl);
475 double *a1 =
new double[ncoeffs - 1];
476 double *b1 =
new double[ncoeffs - 1];
478 chri1(ncoeffs - 1, a0, b0, a1, b1, endr);
480 double s = b1[0] / fabs(b1[0]);
484 double *z1 =
new double[2 * np - 3];
485 double *w1 =
new double[2 * np - 3];
486 for (i = 0; i < ncoeffs; i++)
493 double **zmatrix =
new double *[2 * np - 3];
494 for (i = 0; i < 2 * np - 3; i++)
496 zmatrix[i] =
new double[2 * np - 3];
497 for (j = 0; j < 2 * np - 3; j++)
502 for (i = 0; i < 2 * np - 3; i++)
508 TriQL(2 * np - 3, z1, w1, zmatrix);
511 double sumW1Z1 = 0.0;
512 for (i = 0; i < 2 * np - 3; i++)
514 w1[i] = s * w1[i] / (z1[i] - endl) / (z1[i] - endr);
516 sumW1Z1 += z1[i] * w1[i];
519 double c0 = b[0] - sumW1;
520 double c1 = a[0] * b[0] - sumW1Z1;
523 z[2 * np - 2] = endr;
524 w[0] = (c0 * endr - c1) / (endr - endl);
525 w[2 * np - 2] = (c1 - c0 * endl) / (endr - endl);
527 for (i = 1; i < kpoints - 1; i++)
540 for (i = 0; i < 2 * np - 3; i++)
558 void Dgj(
double *D,
const double *z,
const int np,
const double alpha,
562 double one = 1.0, two = 2.0;
573 pd = (
double *)malloc(np *
sizeof(
double));
576 for (i = 0; i < np; i++)
578 for (j = 0; j < np; j++)
582 D[i * np + j] = pd[j] / (pd[i] * (z[j] - z[i]));
585 (alpha -
beta + (alpha +
beta + two) * z[j]) /
586 (two * (one - z[j] * z[j]));
605 void Dgrjm(
double *D,
const double *z,
const int np,
const double alpha,
616 double one = 1.0, two = 2.0;
619 pd = (
double *)malloc(np *
sizeof(
double));
623 jacobd(np - 1, z + 1, pd + 1, np - 1, alpha,
beta + 1);
624 for (i = 1; i < np; ++i)
627 for (i = 0; i < np; i++)
629 for (j = 0; j < np; j++)
632 D[i * np + j] = pd[j] / (pd[i] * (z[j] - z[i]));
636 D[i * np + j] = -(np + alpha +
beta + one) *
637 (np - one) / (two * (
beta + two));
640 (alpha -
beta + one + (alpha +
beta + one) * z[j]) /
641 (two * (one - z[j] * z[j]));
661 void Dgrjp(
double *D,
const double *z,
const int np,
const double alpha,
672 double one = 1.0, two = 2.0;
675 pd = (
double *)malloc(np *
sizeof(
double));
677 jacobd(np - 1, z, pd, np - 1, alpha + 1,
beta);
678 for (i = 0; i < np - 1; ++i)
681 pd[np - 1] /=
gammaF(alpha + two);
683 for (i = 0; i < np; i++)
685 for (j = 0; j < np; j++)
688 D[i * np + j] = pd[j] / (pd[i] * (z[j] - z[i]));
692 D[i * np + j] = (np + alpha +
beta + one) * (np - one) /
693 (two * (alpha + two));
696 (alpha -
beta - one + (alpha +
beta + one) * z[j]) /
697 (two * (one - z[j] * z[j]));
718 void Dglj(
double *D,
const double *z,
const int np,
const double alpha,
728 double one = 1.0, two = 2.0;
731 pd = (
double *)malloc(np *
sizeof(
double));
735 jacobd(np - 2, z + 1, pd + 1, np - 2, alpha + 1,
beta + 1);
736 for (i = 1; i < np - 1; ++i)
737 pd[i] *= (one - z[i] * z[i]);
739 pd[np - 1] /=
gammaF(alpha + two);
741 for (i = 0; i < np; i++)
743 for (j = 0; j < np; j++)
746 D[i * np + j] = pd[j] / (pd[i] * (z[j] - z[i]));
751 (alpha - (np - 1) * (np + alpha +
beta)) /
752 (two * (
beta + two));
753 else if (j == np - 1)
755 -(
beta - (np - 1) * (np + alpha +
beta)) /
756 (two * (alpha + two));
758 D[i * np + j] = (alpha -
beta + (alpha +
beta) * z[j]) /
759 (two * (one - z[j] * z[j]));
789 double hgj(
const int i,
const double z,
const double *zgj,
const int np,
790 const double alpha,
const double beta)
792 boost::ignore_unused(alpha,
beta);
824 double hgrjm(
const int i,
const double z,
const double *zgrj,
const int np,
825 const double alpha,
const double beta)
827 boost::ignore_unused(alpha,
beta);
860 double hgrjp(
const int i,
const double z,
const double *zgrj,
const int np,
861 const double alpha,
const double beta)
863 boost::ignore_unused(alpha,
beta);
895 double hglj(
const int i,
const double z,
const double *zglj,
const int np,
896 const double alpha,
const double beta)
898 boost::ignore_unused(alpha,
beta);
923 void Imgj(
double *im,
const double *zgj,
const double *zm,
const int nz,
924 const int mz,
const double alpha,
const double beta)
929 for (i = 0; i < nz; ++i)
931 for (j = 0; j < mz; ++j)
934 im[i * mz + j] =
hgj(i, zp, zgj, nz, alpha,
beta);
954 void Imgrjm(
double *im,
const double *zgrj,
const double *zm,
const int nz,
955 const int mz,
const double alpha,
const double beta)
960 for (i = 0; i < nz; i++)
962 for (j = 0; j < mz; j++)
965 im[i * mz + j] =
hgrjm(i, zp, zgrj, nz, alpha,
beta);
985 void Imgrjp(
double *im,
const double *zgrj,
const double *zm,
const int nz,
986 const int mz,
const double alpha,
const double beta)
991 for (i = 0; i < nz; i++)
993 for (j = 0; j < mz; j++)
996 im[i * mz + j] =
hgrjp(i, zp, zgrj, nz, alpha,
beta);
1016 void Imglj(
double *im,
const double *zglj,
const double *zm,
const int nz,
1017 const int mz,
const double alpha,
const double beta)
1022 for (i = 0; i < nz; i++)
1024 for (j = 0; j < mz; j++)
1027 im[i * mz + j] =
hglj(i, zp, zglj, nz, alpha,
beta);
1074 void jacobfd(
const int np,
const double *z,
double *poly_in,
double *polyd,
1075 const int n,
const double alpha,
const double beta)
1078 double zero = 0.0, one = 1.0, two = 2.0;
1086 for (i = 0; i < np; ++i)
1089 for (i = 0; i < np; ++i)
1095 for (i = 0; i < np; ++i)
1096 poly_in[i] = 0.5 * (alpha -
beta + (alpha +
beta + two) * z[i]);
1098 for (i = 0; i < np; ++i)
1099 polyd[i] = 0.5 * (alpha +
beta + two);
1104 double a1, a2, a3, a4;
1105 double two = 2.0, apb = alpha +
beta;
1106 double *poly, *polyn1, *polyn2;
1110 polyn1 = (
double *)malloc(2 * np *
sizeof(
double));
1111 polyn2 = polyn1 + np;
1116 polyn1 = (
double *)malloc(3 * np *
sizeof(
double));
1117 polyn2 = polyn1 + np;
1121 for (i = 0; i < np; ++i)
1124 polyn1[i] = 0.5 * (alpha -
beta + (alpha +
beta + two) * z[i]);
1127 for (k = 2; k <= n; ++k)
1129 a1 = two * k * (k + apb) * (two * k + apb - two);
1130 a2 = (two * k + apb - one) * (alpha * alpha -
beta *
beta);
1132 (two * k + apb - two) * (two * k + apb - one) * (two * k + apb);
1133 a4 = two * (k + alpha - one) * (k +
beta - one) * (two * k + apb);
1139 for (i = 0; i < np; ++i)
1141 poly[i] = (a2 + a3 * z[i]) * polyn1[i] - a4 * polyn2[i];
1142 polyn2[i] = polyn1[i];
1143 polyn1[i] = poly[i];
1149 a1 = n * (alpha -
beta);
1150 a2 = n * (two * n + alpha +
beta);
1151 a3 = two * (n + alpha) * (n +
beta);
1152 a4 = (two * n + alpha +
beta);
1158 for (i = 0; i < np; ++i)
1160 polyd[i] = (a1 - a2 * z[i]) * poly[i] + a3 * polyn2[i];
1161 polyd[i] /= (one - z[i] * z[i]);
1187 void jacobd(
const int np,
const double *z,
double *polyd,
const int n,
1188 const double alpha,
const double beta)
1193 for (i = 0; i < np; ++i)
1198 jacobfd(np, z, polyd, NULL, n - 1, alpha + one,
beta + one);
1199 for (i = 0; i < np; ++i)
1200 polyd[i] *= 0.5 * (alpha +
beta + (
double)n + one);
1221 gamma = -2.0 *
sqrt(M_PI);
1224 else if ((x - (
int)x) == 0.5)
1236 else if ((x - (
int)x) == 0.0)
1248 fprintf(stderr,
"%lf is not of integer or half order\n", x);
1269 double halfa = fabs(alpha -
int(alpha));
1270 double halfb = fabs(
beta -
int(
beta));
1271 if (halfa == 0.0 && halfb == 0.0)
1277 for (
int tmp = X - 1; tmp > Y - 1; tmp -= 1)
1282 for (
int tmp = Y - 1; tmp > X - 1; tmp -= 1)
1287 else if (halfa == 0.5 && halfb == 0.5)
1289 double X = x + alpha;
1290 double Y = y +
beta;
1293 for (
int tmp =
int(X); tmp > int(Y); tmp -= 1)
1298 for (
int tmp =
int(Y); tmp > int(X); tmp -= 1)
1305 double X = x + alpha;
1306 double Y = y +
beta;
1307 while (X > 1 || Y > 1)
1322 gamma *=
sqrt(M_PI);
1326 gamma /=
sqrt(M_PI);
1330 fprintf(stderr,
"%lf or %lf is not of integer or half order\n", X,
1346 static void Jacobz(
const int n,
double *z,
const double alpha,
1350 double dth = M_PI / (2.0 * (double)n);
1351 double poly, pder, rlast = 0.0;
1352 double sum, delr, r;
1353 double one = 1.0, two = 2.0;
1358 for (k = 0; k < n; ++k)
1360 r = -cos((two * (
double)k + one) * dth);
1362 r = 0.5 * (r + rlast);
1364 for (j = 1; j <
STOP; ++j)
1368 for (i = 0, sum = 0.0; i < k; ++i)
1369 sum += one / (r - z[i]);
1371 delr = -poly / (pder - sum * poly);
1373 if (fabs(delr) <
EPS)
1406 void JacZeros(
const int n,
double *a,
double *b,
const double alpha,
1413 double **z =
new double *[n];
1414 for (i = 0; i < n; i++)
1416 z[i] =
new double[n];
1417 for (j = 0; j < n; j++)
1422 for (i = 0; i < n; i++)
1438 static void RecCoeff(
const int n,
double *a,
double *b,
const double alpha,
1443 double apb, apbi, a2b2;
1454 a[0] = (
beta - alpha) / apbi;
1455 b[1] = (4.0 * (1.0 + alpha) * (1.0 +
beta) / ((apbi + 1.0) * apbi * apbi));
1457 a2b2 =
beta *
beta - alpha * alpha;
1459 for (i = 1; i < n - 1; i++)
1461 apbi = 2.0 * (i + 1) + apb;
1462 a[i] = a2b2 / ((apbi - 2.0) * apbi);
1463 b[i + 1] = (4.0 * (i + 1) * (i + 1 + alpha) * (i + 1 +
beta) *
1464 (i + 1 + apb) / ((apbi * apbi - 1) * apbi * apbi));
1467 apbi = 2.0 * n + apb;
1468 a[n - 1] = a2b2 / ((apbi - 2.0) * apbi);
1497 static void TriQL(
const int n,
double *d,
double *e,
double **z)
1499 int m, l, iter, i, k;
1500 double s, r,
p, g, f, dd, c, b;
1502 double MuZero = e[0];
1505 for (i = 0; i < n - 1; i++)
1507 e[i] =
sqrt(e[i + 1]);
1511 for (l = 0; l < n; l++)
1516 for (m = l; m < n - 1; m++)
1518 dd = fabs(d[m]) + fabs(d[m + 1]);
1519 if (fabs(e[m]) + dd == dd)
1526 fprintf(stderr,
"triQL: Too many iterations in TQLI");
1529 g = (d[l + 1] - d[l]) / (2.0 * e[l]);
1530 r =
sqrt((g * g) + 1.0);
1531 g = d[m] - d[l] + e[l] / (g +
sign(r, g));
1534 for (i = m - 1; i >= l; i--)
1538 if (fabs(f) >= fabs(g))
1541 r =
sqrt((c * c) + 1.0);
1548 r =
sqrt((s * s) + 1.0);
1553 r = (d[i] - g) * s + 2.0 * c * b;
1559 for (k = 0; k < n; k++)
1562 z[k][i + 1] = s * z[k][i] + c * f;
1563 z[k][i] = c * z[k][i] - s * f;
1576 for (i = 0; i < n - 1; ++i)
1580 for (l = i + 1; l < n; ++l)
1589 double temp = z[0][k];
1595 for (i = 0; i < n; i++)
1597 e[i] = MuZero * z[0][i] * z[0][i];
1614 int size = (int)floor(n / 2.0) + 2;
1615 double *s =
new double[size];
1616 double *t =
new double[size];
1619 for (i = 0; i < size; i++)
1626 for (m = 0; m <= n - 2; m++)
1629 for (k = (
int)floor((m + 1) / 2.0); k >= 0; k--)
1632 u = u + (a[k + n + 1] - a[l]) * t[k + 1] + b[k + n + 1] * s[k] -
1643 for (j = (
int)floor(n / 2.0); j >= 0; j--)
1648 for (m = n - 1; m <= 2 * n - 3; m++)
1651 for (k = m + 1 - n; k <= floor((m - 1) / 2.0); k++)
1655 u = u - (a[k + n + 1] - a[l]) * t[j + 1] - b[k + n + 1] * s[j + 1] +
1664 a[k] + (s[j + 1] - b[k + n + 1] * s[j + 2]) / t[j + 2];
1669 b[k + n + 1] = s[j + 1] / s[j + 2];
1678 a[2 * n] = a[n - 1] - b[2 * n] * s[1] / t[1];
1691 void chri1(
int n,
double *a,
double *b,
double *a0,
double *b0,
double z)
1694 double q = ceil(3.0 * n / 2);
1695 int size = (int)q + 1;
1698 fprintf(stderr,
"input arrays a and b are too short\n");
1700 double *r =
new double[n + 1];
1702 r[1] = z - a[1] - b[1] / r[0];
1703 a0[0] = a[1] + r[1] - r[0];
1704 b0[0] = -r[0] * b[0];
1712 for (k = 1; k < n; k++)
1714 r[k + 1] = z - a[k + 1] - b[k + 1] / r[k];
1715 a0[k] = a[k + 1] + r[k + 1] - r[k];
1716 b0[k] = b[k] * r[k] / r[k - 1];
1732 int n, std::complex<Nektar::NekDouble> y)
1734 std::complex<Nektar::NekDouble> z(1.0, 0.0);
1735 std::complex<Nektar::NekDouble> zbes(1.0, 0.0);
1736 std::complex<Nektar::NekDouble> zarg;
1741 zarg = -0.25 * y * y;
1743 while (
abs(z) > tol && i <= maxit)
1745 z = z * (1.0 / i / (i + n) * zarg);
1752 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 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...
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)